react-strawberry-toast 2.0.0 → 2.1.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";var D=Object.defineProperty;var ot=Object.getOwnPropertyDescriptor;var at=Object.getOwnPropertyNames;var rt=Object.prototype.hasOwnProperty;var nt=(t,e)=>{for(var n in e)D(t,n,{get:e[n],enumerable:!0})},it=(t,e,n,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of at(e))!rt.call(t,r)&&r!==n&&D(t,r,{get:()=>e[r],enumerable:!(p=ot(e,r))||p.enumerable});return t};var ct=t=>it(D({},"__esModule",{value:!0}),t);var mt={};nt(mt,{ToastContainer:()=>ut,toast:()=>o,toastStore:()=>g,useToasts:()=>V});module.exports=ct(mt);var Y=()=>{let t=0;return()=>`react-strawberry-toast_${t++}`};var $=class{state=[];listeners=new Set;activatedToasts=new Set;toastTimers=new Map;constructor(){}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setState(e){this.state=typeof e=="function"?e(this.state):e,this.listeners.forEach(n=>n())}getSnapShot(){return this.state}};var d="react-strawberry-toast";var T=require("react/jsx-runtime");function lt(){return(0,T.jsxs)("svg",{stroke:"none",fill:"none",strokeWidth:"2",viewBox:"0 0 24 24",strokeLinecap:"round",strokeLinejoin:"round",height:"22",width:"22",xmlns:"http://www.w3.org/2000/svg",children:[(0,T.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z"}),(0,T.jsx)("path",{className:"react-strawberry-toast-path",d:"M17 3.34a10 10 0 1 1 -14.995 8.984l-.005 -.324l.005 -.324a10 10 0 0 1 14.995 -8.336zm-1.293 5.953a1 1 0 0 0 -1.32 -.083l-.094 .083l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.403 1.403l.083 .094l2 2l.094 .083a1 1 0 0 0 1.226 0l.094 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z",strokeWidth:"0",fill:"#1dca82"})]})}function X({fill:t}){return(0,T.jsx)("svg",{stroke:"none",fill:t,strokeWidth:"2",viewBox:"0 0 24 24",height:"22",width:"22",xmlns:"http://www.w3.org/2000/svg",children:(0,T.jsx)("path",{className:"react-strawberry-toast-path",d:"M11.953 2C6.465 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.493 2 11.953 2zM13 17h-2v-2h2v2zm0-4h-2V7h2v6z"})})}function dt(){return(0,T.jsx)("svg",{stroke:"none",fill:"#fcba03",strokeWidth:"0",viewBox:"0 0 1024 1024",height:"22",width:"22",xmlns:"http://www.w3.org/2000/svg",children:(0,T.jsx)("path",{className:"react-strawberry-toast-path",d:"M955.7 856l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zM480 416c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v184c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V416zm32 352a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z"})})}function G(){return(0,T.jsx)("svg",{fill:"#8b8b8b",strokeWidth:"0",viewBox:"0 0 512 512",height:"15px",width:"15px",xmlns:"http://www.w3.org/2000/svg",children:(0,T.jsx)("path",{className:"react-strawberry-toast-path",d:"M400 145.49 366.51 112 256 222.51 145.49 112 112 145.49 222.51 256 112 366.51 145.49 400 256 289.49 366.51 400 400 366.51 289.49 256 400 145.49z"})})}var h={success:(0,T.jsx)(lt,{}),error:(0,T.jsx)(X,{fill:"#eb2639"}),loading:(0,T.jsx)("div",{className:`${d}__loading`}),warn:(0,T.jsx)(dt,{}),info:(0,T.jsx)(X,{fill:"#5365e7"})};var F=t=>{let e=a=>{let i=t.toastTimers.get(a);clearTimeout(i),t.toastTimers.delete(a)},n=a=>{t.activatedToasts.add(a)},p=a=>t.activatedToasts.has(a),r=(a,i=200)=>{p(a)&&(t.activatedToasts.delete(a),setTimeout(()=>{t.state=t.state.filter(c=>c.toastId!==a),t.setState([...t.state])},i),e(a))},y=()=>{t.state.forEach(a=>{u(a.toastId,0)})},f=(a,i,c)=>{t.state=t.state.map(s=>s.toastId===a?{...s,...c,updated:new Date().getTime(),data:i}:s),t.setState([...t.state])},w=a=>{let i=new Date().getTime();t.state=t.state.map(c=>c.toastId===a?{...c,pausedAt:i}:c),e(a)},u=(a,i)=>{let c=setTimeout(()=>{var m;t.state=t.state.map(l=>l.toastId===a?{...l,isVisible:!1}:l),t.setState([...t.state]);let s=(m=t.state.find(l=>l.toastId===a))==null?void 0:m.removeTimeOut;r(a,s)},i>2147483647?2147483647:i);t.toastTimers.set(a,c)};return{setActive:n,isActive:p,disappear:u,resume:a=>{if(t.toastTimers.has(a))return;let i=t.state.find(s=>s.toastId===a);if(!i)return;let c=i.createdAt+(i.timeOut||3e3)-(i.pausedAt||0);u(a,c)},pause:w,replace:f,remove:r,allClear:y}};var g=new $,pt=Y(),_=(t="default")=>(e,n={})=>{let{timeOut:p=3e3,removeTimeOut:r=200,pauseOnHover:y=!0,toastId:f,className:w,style:u,target:v,closeButton:a}=n,i=f||pt();if(o.isActive(i))throw new Error("A duplicate custom ID is not available.");let c=new Date().getTime(),s={updated:null,pausedAt:null,className:w||null,style:u||{},icon:n.icon||null,containerId:n.containerId||null,position:n.position||null,timeOut:p>2147483647?2147483647:p,toastId:i,data:e,createdAt:c,toastType:t,pauseOnHover:y,removeTimeOut:r,closeButton:a||!1,target:v||null,isVisible:!0};return g.state.push(s),g.setState([...g.state]),i},o=(t,e={})=>_()(t,e),A=F(g);o.setActive=A.setActive;o.isActive=A.isActive;o.disappear=A.disappear;o.resume=A.resume;o.pause=A.pause;o.replace=A.replace;o.remove=A.remove;o.allClear=A.allClear;o.success=_("success");o.error=_("error");o.warn=_("warn");o.info=_("info");o.loading=_("loading");o.custom=_("custom");o.promise=(t,e,n={})=>{let{loading:p,success:r,error:y}=e,f=o.loading(p,{...n,timeOut:2147483647}),w={toastId:f,close:()=>o.disappear(f,0),immediatelyClose:()=>{o.disappear(f,0),o.remove(f,0)},icons:{success:h.success,error:h.error,warn:h.warn,loading:h.loading,info:h.info},isVisible:!0},u=n.timeOut||=3e3;t.then(v=>{o.replace(f,typeof r=="function"?r(v,w):r,{...n,timeOut:u>2147483647?2147483647:u,toastType:"success"})}).catch(v=>{o.replace(f,typeof y=="function"?y(v,w):y,{...n,timeOut:u>2147483647?2147483647:u,toastType:"error"})})};var U=require("react");var P=require("react");var q=require("react");function J({condition:t,children:e}){let n=q.Children.toArray(e);if(n.length>2)throw new Error("The number of children exceeds two.");return n.find(p=>t?p.key===".0":p.key===".1")}function K({children:t}){return t}function Q({children:t}){return t}var Z=({isVisible:t,position:e})=>e?t?/top/i.test(e)?`${d}__fade-in`:`${d}__fade-in-reverse`:/bottom/i.test(e)?`${d}__fade-out-reverse`:`${d}__fade-out`:t?`${d}__fade-in`:`${d}__fade-out`;var O=require("react"),z=(t,e)=>{let n=(0,O.useRef)(e);(0,O.useEffect)(()=>{n.current=e},[e]),(0,O.useEffect)(()=>(window.addEventListener(t,n.current),()=>{window.removeEventListener(t,n.current)}),[t])};var S=require("react/jsx-runtime"),B=(0,P.forwardRef)(function({toastProps:e,pauseOnActivate:n},p){let{toastId:r,isVisible:y,timeOut:f,containerId:w,className:u,style:v,icon:a,updated:i,toastType:c,position:s,data:m,pauseOnHover:l,closeButton:E}=e,b=Z({isVisible:y,position:s}),C=typeof m=="function"?m({toastId:r,close:()=>o.disappear(r,0),immediatelyClose:()=>{o.disappear(r,0),o.remove(r,0)},icons:{success:h.success,error:h.error,warn:h.warn,loading:h.loading,info:h.info},isVisible:y}):m,H=()=>{n&&o.resume(r)},x=()=>{n&&o.pause(r)};z("focus",H),z("blur",x),(0,P.useEffect)(()=>{o.isActive(r)||(o.setActive(r),o.disappear(r,f))},[r]),(0,P.useEffect)(()=>{i!==null&&o.disappear(r,f)},[i]);let R=a||(c==="custom"||c==="default"?null:h[c]);return(0,S.jsx)("output",{role:"status",ref:p,className:`${d}__toast-content-container`,"data-testid":`container-${w||"default"}`,onMouseEnter:()=>{l&&o.pause(r)},onMouseLeave:()=>{l&&o.resume(r)},children:(0,S.jsxs)(J,{condition:c!=="custom",children:[(0,S.jsx)(K,{children:(0,S.jsxs)("div",{className:u??`${d}__toast-content ${d}__toast-${c} ${o.isActive(r)?"":b}`,style:v,children:[R&&(0,S.jsx)("span",{className:`${d}__toast-icon`,children:R}),C,E&&(0,S.jsx)("button",{className:`${d}__close-button`,onClick:()=>{o.disappear(r,0)},type:"button",children:(0,S.jsx)(G,{})})]})}),(0,S.jsx)(Q,{children:(0,S.jsx)("div",{className:u??`${o.isActive(r)?"":b}`,children:C})})]})})});var j=require("react");var V=()=>(0,j.useSyncExternalStore)(g.subscribe.bind(g),g.getSnapShot.bind(g),g.getSnapShot.bind(g));var N=require("react/jsx-runtime");function ut({className:t,style:e,position:n="top-center",containerId:p="",gap:r=9,reverse:y=!1,pauseOnActivate:f=!0}){let w=V(),u=(0,U.useRef)({}),v=(0,U.useRef)({}),a=s=>{var m;return(m=s.target)==null?void 0:m.element},i=s=>p?s.containerId===p:!s.containerId,c=w.filter(s=>!a(s)).reduce((s,m)=>{let l=m.position||n;return m.position=l,s[l]=s[l]||[],s[l].push(m),s},{});return(0,N.jsxs)("div",{id:`${d}__root`,"data-container-id":p,children:[w.filter(a).filter(i).map(s=>(0,N.jsx)(B,{ref:m=>{let l=s.target;if(!l||!m){delete v.current[s.toastId];return}let E=v.current[s.toastId]||l.element.getBoundingClientRect();v.current[s.toastId]={y:E.y,x:E.x};let[b,C]=l.offset||[0,0];m.style.top=`${E.y+C+window.scrollY}px`,m.style.left=`${E.x+b+window.scrollX}px`},toastProps:s,pauseOnActivate:f},s.toastId)),Object.entries(c).map(([s,m])=>{let l=m.filter(i),E=y?l.reverse():l;return(0,N.jsx)("div",{"data-testid":s,className:`${d}__z9999 ${t??`${d}__toast-container ${d}__${s}`}`,style:e,children:E.map((b,C,H)=>(0,N.jsx)(B,{ref:x=>{if(!x){delete u.current[b.toastId];return}let R=u.current[b.toastId]||x.getBoundingClientRect().height;u.current[b.toastId]=R;let tt=/left/.test(s)?50:/center/.test(s)?0:-50,et=/bottom/.test(s)?0:1,st=H.filter((L,M)=>M<=C-et).reduce((L,M)=>/bottom/.test(s)?L-=r+u.current[M.toastId]:L+=r+u.current[M.toastId],0);x.style.transition="transform 0.2s cubic-bezier(0.43, 0.14, 0.2, 1.05)",x.style.transform=`translate(${tt}%, ${st}px)`},toastProps:b,pauseOnActivate:f},b.toastId))},s)})]})}
2
+ "use strict";var B=Object.defineProperty;var ct=Object.getOwnPropertyDescriptor;var lt=Object.getOwnPropertyNames;var pt=Object.prototype.hasOwnProperty;var dt=(t,s)=>{for(var e in s)B(t,e,{get:s[e],enumerable:!0})},ut=(t,s,e,c)=>{if(s&&typeof s=="object"||typeof s=="function")for(let l of lt(s))!pt.call(t,l)&&l!==e&&B(t,l,{get:()=>s[l],enumerable:!(c=ct(s,l))||c.enumerable});return t};var mt=t=>ut(B({},"__esModule",{value:!0}),t);var yt={};dt(yt,{ToastContainer:()=>vt,toast:()=>a,toastStore:()=>h,useToasts:()=>Y});module.exports=mt(yt);var q=()=>{let t=0;return()=>`react-strawberry-toast_${t++}`};var k=class{state=[];listeners=new Set;activatedToasts=new Set;toastTimers=new Map;constructor(){}subscribe(s){return this.listeners.add(s),()=>{this.listeners.delete(s)}}setState(s){this.state=typeof s=="function"?s(this.state):s,this.listeners.forEach(e=>e())}getSnapShot(){return this.state}};var p="react-strawberry-toast";var m=require("react/jsx-runtime");function Tt(){return(0,m.jsxs)("svg",{stroke:"none",fill:"none",strokeWidth:"2",viewBox:"0 0 24 24",strokeLinecap:"round",strokeLinejoin:"round",height:"22",width:"22",xmlns:"http://www.w3.org/2000/svg",children:[(0,m.jsx)("path",{stroke:"none",d:"M0 0h24v24H0z"}),(0,m.jsx)("path",{className:"react-strawberry-toast-path",d:"M17 3.34a10 10 0 1 1 -14.995 8.984l-.005 -.324l.005 -.324a10 10 0 0 1 14.995 -8.336zm-1.293 5.953a1 1 0 0 0 -1.32 -.083l-.094 .083l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.403 1.403l.083 .094l2 2l.094 .083a1 1 0 0 0 1.226 0l.094 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z",strokeWidth:"0",fill:"#1dca82"})]})}function J({fill:t}){return(0,m.jsx)("svg",{stroke:"none",fill:t,strokeWidth:"2",viewBox:"0 0 24 24",height:"22",width:"22",xmlns:"http://www.w3.org/2000/svg",children:(0,m.jsx)("path",{className:"react-strawberry-toast-path",d:"M11.953 2C6.465 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.493 2 11.953 2zM13 17h-2v-2h2v2zm0-4h-2V7h2v6z"})})}function ft(){return(0,m.jsx)("svg",{stroke:"none",fill:"#fcba03",strokeWidth:"0",viewBox:"0 0 1024 1024",height:"22",width:"22",xmlns:"http://www.w3.org/2000/svg",children:(0,m.jsx)("path",{className:"react-strawberry-toast-path",d:"M955.7 856l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zM480 416c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v184c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V416zm32 352a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z"})})}function K(){return(0,m.jsx)("svg",{fill:"#8b8b8b",strokeWidth:"0",viewBox:"0 0 512 512",height:"15px",width:"15px",xmlns:"http://www.w3.org/2000/svg",children:(0,m.jsx)("path",{className:"react-strawberry-toast-path",d:"M400 145.49 366.51 112 256 222.51 145.49 112 112 145.49 222.51 256 112 366.51 145.49 400 256 289.49 366.51 400 400 366.51 289.49 256 400 145.49z"})})}var T={success:(0,m.jsx)(Tt,{}),error:(0,m.jsx)(J,{fill:"#eb2639"}),loading:(0,m.jsx)("div",{className:`${p}__loading`}),warn:(0,m.jsx)(ft,{}),info:(0,m.jsx)(J,{fill:"#5365e7"})};var Q=t=>{let s=r=>{let o=t.toastTimers.get(r);clearTimeout(o),t.toastTimers.delete(r)},e=r=>{t.activatedToasts.add(r)},c=r=>t.activatedToasts.has(r),l=(r,o=200)=>{c(r)&&(t.activatedToasts.delete(r),setTimeout(()=>{t.state=t.state.filter(n=>n.toastId!==r),t.setState([...t.state])},o),s(r))},v=()=>{t.state.forEach(r=>{u(r.toastId,0)})},d=(r,o,n)=>{t.state=t.state.map(i=>i.toastId===r?{...i,...n,updated:new Date().getTime(),data:o}:i),t.setState([...t.state])},y=r=>{let o=new Date().getTime();t.state=t.state.map(n=>n.toastId===r?{...n,pausedAt:o}:n),s(r)},u=(r,o)=>{let n=setTimeout(()=>{var w;t.state=t.state.map(b=>b.toastId===r?{...b,isVisible:!1}:b),t.setState([...t.state]);let i=(w=t.state.find(b=>b.toastId===r))==null?void 0:w.removeTimeOut;l(r,i)},o>2147483647?2147483647:o);t.toastTimers.set(r,n)};return{setActive:e,isActive:c,disappear:u,resume:r=>{if(t.toastTimers.has(r))return;let o=t.state.find(i=>i.toastId===r);if(!o)return;let n=o.createdAt+(o.timeOut||3e3)-(o.pausedAt||0);u(r,n)},pause:y,replace:d,remove:l,allClear:v}};var h=new k,ht=q(),E=(t="default")=>(s,e={})=>{let{timeOut:c=3e3,removeTimeOut:l=200,pauseOnHover:v=!0,toastId:d,className:y,style:u,target:f,closeButton:r}=e,o=d||ht();if(a.isActive(o))throw new Error("A duplicate custom ID is not available.");let n=new Date().getTime(),i={updated:null,pausedAt:null,className:y||null,style:u||{},icon:e.icon||null,containerId:e.containerId||null,position:e.position||null,timeOut:c>2147483647?2147483647:c,toastId:o,data:s,createdAt:n,toastType:t,pauseOnHover:v,removeTimeOut:l,closeButton:r||!1,target:f||null,isVisible:!0};return h.state.push(i),h.setState([...h.state]),o},a=(t,s={})=>E()(t,s),A=Q(h);a.setActive=A.setActive;a.isActive=A.isActive;a.disappear=A.disappear;a.resume=A.resume;a.pause=A.pause;a.replace=A.replace;a.remove=A.remove;a.allClear=A.allClear;a.success=E("success");a.error=E("error");a.warn=E("warn");a.info=E("info");a.loading=E("loading");a.custom=E("custom");a.promise=(t,s,e={})=>{let{loading:c,success:l,error:v}=s,d=a.loading(c,{...e,timeOut:2147483647}),y={toastId:d,close:()=>a.disappear(d,0),immediatelyClose:()=>{a.disappear(d,0),a.remove(d,0)},icons:{success:T.success,error:T.error,warn:T.warn,loading:T.loading,info:T.info},isVisible:!0},u=e.timeOut||=3e3;t.then(f=>{a.replace(d,typeof l=="function"?l(f,y):l,{...e,timeOut:u>2147483647?2147483647:u,toastType:"success"})}).catch(f=>{a.replace(d,typeof v=="function"?v(f,y):v,{...e,timeOut:u>2147483647?2147483647:u,toastType:"error"})})};var _=require("react");var Z=require("react");function tt({condition:t,children:s}){let e=Z.Children.toArray(s);if(e.length>2)throw new Error("The number of children exceeds two.");return e.find(c=>t?c.key===".0":c.key===".1")}function et({children:t}){return t}function st({children:t}){return t}var ot=({isVisible:t,position:s})=>s?t?/top/i.test(s)?`${p}__fade-in`:`${p}__fade-in-reverse`:/bottom/i.test(s)?`${p}__fade-out-reverse`:`${p}__fade-out`:t?`${p}__fade-in`:`${p}__fade-out`;var P=require("react"),L=(t,s)=>{let e=(0,P.useRef)(s);(0,P.useEffect)(()=>{e.current=s},[s]),(0,P.useEffect)(()=>(window.addEventListener(t,e.current),()=>{window.removeEventListener(t,e.current)}),[t])};var g=require("react/jsx-runtime"),O=new Map;function U({toastProps:t}){let s=(0,_.useRef)(null),{toastId:e,isVisible:c,timeOut:l,containerId:v,className:d,style:y,icon:u,pauseOnActivate:f,updated:r,toastType:o,position:n,data:i,pauseOnHover:w,closeButton:b,samePositionLists:H,gap:x,order:C,target:N}=t,X=ot({isVisible:c,position:n}),F=typeof i=="function"?i({toastId:e,close:()=>a.disappear(e,0),immediatelyClose:()=>{a.disappear(e,0),a.remove(e,0)},icons:{success:T.success,error:T.error,warn:T.warn,loading:T.loading,info:T.info},isVisible:c}):i,rt=()=>{f&&a.resume(e)},nt=()=>{f&&a.pause(e)},G=()=>{N&&requestAnimationFrame(()=>{if(s.current){let M=N.element.getBoundingClientRect(),[D,W]=N.offset||[0,0];s.current.style.top=`${M.y+W+window.scrollY}px`,s.current.style.left=`${M.x+D+window.scrollX}px`}})};L("focus",rt),L("blur",nt),L("resize",G),(0,_.useEffect)(()=>{a.isActive(e)||(a.setActive(e),a.disappear(e,l)),G()},[e]),(0,_.useEffect)(()=>{if(s.current&&!N){let M=O.get(e)||s.current.getBoundingClientRect().height;O.set(e,M);let D=/left/.test(n)?50:/center/.test(n)?0:-50,W=/bottom/.test(n)?0:1,it=H.filter((z,$)=>$<=C-W).reduce((z,$)=>/bottom/.test(n)?z-=x+(O.get($.toastId)||0):z+=x+(O.get($.toastId)||0),0);s.current.style.transition="transform 0.2s cubic-bezier(0.43, 0.14, 0.2, 1.05)",s.current.style.transform=`translate(${D}%, ${it}px)`}return()=>{O.delete(e)}},[C]),(0,_.useEffect)(()=>{r!==null&&a.disappear(e,l)},[r]);let j=u||(o==="custom"||o==="default"?null:T[o]);return(0,g.jsx)("output",{role:"status",ref:s,className:`${p}__toast-content-container`,"data-testid":`container-${v||"default"}`,onMouseEnter:()=>{w&&a.pause(e)},onMouseLeave:()=>{w&&a.resume(e)},children:(0,g.jsxs)(tt,{condition:o!=="custom",children:[(0,g.jsx)(et,{children:(0,g.jsxs)("div",{className:d??`${p}__toast-content ${p}__toast-${o} ${a.isActive(e)?"":X}`,style:y,children:[j&&(0,g.jsx)("span",{className:`${p}__toast-icon`,children:j}),F,b&&(0,g.jsx)("button",{"data-testid":`${e}__close-button`,className:`${p}__close-button`,onClick:()=>{a.disappear(e,0)},type:"button",children:(0,g.jsx)(K,{})})]})}),(0,g.jsx)(st,{children:(0,g.jsx)("div",{className:d??`${a.isActive(e)?"":X}`,children:F})})]})})}var at=require("react");var Y=()=>(0,at.useSyncExternalStore)(h.subscribe.bind(h),h.getSnapShot.bind(h),h.getSnapShot.bind(h));var I=require("react/jsx-runtime");function vt({className:t,style:s,position:e="top-center",containerId:c="",gap:l=9,reverse:v=!1,pauseOnActivate:d=!0}){let y=Y(),u=o=>{var n;return(n=o.target)==null?void 0:n.element},f=o=>c?o.containerId===c:!o.containerId,r=y.filter(o=>!u(o)).reduce((o,n)=>{let i=n.position||e;return n.position=i,o[i]=o[i]||[],o[i].push(n),o},{});return(0,I.jsxs)("div",{id:`${p}__root`,"data-container-id":c,children:[y.filter(u).filter(f).map((o,n,i)=>{let w=Object.assign(o,{gap:l,order:n,samePositionLists:i,pauseOnActivate:d});return(0,I.jsx)(U,{toastProps:w},o.toastId)}),Object.entries(r).map(([o,n])=>{let i=n.filter(f),w=v?i.reverse():i;return(0,I.jsx)("div",{"data-testid":o,className:`${p}__z9999 ${t??`${p}__toast-container ${p}__${o}`}`,style:s,children:w.map((b,H,x)=>{let C=Object.assign(b,{gap:l,order:H,samePositionLists:x,pauseOnActivate:d});return(0,I.jsx)(U,{toastProps:C},b.toastId)})},o)})]})}
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var W=()=>{let t=0;return()=>`react-strawberry-toast_${t++}`};var P=class{state=[];listeners=new Set;activatedToasts=new Set;toastTimers=new Map;constructor(){}subscribe(a){return this.listeners.add(a),()=>{this.listeners.delete(a)}}setState(a){this.state=typeof a=="function"?a(this.state):a,this.listeners.forEach(n=>n())}getSnapShot(){return this.state}};var d="react-strawberry-toast";import{jsx as T,jsxs as ot}from"react/jsx-runtime";function et(){return ot("svg",{stroke:"none",fill:"none",strokeWidth:"2",viewBox:"0 0 24 24",strokeLinecap:"round",strokeLinejoin:"round",height:"22",width:"22",xmlns:"http://www.w3.org/2000/svg",children:[T("path",{stroke:"none",d:"M0 0h24v24H0z"}),T("path",{className:"react-strawberry-toast-path",d:"M17 3.34a10 10 0 1 1 -14.995 8.984l-.005 -.324l.005 -.324a10 10 0 0 1 14.995 -8.336zm-1.293 5.953a1 1 0 0 0 -1.32 -.083l-.094 .083l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.403 1.403l.083 .094l2 2l.094 .083a1 1 0 0 0 1.226 0l.094 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z",strokeWidth:"0",fill:"#1dca82"})]})}function z({fill:t}){return T("svg",{stroke:"none",fill:t,strokeWidth:"2",viewBox:"0 0 24 24",height:"22",width:"22",xmlns:"http://www.w3.org/2000/svg",children:T("path",{className:"react-strawberry-toast-path",d:"M11.953 2C6.465 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.493 2 11.953 2zM13 17h-2v-2h2v2zm0-4h-2V7h2v6z"})})}function st(){return T("svg",{stroke:"none",fill:"#fcba03",strokeWidth:"0",viewBox:"0 0 1024 1024",height:"22",width:"22",xmlns:"http://www.w3.org/2000/svg",children:T("path",{className:"react-strawberry-toast-path",d:"M955.7 856l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zM480 416c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v184c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V416zm32 352a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z"})})}function B(){return T("svg",{fill:"#8b8b8b",strokeWidth:"0",viewBox:"0 0 512 512",height:"15px",width:"15px",xmlns:"http://www.w3.org/2000/svg",children:T("path",{className:"react-strawberry-toast-path",d:"M400 145.49 366.51 112 256 222.51 145.49 112 112 145.49 222.51 256 112 366.51 145.49 400 256 289.49 366.51 400 400 366.51 289.49 256 400 145.49z"})})}var h={success:T(et,{}),error:T(z,{fill:"#eb2639"}),loading:T("div",{className:`${d}__loading`}),warn:T(st,{}),info:T(z,{fill:"#5365e7"})};var V=t=>{let a=o=>{let i=t.toastTimers.get(o);clearTimeout(i),t.toastTimers.delete(o)},n=o=>{t.activatedToasts.add(o)},m=o=>t.activatedToasts.has(o),r=(o,i=200)=>{m(o)&&(t.activatedToasts.delete(o),setTimeout(()=>{t.state=t.state.filter(c=>c.toastId!==o),t.setState([...t.state])},i),a(o))},y=()=>{t.state.forEach(o=>{p(o.toastId,0)})},f=(o,i,c)=>{t.state=t.state.map(e=>e.toastId===o?{...e,...c,updated:new Date().getTime(),data:i}:e),t.setState([...t.state])},g=o=>{let i=new Date().getTime();t.state=t.state.map(c=>c.toastId===o?{...c,pausedAt:i}:c),a(o)},p=(o,i)=>{let c=setTimeout(()=>{var u;t.state=t.state.map(l=>l.toastId===o?{...l,isVisible:!1}:l),t.setState([...t.state]);let e=(u=t.state.find(l=>l.toastId===o))==null?void 0:u.removeTimeOut;r(o,e)},i>2147483647?2147483647:i);t.toastTimers.set(o,c)};return{setActive:n,isActive:m,disappear:p,resume:o=>{if(t.toastTimers.has(o))return;let i=t.state.find(e=>e.toastId===o);if(!i)return;let c=i.createdAt+(i.timeOut||3e3)-(i.pausedAt||0);p(o,c)},pause:g,replace:f,remove:r,allClear:y}};var w=new P,at=W(),A=(t="default")=>(a,n={})=>{let{timeOut:m=3e3,removeTimeOut:r=200,pauseOnHover:y=!0,toastId:f,className:g,style:p,target:v,closeButton:o}=n,i=f||at();if(s.isActive(i))throw new Error("A duplicate custom ID is not available.");let c=new Date().getTime(),e={updated:null,pausedAt:null,className:g||null,style:p||{},icon:n.icon||null,containerId:n.containerId||null,position:n.position||null,timeOut:m>2147483647?2147483647:m,toastId:i,data:a,createdAt:c,toastType:t,pauseOnHover:y,removeTimeOut:r,closeButton:o||!1,target:v||null,isVisible:!0};return w.state.push(e),w.setState([...w.state]),i},s=(t,a={})=>A()(t,a),E=V(w);s.setActive=E.setActive;s.isActive=E.isActive;s.disappear=E.disappear;s.resume=E.resume;s.pause=E.pause;s.replace=E.replace;s.remove=E.remove;s.allClear=E.allClear;s.success=A("success");s.error=A("error");s.warn=A("warn");s.info=A("info");s.loading=A("loading");s.custom=A("custom");s.promise=(t,a,n={})=>{let{loading:m,success:r,error:y}=a,f=s.loading(m,{...n,timeOut:2147483647}),g={toastId:f,close:()=>s.disappear(f,0),immediatelyClose:()=>{s.disappear(f,0),s.remove(f,0)},icons:{success:h.success,error:h.error,warn:h.warn,loading:h.loading,info:h.info},isVisible:!0},p=n.timeOut||=3e3;t.then(v=>{s.replace(f,typeof r=="function"?r(v,g):r,{...n,timeOut:p>2147483647?2147483647:p,toastType:"success"})}).catch(v=>{s.replace(f,typeof y=="function"?y(v,g):y,{...n,timeOut:p>2147483647?2147483647:p,toastType:"error"})})};import{useRef as Q}from"react";import{useEffect as q,forwardRef as it}from"react";import{Children as rt}from"react";function U({condition:t,children:a}){let n=rt.toArray(a);if(n.length>2)throw new Error("The number of children exceeds two.");return n.find(m=>t?m.key===".0":m.key===".1")}function Y({children:t}){return t}function X({children:t}){return t}var G=({isVisible:t,position:a})=>a?t?/top/i.test(a)?`${d}__fade-in`:`${d}__fade-in-reverse`:/bottom/i.test(a)?`${d}__fade-out-reverse`:`${d}__fade-out`:t?`${d}__fade-in`:`${d}__fade-out`;import{useEffect as F,useRef as nt}from"react";var H=(t,a)=>{let n=nt(a);F(()=>{n.current=a},[a]),F(()=>(window.addEventListener(t,n.current),()=>{window.removeEventListener(t,n.current)}),[t])};import{jsx as _,jsxs as J}from"react/jsx-runtime";var L=it(function({toastProps:a,pauseOnActivate:n},m){let{toastId:r,isVisible:y,timeOut:f,containerId:g,className:p,style:v,icon:o,updated:i,toastType:c,position:e,data:u,pauseOnHover:l,closeButton:I}=a,S=G({isVisible:y,position:e}),C=typeof u=="function"?u({toastId:r,close:()=>s.disappear(r,0),immediatelyClose:()=>{s.disappear(r,0),s.remove(r,0)},icons:{success:h.success,error:h.error,warn:h.warn,loading:h.loading,info:h.info},isVisible:y}):u,M=()=>{n&&s.resume(r)},x=()=>{n&&s.pause(r)};H("focus",M),H("blur",x),q(()=>{s.isActive(r)||(s.setActive(r),s.disappear(r,f))},[r]),q(()=>{i!==null&&s.disappear(r,f)},[i]);let N=o||(c==="custom"||c==="default"?null:h[c]);return _("output",{role:"status",ref:m,className:`${d}__toast-content-container`,"data-testid":`container-${g||"default"}`,onMouseEnter:()=>{l&&s.pause(r)},onMouseLeave:()=>{l&&s.resume(r)},children:J(U,{condition:c!=="custom",children:[_(Y,{children:J("div",{className:p??`${d}__toast-content ${d}__toast-${c} ${s.isActive(r)?"":S}`,style:v,children:[N&&_("span",{className:`${d}__toast-icon`,children:N}),C,I&&_("button",{className:`${d}__close-button`,onClick:()=>{s.disappear(r,0)},type:"button",children:_(B,{})})]})}),_(X,{children:_("div",{className:p??`${s.isActive(r)?"":S}`,children:C})})]})})});import{useSyncExternalStore as ct}from"react";var K=()=>ct(w.subscribe.bind(w),w.getSnapShot.bind(w),w.getSnapShot.bind(w));import{jsx as D,jsxs as lt}from"react/jsx-runtime";function Ft({className:t,style:a,position:n="top-center",containerId:m="",gap:r=9,reverse:y=!1,pauseOnActivate:f=!0}){let g=K(),p=Q({}),v=Q({}),o=e=>{var u;return(u=e.target)==null?void 0:u.element},i=e=>m?e.containerId===m:!e.containerId,c=g.filter(e=>!o(e)).reduce((e,u)=>{let l=u.position||n;return u.position=l,e[l]=e[l]||[],e[l].push(u),e},{});return lt("div",{id:`${d}__root`,"data-container-id":m,children:[g.filter(o).filter(i).map(e=>D(L,{ref:u=>{let l=e.target;if(!l||!u){delete v.current[e.toastId];return}let I=v.current[e.toastId]||l.element.getBoundingClientRect();v.current[e.toastId]={y:I.y,x:I.x};let[S,C]=l.offset||[0,0];u.style.top=`${I.y+C+window.scrollY}px`,u.style.left=`${I.x+S+window.scrollX}px`},toastProps:e,pauseOnActivate:f},e.toastId)),Object.entries(c).map(([e,u])=>{let l=u.filter(i),I=y?l.reverse():l;return D("div",{"data-testid":e,className:`${d}__z9999 ${t??`${d}__toast-container ${d}__${e}`}`,style:a,children:I.map((S,C,M)=>D(L,{ref:x=>{if(!x){delete p.current[S.toastId];return}let N=p.current[S.toastId]||x.getBoundingClientRect().height;p.current[S.toastId]=N;let Z=/left/.test(e)?50:/center/.test(e)?0:-50,j=/bottom/.test(e)?0:1,tt=M.filter(($,O)=>O<=C-j).reduce(($,O)=>/bottom/.test(e)?$-=r+p.current[O.toastId]:$+=r+p.current[O.toastId],0);x.style.transition="transform 0.2s cubic-bezier(0.43, 0.14, 0.2, 1.05)",x.style.transform=`translate(${Z}%, ${tt}px)`},toastProps:S,pauseOnActivate:f},S.toastId))},e)})]})}export{Ft as ToastContainer,s as toast,w as toastStore,K as useToasts};
2
+ var F=()=>{let t=0;return()=>`react-strawberry-toast_${t++}`};var N=class{state=[];listeners=new Set;activatedToasts=new Set;toastTimers=new Map;constructor(){}subscribe(a){return this.listeners.add(a),()=>{this.listeners.delete(a)}}setState(a){this.state=typeof a=="function"?a(this.state):a,this.listeners.forEach(s=>s())}getSnapShot(){return this.state}};var c="react-strawberry-toast";import{jsx as m,jsxs as ct}from"react/jsx-runtime";function nt(){return ct("svg",{stroke:"none",fill:"none",strokeWidth:"2",viewBox:"0 0 24 24",strokeLinecap:"round",strokeLinejoin:"round",height:"22",width:"22",xmlns:"http://www.w3.org/2000/svg",children:[m("path",{stroke:"none",d:"M0 0h24v24H0z"}),m("path",{className:"react-strawberry-toast-path",d:"M17 3.34a10 10 0 1 1 -14.995 8.984l-.005 -.324l.005 -.324a10 10 0 0 1 14.995 -8.336zm-1.293 5.953a1 1 0 0 0 -1.32 -.083l-.094 .083l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.403 1.403l.083 .094l2 2l.094 .083a1 1 0 0 0 1.226 0l.094 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z",strokeWidth:"0",fill:"#1dca82"})]})}function G({fill:t}){return m("svg",{stroke:"none",fill:t,strokeWidth:"2",viewBox:"0 0 24 24",height:"22",width:"22",xmlns:"http://www.w3.org/2000/svg",children:m("path",{className:"react-strawberry-toast-path",d:"M11.953 2C6.465 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.493 2 11.953 2zM13 17h-2v-2h2v2zm0-4h-2V7h2v6z"})})}function it(){return m("svg",{stroke:"none",fill:"#fcba03",strokeWidth:"0",viewBox:"0 0 1024 1024",height:"22",width:"22",xmlns:"http://www.w3.org/2000/svg",children:m("path",{className:"react-strawberry-toast-path",d:"M955.7 856l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zM480 416c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v184c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V416zm32 352a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z"})})}function j(){return m("svg",{fill:"#8b8b8b",strokeWidth:"0",viewBox:"0 0 512 512",height:"15px",width:"15px",xmlns:"http://www.w3.org/2000/svg",children:m("path",{className:"react-strawberry-toast-path",d:"M400 145.49 366.51 112 256 222.51 145.49 112 112 145.49 222.51 256 112 366.51 145.49 400 256 289.49 366.51 400 400 366.51 289.49 256 400 145.49z"})})}var T={success:m(nt,{}),error:m(G,{fill:"#eb2639"}),loading:m("div",{className:`${c}__loading`}),warn:m(it,{}),info:m(G,{fill:"#5365e7"})};var q=t=>{let a=r=>{let e=t.toastTimers.get(r);clearTimeout(e),t.toastTimers.delete(r)},s=r=>{t.activatedToasts.add(r)},l=r=>t.activatedToasts.has(r),u=(r,e=200)=>{l(r)&&(t.activatedToasts.delete(r),setTimeout(()=>{t.state=t.state.filter(n=>n.toastId!==r),t.setState([...t.state])},e),a(r))},h=()=>{t.state.forEach(r=>{d(r.toastId,0)})},p=(r,e,n)=>{t.state=t.state.map(i=>i.toastId===r?{...i,...n,updated:new Date().getTime(),data:e}:i),t.setState([...t.state])},v=r=>{let e=new Date().getTime();t.state=t.state.map(n=>n.toastId===r?{...n,pausedAt:e}:n),a(r)},d=(r,e)=>{let n=setTimeout(()=>{var S;t.state=t.state.map(g=>g.toastId===r?{...g,isVisible:!1}:g),t.setState([...t.state]);let i=(S=t.state.find(g=>g.toastId===r))==null?void 0:S.removeTimeOut;u(r,i)},e>2147483647?2147483647:e);t.toastTimers.set(r,n)};return{setActive:s,isActive:l,disappear:d,resume:r=>{if(t.toastTimers.has(r))return;let e=t.state.find(i=>i.toastId===r);if(!e)return;let n=e.createdAt+(e.timeOut||3e3)-(e.pausedAt||0);d(r,n)},pause:v,replace:p,remove:u,allClear:h}};var y=new N,lt=F(),A=(t="default")=>(a,s={})=>{let{timeOut:l=3e3,removeTimeOut:u=200,pauseOnHover:h=!0,toastId:p,className:v,style:d,target:f,closeButton:r}=s,e=p||lt();if(o.isActive(e))throw new Error("A duplicate custom ID is not available.");let n=new Date().getTime(),i={updated:null,pausedAt:null,className:v||null,style:d||{},icon:s.icon||null,containerId:s.containerId||null,position:s.position||null,timeOut:l>2147483647?2147483647:l,toastId:e,data:a,createdAt:n,toastType:t,pauseOnHover:h,removeTimeOut:u,closeButton:r||!1,target:f||null,isVisible:!0};return y.state.push(i),y.setState([...y.state]),e},o=(t,a={})=>A()(t,a),w=q(y);o.setActive=w.setActive;o.isActive=w.isActive;o.disappear=w.disappear;o.resume=w.resume;o.pause=w.pause;o.replace=w.replace;o.remove=w.remove;o.allClear=w.allClear;o.success=A("success");o.error=A("error");o.warn=A("warn");o.info=A("info");o.loading=A("loading");o.custom=A("custom");o.promise=(t,a,s={})=>{let{loading:l,success:u,error:h}=a,p=o.loading(l,{...s,timeOut:2147483647}),v={toastId:p,close:()=>o.disappear(p,0),immediatelyClose:()=>{o.disappear(p,0),o.remove(p,0)},icons:{success:T.success,error:T.error,warn:T.warn,loading:T.loading,info:T.info},isVisible:!0},d=s.timeOut||=3e3;t.then(f=>{o.replace(p,typeof u=="function"?u(f,v):u,{...s,timeOut:d>2147483647?2147483647:d,toastType:"success"})}).catch(f=>{o.replace(p,typeof h=="function"?h(f,v):h,{...s,timeOut:d>2147483647?2147483647:d,toastType:"error"})})};import{useEffect as W,useRef as ut}from"react";import{Children as pt}from"react";function J({condition:t,children:a}){let s=pt.toArray(a);if(s.length>2)throw new Error("The number of children exceeds two.");return s.find(l=>t?l.key===".0":l.key===".1")}function K({children:t}){return t}function Q({children:t}){return t}var Z=({isVisible:t,position:a})=>a?t?/top/i.test(a)?`${c}__fade-in`:`${c}__fade-in-reverse`:/bottom/i.test(a)?`${c}__fade-out-reverse`:`${c}__fade-out`:t?`${c}__fade-in`:`${c}__fade-out`;import{useEffect as tt,useRef as dt}from"react";var $=(t,a)=>{let s=dt(a);tt(()=>{s.current=a},[a]),tt(()=>(window.addEventListener(t,s.current),()=>{window.removeEventListener(t,s.current)}),[t])};import{jsx as E,jsxs as et}from"react/jsx-runtime";var _=new Map;function z({toastProps:t}){let a=ut(null),{toastId:s,isVisible:l,timeOut:u,containerId:h,className:p,style:v,icon:d,pauseOnActivate:f,updated:r,toastType:e,position:n,data:i,pauseOnHover:S,closeButton:g,samePositionLists:k,gap:I,order:P,target:O}=t,V=Z({isVisible:l,position:n}),U=typeof i=="function"?i({toastId:s,close:()=>o.disappear(s,0),immediatelyClose:()=>{o.disappear(s,0),o.remove(s,0)},icons:{success:T.success,error:T.error,warn:T.warn,loading:T.loading,info:T.info},isVisible:l}):i,ot=()=>{f&&o.resume(s)},at=()=>{f&&o.pause(s)},Y=()=>{O&&requestAnimationFrame(()=>{if(a.current){let x=O.element.getBoundingClientRect(),[R,L]=O.offset||[0,0];a.current.style.top=`${x.y+L+window.scrollY}px`,a.current.style.left=`${x.x+R+window.scrollX}px`}})};$("focus",ot),$("blur",at),$("resize",Y),W(()=>{o.isActive(s)||(o.setActive(s),o.disappear(s,u)),Y()},[s]),W(()=>{if(a.current&&!O){let x=_.get(s)||a.current.getBoundingClientRect().height;_.set(s,x);let R=/left/.test(n)?50:/center/.test(n)?0:-50,L=/bottom/.test(n)?0:1,rt=k.filter((H,C)=>C<=P-L).reduce((H,C)=>/bottom/.test(n)?H-=I+(_.get(C.toastId)||0):H+=I+(_.get(C.toastId)||0),0);a.current.style.transition="transform 0.2s cubic-bezier(0.43, 0.14, 0.2, 1.05)",a.current.style.transform=`translate(${R}%, ${rt}px)`}return()=>{_.delete(s)}},[P]),W(()=>{r!==null&&o.disappear(s,u)},[r]);let X=d||(e==="custom"||e==="default"?null:T[e]);return E("output",{role:"status",ref:a,className:`${c}__toast-content-container`,"data-testid":`container-${h||"default"}`,onMouseEnter:()=>{S&&o.pause(s)},onMouseLeave:()=>{S&&o.resume(s)},children:et(J,{condition:e!=="custom",children:[E(K,{children:et("div",{className:p??`${c}__toast-content ${c}__toast-${e} ${o.isActive(s)?"":V}`,style:v,children:[X&&E("span",{className:`${c}__toast-icon`,children:X}),U,g&&E("button",{"data-testid":`${s}__close-button`,className:`${c}__close-button`,onClick:()=>{o.disappear(s,0)},type:"button",children:E(j,{})})]})}),E(Q,{children:E("div",{className:p??`${o.isActive(s)?"":V}`,children:U})})]})})}import{useSyncExternalStore as mt}from"react";var st=()=>mt(y.subscribe.bind(y),y.getSnapShot.bind(y),y.getSnapShot.bind(y));import{jsx as B,jsxs as Tt}from"react/jsx-runtime";function Jt({className:t,style:a,position:s="top-center",containerId:l="",gap:u=9,reverse:h=!1,pauseOnActivate:p=!0}){let v=st(),d=e=>{var n;return(n=e.target)==null?void 0:n.element},f=e=>l?e.containerId===l:!e.containerId,r=v.filter(e=>!d(e)).reduce((e,n)=>{let i=n.position||s;return n.position=i,e[i]=e[i]||[],e[i].push(n),e},{});return Tt("div",{id:`${c}__root`,"data-container-id":l,children:[v.filter(d).filter(f).map((e,n,i)=>{let S=Object.assign(e,{gap:u,order:n,samePositionLists:i,pauseOnActivate:p});return B(z,{toastProps:S},e.toastId)}),Object.entries(r).map(([e,n])=>{let i=n.filter(f),S=h?i.reverse():i;return B("div",{"data-testid":e,className:`${c}__z9999 ${t??`${c}__toast-container ${c}__${e}`}`,style:a,children:S.map((g,k,I)=>{let P=Object.assign(g,{gap:u,order:k,samePositionLists:I,pauseOnActivate:p});return B(z,{toastProps:P},g.toastId)})},e)})]})}export{Jt as ToastContainer,o as toast,y as toastStore,st as useToasts};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-strawberry-toast",
3
3
  "description": "A simple and customizable React toast library",
4
- "version": "2.0.0",
4
+ "version": "2.1.0-alpha.2",
5
5
  "author": "dkpark10",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -14,11 +14,13 @@
14
14
  ],
15
15
  "repository": {
16
16
  "type": "git",
17
- "url": "https://github.com/dkpark10/react-strawberry-toast.git"
17
+ "url": "https://github.com/dkpark10/react-strawberry-toast.git",
18
+ "directory": "packages/react-strawberry-toast"
18
19
  },
19
20
  "bugs": {
20
21
  "url": "https://github.com/dkpark10/react-strawberry-toast/issues"
21
22
  },
23
+ "homepage": "https://dkpark10.github.io/react-strawberry-toast/",
22
24
  "main": "./dist/index.js",
23
25
  "types": "./dist/index.d.ts",
24
26
  "exports": {
@@ -50,19 +52,14 @@
50
52
  "dist"
51
53
  ],
52
54
  "scripts": {
53
- "dev": "pnpm run --filter=react-strawberry-toast-playground dev",
54
- "dev:docs": "pnpm run --filter=react-strawberry-toast-docs dev",
55
- "deploy:docs": "pnpm run --filter=react-strawberry-toast-docs deploy",
56
55
  "build": "tsup",
57
56
  "test": "vitest",
58
57
  "test:e2e": "npx playwright test",
59
58
  "test:e2e:ui": "npx playwright test --ui",
60
- "prepare": "husky install",
61
- "deploy": "pnpm run test --run && pnpm run test:e2e && pnpm run build && npm publish --access=public"
59
+ "prepare": "cp ../../README.md ./README.md",
60
+ "deploy": "pnpm run prepare && pnpm run test --run && pnpm run test:e2e && pnpm run build && npm publish --access=public"
62
61
  },
63
62
  "devDependencies": {
64
- "@commitlint/cli": "^19.6.1",
65
- "@commitlint/config-conventional": "^19.6.0",
66
63
  "@playwright/test": "^1.50.1",
67
64
  "@testing-library/jest-dom": "^6.6.3",
68
65
  "@testing-library/react": "^15.0.7",
@@ -71,7 +68,6 @@
71
68
  "@types/react-dom": "^18",
72
69
  "concurrently": "^9.1.0",
73
70
  "esbuild-sass-plugin": "^3.3.1",
74
- "husky": "^8",
75
71
  "jsdom": "^24.0.0",
76
72
  "playwright": "^1.50.1",
77
73
  "react": "^18",