react-strawberry-toast 1.6.0 → 1.6.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/README.md +1 -0
- package/dist/headless.d.mts +2 -1
- package/dist/headless.d.ts +2 -1
- package/dist/headless.js +1 -1
- package/dist/headless.mjs +1 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/style.css +1 -1
- package/dist/style2.css +1 -0
- package/dist/style3.css +1 -0
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -70,6 +70,7 @@ function App() {
|
|
|
70
70
|
| className | Class of toast | String | |
|
|
71
71
|
| style | Style of toast | Object | |
|
|
72
72
|
| target | Target element where toast will be located | Object | |
|
|
73
|
+
| closeButton | Option to show or hide the close button | Boolean | false |
|
|
73
74
|
|
|
74
75
|
|
|
75
76
|
## License
|
package/dist/headless.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
type Position = 'bottom-left' | 'bottom-center' | 'bottom-right' | 'top-left' | 'top-center' | 'top-right';
|
|
4
|
-
type ToastType = 'default' | 'custom' | 'success' | 'error' | 'loading' | 'warn';
|
|
4
|
+
type ToastType = 'default' | 'custom' | 'success' | 'error' | 'loading' | 'warn' | 'info';
|
|
5
5
|
interface BaseOptions {
|
|
6
6
|
toastId?: string;
|
|
7
7
|
timeOut?: number;
|
|
@@ -22,6 +22,7 @@ interface Options extends BaseOptions {
|
|
|
22
22
|
position?: Position | null;
|
|
23
23
|
containerId?: string | null;
|
|
24
24
|
pauseOnHover?: boolean;
|
|
25
|
+
closeButton?: boolean;
|
|
25
26
|
target?: {
|
|
26
27
|
element: HTMLElement;
|
|
27
28
|
offset?: [number, number];
|
package/dist/headless.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
type Position = 'bottom-left' | 'bottom-center' | 'bottom-right' | 'top-left' | 'top-center' | 'top-right';
|
|
4
|
-
type ToastType = 'default' | 'custom' | 'success' | 'error' | 'loading' | 'warn';
|
|
4
|
+
type ToastType = 'default' | 'custom' | 'success' | 'error' | 'loading' | 'warn' | 'info';
|
|
5
5
|
interface BaseOptions {
|
|
6
6
|
toastId?: string;
|
|
7
7
|
timeOut?: number;
|
|
@@ -22,6 +22,7 @@ interface Options extends BaseOptions {
|
|
|
22
22
|
position?: Position | null;
|
|
23
23
|
containerId?: string | null;
|
|
24
24
|
pauseOnHover?: boolean;
|
|
25
|
+
closeButton?: boolean;
|
|
25
26
|
target?: {
|
|
26
27
|
element: HTMLElement;
|
|
27
28
|
offset?: [number, number];
|
package/dist/headless.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var v=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var g=(t,s)=>{for(var r in s)v(t,r,{get:s[r],enumerable:!0})},U=(t,s,r,m)=>{if(s&&typeof s=="object"||typeof s=="function")for(let T of _(s))!w.call(t,T)&&T!==r&&v(t,T,{get:()=>s[T],enumerable:!(m=x(s,T))||m.enumerable});return t};var D=t=>U(v({},"__esModule",{value:!0}),t);var L={};g(L,{toast:()=>n,useToasts:()=>H});module.exports=D(L);var b=require("react");var M=()=>{let t=0;return()=>`react-strawberry-toast_${t++}`};var f=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(r=>r())}getSnapShot(){return this.state}};var h=t=>{let s=e=>{let a=t.toastTimers.get(e);clearTimeout(a),t.toastTimers.delete(e)},r=e=>{t.activatedToasts.add(e)},m=e=>t.activatedToasts.has(e),T=(e,a=200)=>{m(e)&&(t.activatedToasts.delete(e),setTimeout(()=>{t.state=t.state.filter(o=>o.toastId!==e),t.setState([...t.state])},a),s(e))},d=()=>{t.state.forEach(e=>{I(e.toastId,0)})},A=(e,a,o)=>{t.state=t.state.map(c=>c.toastId===e?{...c,...o,updated:new Date().getTime(),data:a}:c),t.setState([...t.state])},S=e=>{let a=new Date().getTime();t.state=t.state.map(o=>o.toastId===e?{...o,pausedAt:a}:o),s(e)},I=(e,a)=>{let o=setTimeout(()=>{var y;t.state=t.state.map(u=>u.toastId===e?{...u,isVisible:!1}:u),t.setState([...t.state]);let c=(y=t.state.find(u=>u.toastId===e))==null?void 0:y.removeTimeOut;T(e,c)},a>2147483647?2147483647:a);t.toastTimers.set(e,o)};return{setActive:r,isActive:m,disappear:I,resume:e=>{if(t.toastTimers.has(e))return;let a=t.state.find(c=>c.toastId===e);if(!a)return;let o=a.createdAt+(a.timeOut||3e3)-(a.pausedAt||0);I(e,o)},pause:S,replace:A,remove:T,allClear:d}};var i=new f,P=M(),R=()=>(t,s={})=>{let{timeOut:r=3e3,removeTimeOut:m=200,toastId:T}=s,d=T||P();if(n.isActive(d))throw new Error("A duplicate custom ID is not available.");let A=new Date().getTime(),S={timeOut:r>2147483647?2147483647:r,toastId:d,data:t,pausedAt:null,updated:null,createdAt:A,removeTimeOut:m,isVisible:!0};return i.state.push(S),i.setState([...i.state]),d},n=(t,s={})=>R()(t,s),p=h(i);n.setActive=p.setActive;n.isActive=p.isActive;n.disappear=p.disappear;n.resume=p.resume;n.pause=p.pause;n.replace=p.replace;n.remove=p.remove;n.allClear=p.allClear;var H=()=>(0,b.useSyncExternalStore)(i.subscribe.bind(i),i.getSnapShot.bind(i),i.getSnapShot.bind(i));
|
package/dist/headless.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useSyncExternalStore as x}from"react";var y=()=>{let t=0;return()=>`react-strawberry-toast_${t++}`};var f=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(p=>p())}getSnapShot(){return this.state}};var M=t=>{let a=e=>{let s=t.toastTimers.get(e);clearTimeout(s),t.toastTimers.delete(e)},p=e=>{t.activatedToasts.add(e)},u=e=>t.activatedToasts.has(e),l=(e,s=200)=>{u(e)&&(t.activatedToasts.delete(e),setTimeout(()=>{t.state=t.state.filter(r=>r.toastId!==e),t.setState([...t.state])},s),a(e))},m=()=>{t.
|
|
1
|
+
import{useSyncExternalStore as x}from"react";var y=()=>{let t=0;return()=>`react-strawberry-toast_${t++}`};var f=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(p=>p())}getSnapShot(){return this.state}};var M=t=>{let a=e=>{let s=t.toastTimers.get(e);clearTimeout(s),t.toastTimers.delete(e)},p=e=>{t.activatedToasts.add(e)},u=e=>t.activatedToasts.has(e),l=(e,s=200)=>{u(e)&&(t.activatedToasts.delete(e),setTimeout(()=>{t.state=t.state.filter(r=>r.toastId!==e),t.setState([...t.state])},s),a(e))},m=()=>{t.state.forEach(e=>{I(e.toastId,0)})},A=(e,s,r)=>{t.state=t.state.map(T=>T.toastId===e?{...T,...r,updated:new Date().getTime(),data:s}:T),t.setState([...t.state])},S=e=>{let s=new Date().getTime();t.state=t.state.map(r=>r.toastId===e?{...r,pausedAt:s}:r),a(e)},I=(e,s)=>{let r=setTimeout(()=>{var O;t.state=t.state.map(c=>c.toastId===e?{...c,isVisible:!1}:c),t.setState([...t.state]);let T=(O=t.state.find(c=>c.toastId===e))==null?void 0:O.removeTimeOut;l(e,T)},s>2147483647?2147483647:s);t.toastTimers.set(e,r)};return{setActive:p,isActive:u,disappear:I,resume:e=>{if(t.toastTimers.has(e))return;let s=t.state.find(T=>T.toastId===e);if(!s)return;let r=s.createdAt+(s.timeOut||3e3)-(s.pausedAt||0);I(e,r)},pause:S,replace:A,remove:l,allClear:m}};var o=new f,h=y(),b=()=>(t,a={})=>{let{timeOut:p=3e3,removeTimeOut:u=200,toastId:l}=a,m=l||h();if(i.isActive(m))throw new Error("A duplicate custom ID is not available.");let A=new Date().getTime(),S={timeOut:p>2147483647?2147483647:p,toastId:m,data:t,pausedAt:null,updated:null,createdAt:A,removeTimeOut:u,isVisible:!0};return o.state.push(S),o.setState([...o.state]),m},i=(t,a={})=>b()(t,a),n=M(o);i.setActive=n.setActive;i.isActive=n.isActive;i.disappear=n.disappear;i.resume=n.resume;i.pause=n.pause;i.replace=n.replace;i.remove=n.remove;i.allClear=n.allClear;var X=()=>x(o.subscribe.bind(o),o.getSnapShot.bind(o),o.getSnapShot.bind(o));export{i as toast,X as useToasts};
|
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import React$1, { ReactNode } from 'react';
|
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
4
|
type Position = 'bottom-left' | 'bottom-center' | 'bottom-right' | 'top-left' | 'top-center' | 'top-right';
|
|
5
|
-
type ToastType = 'default' | 'custom' | 'success' | 'error' | 'loading' | 'warn';
|
|
5
|
+
type ToastType = 'default' | 'custom' | 'success' | 'error' | 'loading' | 'warn' | 'info';
|
|
6
6
|
interface BaseOptions {
|
|
7
7
|
toastId?: string;
|
|
8
8
|
timeOut?: number;
|
|
@@ -23,6 +23,7 @@ interface Options extends BaseOptions {
|
|
|
23
23
|
position?: Position | null;
|
|
24
24
|
containerId?: string | null;
|
|
25
25
|
pauseOnHover?: boolean;
|
|
26
|
+
closeButton?: boolean;
|
|
26
27
|
target?: {
|
|
27
28
|
element: HTMLElement;
|
|
28
29
|
offset?: [number, number];
|
|
@@ -74,6 +75,7 @@ declare const toast: {
|
|
|
74
75
|
success: (data: ReactNode, options?: Options) => ToastState["toastId"];
|
|
75
76
|
error: (data: ReactNode, options?: Options) => ToastState["toastId"];
|
|
76
77
|
warn: (data: ReactNode, options?: Options) => ToastState["toastId"];
|
|
78
|
+
info: (data: ReactNode, options?: Options) => ToastState["toastId"];
|
|
77
79
|
loading: (data: ReactNode, options?: Options) => ToastState["toastId"];
|
|
78
80
|
custom: (data: ReactNode | ToastDataWithCallback, options?: Options) => ToastState["toastId"];
|
|
79
81
|
promise<T>(promise: Promise<T>, promiseOption: {
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import React$1, { ReactNode } from 'react';
|
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
4
|
type Position = 'bottom-left' | 'bottom-center' | 'bottom-right' | 'top-left' | 'top-center' | 'top-right';
|
|
5
|
-
type ToastType = 'default' | 'custom' | 'success' | 'error' | 'loading' | 'warn';
|
|
5
|
+
type ToastType = 'default' | 'custom' | 'success' | 'error' | 'loading' | 'warn' | 'info';
|
|
6
6
|
interface BaseOptions {
|
|
7
7
|
toastId?: string;
|
|
8
8
|
timeOut?: number;
|
|
@@ -23,6 +23,7 @@ interface Options extends BaseOptions {
|
|
|
23
23
|
position?: Position | null;
|
|
24
24
|
containerId?: string | null;
|
|
25
25
|
pauseOnHover?: boolean;
|
|
26
|
+
closeButton?: boolean;
|
|
26
27
|
target?: {
|
|
27
28
|
element: HTMLElement;
|
|
28
29
|
offset?: [number, number];
|
|
@@ -74,6 +75,7 @@ declare const toast: {
|
|
|
74
75
|
success: (data: ReactNode, options?: Options) => ToastState["toastId"];
|
|
75
76
|
error: (data: ReactNode, options?: Options) => ToastState["toastId"];
|
|
76
77
|
warn: (data: ReactNode, options?: Options) => ToastState["toastId"];
|
|
78
|
+
info: (data: ReactNode, options?: Options) => ToastState["toastId"];
|
|
77
79
|
loading: (data: ReactNode, options?: Options) => ToastState["toastId"];
|
|
78
80
|
custom: (data: ReactNode | ToastDataWithCallback, options?: Options) => ToastState["toastId"];
|
|
79
81
|
promise<T>(promise: Promise<T>, promiseOption: {
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var
|
|
2
|
+
"use strict";var D=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var rt=Object.getOwnPropertyNames;var nt=Object.prototype.hasOwnProperty;var it=(t,e)=>{for(var n in e)D(t,n,{get:e[n],enumerable:!0})},ct=(t,e,n,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of rt(e))!nt.call(t,a)&&a!==n&&D(t,a,{get:()=>e[a],enumerable:!(p=at(e,a))||p.enumerable});return t};var lt=t=>ct(D({},"__esModule",{value:!0}),t);var ft={};it(ft,{ToastContainer:()=>mt,toast:()=>s,toastStore:()=>b,useToasts:()=>V});module.exports=lt(ft);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 m=require("react/jsx-runtime");function dt(){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 X({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 pt(){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 G(){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 g={success:(0,m.jsx)(dt,{}),error:(0,m.jsx)(X,{fill:"#eb2639"}),loading:(0,m.jsx)("div",{className:`${d}__loading`}),warn:(0,m.jsx)(pt,{}),info:(0,m.jsx)(X,{fill:"#5365e7"})};var F=t=>{let e=o=>{let i=t.toastTimers.get(o);clearTimeout(i),t.toastTimers.delete(o)},n=o=>{t.activatedToasts.add(o)},p=o=>t.activatedToasts.has(o),a=(o,i=200)=>{p(o)&&(t.activatedToasts.delete(o),setTimeout(()=>{t.state=t.state.filter(c=>c.toastId!==o),t.setState([...t.state])},i),e(o))},h=()=>{t.state.forEach(o=>{u(o.toastId,0)})},f=(o,i,c)=>{t.state=t.state.map(v=>v.toastId===o?{...v,...c,updated:new Date().getTime(),data:i}:v),t.setState([...t.state])},w=o=>{let i=new Date().getTime();t.state=t.state.map(c=>c.toastId===o?{...c,pausedAt:i}:c),e(o)},u=(o,i)=>{let c=setTimeout(()=>{var r;t.state=t.state.map(l=>l.toastId===o?{...l,isVisible:!1}:l),t.setState([...t.state]);let v=(r=t.state.find(l=>l.toastId===o))==null?void 0:r.removeTimeOut;a(o,v)},i>2147483647?2147483647:i);t.toastTimers.set(o,c)};return{setActive:n,isActive:p,disappear:u,resume:o=>{if(t.toastTimers.has(o))return;let i=t.state.find(v=>v.toastId===o);if(!i)return;let c=i.createdAt+(i.timeOut||3e3)-(i.pausedAt||0);u(o,c)},pause:w,replace:f,remove:a,allClear:h}};var b=new $,ut=Y(),x=(t="default")=>(e,n={})=>{let{timeOut:p=3e3,removeTimeOut:a=200,pauseOnHover:h=!0,toastId:f,className:w,style:u,target:T,closeButton:o}=n,i=f||ut();if(s.isActive(i))throw new Error("A duplicate custom ID is not available.");let c=new Date().getTime(),v={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:h,removeTimeOut:a,closeButton:o||!1,target:T||null,isVisible:!0};return b.state.push(v),b.setState([...b.state]),i},s=(t,e={})=>x()(t,e),_=F(b);s.setActive=_.setActive;s.isActive=_.isActive;s.disappear=_.disappear;s.resume=_.resume;s.pause=_.pause;s.replace=_.replace;s.remove=_.remove;s.allClear=_.allClear;s.success=x("success");s.error=x("error");s.warn=x("warn");s.info=x("info");s.loading=x("loading");s.custom=x("custom");s.promise=(t,e,n={})=>{let{loading:p,success:a,error:h}=e,f=s.loading(p,{...n,timeOut:2147483647}),w={toastId:f,close:()=>s.disappear(f,0),immediatelyClose:()=>{s.disappear(f,0),s.remove(f,0)},icons:{success:g.success,error:g.error,warn:g.warn,loading:g.loading,info:g.info},isVisible:!0},u=n.timeOut||=3e3;t.then(T=>{s.replace(f,typeof a=="function"?a(T,w):a,{...n,timeOut:u>2147483647?2147483647:u,toastType:"success"})}).catch(T=>{s.replace(f,typeof h=="function"?h(T,w):h,{...n,timeOut:u>2147483647?2147483647:u,toastType:"error"})})};var U=require("react");var R=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 P=require("react"),z=(t,e)=>{let n=(0,P.useRef)(e);(0,P.useEffect)(()=>{n.current=e},[e]),(0,P.useEffect)(()=>(window.addEventListener(t,n.current),()=>{window.removeEventListener(t,n.current)}),[t])};var S=require("react/jsx-runtime"),B=(0,R.forwardRef)(function({toastProps:e,pauseOnActivate:n},p){let{toastId:a,isVisible:h,timeOut:f,containerId:w,className:u,style:T,icon:o,updated:i,toastType:c,position:v,data:r,pauseOnHover:l,closeButton:y}=e,A=Z({isVisible:h,position:v}),I=typeof r=="function"?r({toastId:a,close:()=>s.disappear(a,0),immediatelyClose:()=>{s.disappear(a,0),s.remove(a,0)},icons:{success:g.success,error:g.error,warn:g.warn,loading:g.loading,info:g.info},isVisible:h}):r,O=()=>{n&&s.resume(a)},H=()=>{n&&s.pause(a)};z("focus",O),z("blur",H),(0,R.useEffect)(()=>{s.isActive(a)||(s.setActive(a),s.disappear(a,f))},[a]),(0,R.useEffect)(()=>{i!==null&&s.disappear(a,f)},[i]);let C=o||(c==="custom"||c==="default"?null:g[c]);return(0,S.jsx)("div",{role:"alert",ref:p,className:`${d}__toast-content-container`,"data-testid":`container-${w||"default"}`,onMouseEnter:()=>{l&&s.pause(a)},onMouseLeave:()=>{l&&s.resume(a)},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} ${s.isActive(a)?"":A}`,style:T,children:[C&&(0,S.jsx)("span",{className:`${d}__toast-icon`,children:C}),I,y&&(0,S.jsx)("button",{className:`${d}__close-button`,onClick:()=>{s.disappear(a,0)},type:"button",children:(0,S.jsx)(G,{})})]})}),(0,S.jsx)(Q,{children:(0,S.jsx)("div",{className:u??`${s.isActive(a)?"":A}`,children:I})})]})})});var j=require("react");var V=()=>(0,j.useSyncExternalStore)(b.subscribe.bind(b),b.getSnapShot.bind(b),b.getSnapShot.bind(b));var N=require("react/jsx-runtime");function mt({className:t,style:e,limit:n,position:p="top-center",containerId:a="",gap:h=9,reverse:f=!1,pauseOnActivate:w=!0}){let u=V(),T=(0,U.useRef)({}),o=(0,U.useRef)({}),i=r=>{var l;return(l=r.target)==null?void 0:l.element},c=r=>a?r.containerId===a:!r.containerId,v=u.filter(r=>!i(r)).reduce((r,l)=>{let y=l.position||p;return l.position=y,r[y]=r[y]||[],r[y].push(l),r},{});return(0,N.jsxs)("div",{id:`${d}__root`,"data-container-id":a,children:[u.filter(i).filter(c).map(r=>(0,N.jsx)(B,{ref:l=>{let y=r.target;if(!y||!l){delete o.current[r.toastId];return}let A=o.current[r.toastId]||y.element.getBoundingClientRect();o.current[r.toastId]={y:A.y,x:A.x};let[I,O]=y.offset||[0,0];l.style.top=`${A.y+O+window.scrollY}px`,l.style.left=`${A.x+I+window.scrollX}px`},toastProps:r,pauseOnActivate:w},r.toastId)),Object.entries(v).map(([r,l])=>{let y=l.filter(c).slice(0,n),A=f?y.reverse():y;return(0,N.jsx)("div",{"data-testid":r,className:`${d}__z9999 ${t??`${d}__toast-container ${d}__${r}`}`,style:e,children:A.map((I,O,H)=>(0,N.jsx)(B,{ref:C=>{if(!C){delete T.current[I.toastId];return}let tt=T.current[I.toastId]||C.getBoundingClientRect().height;T.current[I.toastId]=tt;let et=/left/.test(r)?50:/center/.test(r)?0:-50,st=/bottom/.test(r)?0:1,ot=H.filter((L,M)=>M<=O-st).reduce((L,M)=>/bottom/.test(r)?L-=h+T.current[M.toastId]:L+=h+T.current[M.toastId],0);C.style.transition="transform 0.2s cubic-bezier(0.43, 0.14, 0.2, 1.05)",C.style.transform=`translate(${et}%, ${ot}px)`},toastProps:I,pauseOnActivate:w},I.toastId))},r)})]})}
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var
|
|
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 y,jsxs as at}from"react/jsx-runtime";function st(){return at("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:[y("path",{stroke:"none",d:"M0 0h24v24H0z"}),y("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 y("svg",{stroke:"none",fill:t,strokeWidth:"2",viewBox:"0 0 24 24",height:"22",width:"22",xmlns:"http://www.w3.org/2000/svg",children:y("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 ot(){return y("svg",{stroke:"none",fill:"#fcba03",strokeWidth:"0",viewBox:"0 0 1024 1024",height:"22",width:"22",xmlns:"http://www.w3.org/2000/svg",children:y("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 y("svg",{fill:"#8b8b8b",strokeWidth:"0",viewBox:"0 0 512 512",height:"15px",width:"15px",xmlns:"http://www.w3.org/2000/svg",children:y("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 g={success:y(st,{}),error:y(z,{fill:"#eb2639"}),loading:y("div",{className:`${d}__loading`}),warn:y(ot,{}),info:y(z,{fill:"#5365e7"})};var V=t=>{let a=s=>{let i=t.toastTimers.get(s);clearTimeout(i),t.toastTimers.delete(s)},n=s=>{t.activatedToasts.add(s)},m=s=>t.activatedToasts.has(s),r=(s,i=200)=>{m(s)&&(t.activatedToasts.delete(s),setTimeout(()=>{t.state=t.state.filter(c=>c.toastId!==s),t.setState([...t.state])},i),a(s))},T=()=>{t.state.forEach(s=>{p(s.toastId,0)})},u=(s,i,c)=>{t.state=t.state.map(h=>h.toastId===s?{...h,...c,updated:new Date().getTime(),data:i}:h),t.setState([...t.state])},b=s=>{let i=new Date().getTime();t.state=t.state.map(c=>c.toastId===s?{...c,pausedAt:i}:c),a(s)},p=(s,i)=>{let c=setTimeout(()=>{var o;t.state=t.state.map(l=>l.toastId===s?{...l,isVisible:!1}:l),t.setState([...t.state]);let h=(o=t.state.find(l=>l.toastId===s))==null?void 0:o.removeTimeOut;r(s,h)},i>2147483647?2147483647:i);t.toastTimers.set(s,c)};return{setActive:n,isActive:m,disappear:p,resume:s=>{if(t.toastTimers.has(s))return;let i=t.state.find(h=>h.toastId===s);if(!i)return;let c=i.createdAt+(i.timeOut||3e3)-(i.pausedAt||0);p(s,c)},pause:b,replace:u,remove:r,allClear:T}};var w=new P,rt=W(),C=(t="default")=>(a,n={})=>{let{timeOut:m=3e3,removeTimeOut:r=200,pauseOnHover:T=!0,toastId:u,className:b,style:p,target:f,closeButton:s}=n,i=u||rt();if(e.isActive(i))throw new Error("A duplicate custom ID is not available.");let c=new Date().getTime(),h={updated:null,pausedAt:null,className:b||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:T,removeTimeOut:r,closeButton:s||!1,target:f||null,isVisible:!0};return w.state.push(h),w.setState([...w.state]),i},e=(t,a={})=>C()(t,a),A=V(w);e.setActive=A.setActive;e.isActive=A.isActive;e.disappear=A.disappear;e.resume=A.resume;e.pause=A.pause;e.replace=A.replace;e.remove=A.remove;e.allClear=A.allClear;e.success=C("success");e.error=C("error");e.warn=C("warn");e.info=C("info");e.loading=C("loading");e.custom=C("custom");e.promise=(t,a,n={})=>{let{loading:m,success:r,error:T}=a,u=e.loading(m,{...n,timeOut:2147483647}),b={toastId:u,close:()=>e.disappear(u,0),immediatelyClose:()=>{e.disappear(u,0),e.remove(u,0)},icons:{success:g.success,error:g.error,warn:g.warn,loading:g.loading,info:g.info},isVisible:!0},p=n.timeOut||=3e3;t.then(f=>{e.replace(u,typeof r=="function"?r(f,b):r,{...n,timeOut:p>2147483647?2147483647:p,toastType:"success"})}).catch(f=>{e.replace(u,typeof T=="function"?T(f,b):T,{...n,timeOut:p>2147483647?2147483647:p,toastType:"error"})})};import{useRef as Q}from"react";import{useEffect as q,forwardRef as ct}from"react";import{Children as nt}from"react";function U({condition:t,children:a}){let n=nt.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 it}from"react";var H=(t,a)=>{let n=it(a);F(()=>{n.current=a},[a]),F(()=>(window.addEventListener(t,n.current),()=>{window.removeEventListener(t,n.current)}),[t])};import{jsx as x,jsxs as J}from"react/jsx-runtime";var L=ct(function({toastProps:a,pauseOnActivate:n},m){let{toastId:r,isVisible:T,timeOut:u,containerId:b,className:p,style:f,icon:s,updated:i,toastType:c,position:h,data:o,pauseOnHover:l,closeButton:v}=a,E=G({isVisible:T,position:h}),S=typeof o=="function"?o({toastId:r,close:()=>e.disappear(r,0),immediatelyClose:()=>{e.disappear(r,0),e.remove(r,0)},icons:{success:g.success,error:g.error,warn:g.warn,loading:g.loading,info:g.info},isVisible:T}):o,N=()=>{n&&e.resume(r)},M=()=>{n&&e.pause(r)};H("focus",N),H("blur",M),q(()=>{e.isActive(r)||(e.setActive(r),e.disappear(r,u))},[r]),q(()=>{i!==null&&e.disappear(r,u)},[i]);let _=s||(c==="custom"||c==="default"?null:g[c]);return x("div",{role:"alert",ref:m,className:`${d}__toast-content-container`,"data-testid":`container-${b||"default"}`,onMouseEnter:()=>{l&&e.pause(r)},onMouseLeave:()=>{l&&e.resume(r)},children:J(U,{condition:c!=="custom",children:[x(Y,{children:J("div",{className:p??`${d}__toast-content ${d}__toast-${c} ${e.isActive(r)?"":E}`,style:f,children:[_&&x("span",{className:`${d}__toast-icon`,children:_}),S,v&&x("button",{className:`${d}__close-button`,onClick:()=>{e.disappear(r,0)},type:"button",children:x(B,{})})]})}),x(X,{children:x("div",{className:p??`${e.isActive(r)?"":E}`,children:S})})]})})});import{useSyncExternalStore as lt}from"react";var K=()=>lt(w.subscribe.bind(w),w.getSnapShot.bind(w),w.getSnapShot.bind(w));import{jsx as D,jsxs as dt}from"react/jsx-runtime";function qt({className:t,style:a,limit:n,position:m="top-center",containerId:r="",gap:T=9,reverse:u=!1,pauseOnActivate:b=!0}){let p=K(),f=Q({}),s=Q({}),i=o=>{var l;return(l=o.target)==null?void 0:l.element},c=o=>r?o.containerId===r:!o.containerId,h=p.filter(o=>!i(o)).reduce((o,l)=>{let v=l.position||m;return l.position=v,o[v]=o[v]||[],o[v].push(l),o},{});return dt("div",{id:`${d}__root`,"data-container-id":r,children:[p.filter(i).filter(c).map(o=>D(L,{ref:l=>{let v=o.target;if(!v||!l){delete s.current[o.toastId];return}let E=s.current[o.toastId]||v.element.getBoundingClientRect();s.current[o.toastId]={y:E.y,x:E.x};let[S,N]=v.offset||[0,0];l.style.top=`${E.y+N+window.scrollY}px`,l.style.left=`${E.x+S+window.scrollX}px`},toastProps:o,pauseOnActivate:b},o.toastId)),Object.entries(h).map(([o,l])=>{let v=l.filter(c).slice(0,n),E=u?v.reverse():v;return D("div",{"data-testid":o,className:`${d}__z9999 ${t??`${d}__toast-container ${d}__${o}`}`,style:a,children:E.map((S,N,M)=>D(L,{ref:_=>{if(!_){delete f.current[S.toastId];return}let Z=f.current[S.toastId]||_.getBoundingClientRect().height;f.current[S.toastId]=Z;let j=/left/.test(o)?50:/center/.test(o)?0:-50,tt=/bottom/.test(o)?0:1,et=M.filter(($,O)=>O<=N-tt).reduce(($,O)=>/bottom/.test(o)?$-=T+f.current[O.toastId]:$+=T+f.current[O.toastId],0);_.style.transition="transform 0.2s cubic-bezier(0.43, 0.14, 0.2, 1.05)",_.style.transform=`translate(${j}%, ${et}px)`},toastProps:S,pauseOnActivate:b},S.toastId))},o)})]})}export{qt as ToastContainer,e as toast,w as toastStore,K as useToasts};
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@keyframes l3{to{transform:rotate(1turn)}}@keyframes react-strawberry-toast_fade-in{0%{transform:translateY(-100%) scale(.2);opacity:.2}to{transform:translateY(0) scale(1);opacity:1}}@keyframes react-strawberry-toast_fade-out{0%{transform:translateY(0);opacity:1}to{transform:translateY(-100%);opacity:.2}}@keyframes react-strawberry-toast_fade-in-reverse{0%{transform:translateY(100%) scale(.2);opacity:.2}to{transform:translateY(0) scale(1);opacity:1}}@keyframes react-strawberry-toast_fade-out-reverse{0%{transform:translateY(0);opacity:1}to{transform:translateY(100%);opacity:.2}}.react-strawberry-toast__z9999{z-index:9999}.react-strawberry-toast__toast-container{width:100%;position:fixed;z-index:9999;display:flex;align-items:center;flex-direction:column}.react-strawberry-toast__top-left{top:16px;left:calc(-50% + 16px)}.react-strawberry-toast__top-center{top:16px;left:50%;transform:translate(-50%)}.react-strawberry-toast__top-right{top:16px;right:calc(-50% + 16px)}.react-strawberry-toast__bottom-left{bottom:8px;left:calc(-50% + 16px)}.react-strawberry-toast__bottom-center{bottom:8px;left:50%;transform:translate(-50%)}.react-strawberry-toast__bottom-right{bottom:8px;right:calc(-50% + 16px)}.react-strawberry-toast__toast-content-container{position:absolute;pointer-events:none}.react-strawberry-toast__toast-
|
|
1
|
+
@keyframes l3{to{transform:rotate(1turn)}}@keyframes react-strawberry-toast_fade-in{0%{transform:translateY(-100%) scale(.2);opacity:.2}to{transform:translateY(0) scale(1);opacity:1}}@keyframes react-strawberry-toast_fade-out{0%{transform:translateY(0);opacity:1}to{transform:translateY(-100%);opacity:.2}}@keyframes react-strawberry-toast_fade-in-reverse{0%{transform:translateY(100%) scale(.2);opacity:.2}to{transform:translateY(0) scale(1);opacity:1}}@keyframes react-strawberry-toast_fade-out-reverse{0%{transform:translateY(0);opacity:1}to{transform:translateY(100%);opacity:.2}}.react-strawberry-toast__z9999{z-index:9999}.react-strawberry-toast__toast-container{width:100%;position:fixed;z-index:9999;display:flex;align-items:center;flex-direction:column}.react-strawberry-toast__top-left{top:16px;left:calc(-50% + 16px)}.react-strawberry-toast__top-center{top:16px;left:50%;transform:translate(-50%)}.react-strawberry-toast__top-right{top:16px;right:calc(-50% + 16px)}.react-strawberry-toast__bottom-left{bottom:8px;left:calc(-50% + 16px)}.react-strawberry-toast__bottom-center{bottom:8px;left:50%;transform:translate(-50%)}.react-strawberry-toast__bottom-right{bottom:8px;right:calc(-50% + 16px)}.react-strawberry-toast__toast-content-container{position:absolute;pointer-events:none}.react-strawberry-toast__toast-icon{width:22px;height:22px;display:flex;align-items:center;justify-content:center}.react-strawberry-toast__fade-in{animation:react-strawberry-toast_fade-in .3s cubic-bezier(.43,.14,.2,1.05)}.react-strawberry-toast__fade-out{animation:react-strawberry-toast_fade-out .3s cubic-bezier(.43,.14,.2,1.05)}.react-strawberry-toast__fade-in-reverse{animation:react-strawberry-toast_fade-in-reverse .3s cubic-bezier(.43,.14,.2,1.05)}.react-strawberry-toast__fade-out-reverse{animation:react-strawberry-toast_fade-out-reverse .3s cubic-bezier(.43,.14,.2,1.05)}.react-strawberry-toast__loading{width:18px;padding:3.5px;aspect-ratio:1;border-radius:50%;background:#6f6f70;--_m: conic-gradient(#0000 10%, #000), linear-gradient(#000 0 0) content-box;-webkit-mask:var(--_m);mask:var(--_m);-webkit-mask-composite:source-out;mask-composite:subtract;animation:l3 1s infinite linear}.react-strawberry-toast__toast-content{pointer-events:auto;box-sizing:border-box;background-color:#fff;padding:10px;display:flex;align-items:center;gap:5px;border-radius:8px;box-shadow:2px 4px 10px #0000001a;min-height:47px;max-width:368px}.react-strawberry-toast__close-button{background:transparent;border:none;outline:none;width:15px;height:15px;cursor:pointer}
|
package/dist/style2.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@keyframes l3{to{transform:rotate(1turn)}}@keyframes react-strawberry-toast_fade-in{0%{transform:translateY(-100%) scale(.2);opacity:.2}to{transform:translateY(0) scale(1);opacity:1}}@keyframes react-strawberry-toast_fade-out{0%{transform:translateY(0);opacity:1}to{transform:translateY(-100%);opacity:.2}}@keyframes react-strawberry-toast_fade-in-reverse{0%{transform:translateY(100%) scale(.2);opacity:.2}to{transform:translateY(0) scale(1);opacity:1}}@keyframes react-strawberry-toast_fade-out-reverse{0%{transform:translateY(0);opacity:1}to{transform:translateY(100%);opacity:.2}}.react-strawberry-toast__z9999{z-index:9999}.react-strawberry-toast__toast-container{width:100%;position:fixed;z-index:9999;display:flex;align-items:center;flex-direction:column}.react-strawberry-toast__top-left{top:16px;left:calc(-50% + 16px)}.react-strawberry-toast__top-center{top:16px;left:50%;transform:translate(-50%)}.react-strawberry-toast__top-right{top:16px;right:calc(-50% + 16px)}.react-strawberry-toast__bottom-left{bottom:8px;left:calc(-50% + 16px)}.react-strawberry-toast__bottom-center{bottom:8px;left:50%;transform:translate(-50%)}.react-strawberry-toast__bottom-right{bottom:8px;right:calc(-50% + 16px)}.react-strawberry-toast__toast-content-container{position:absolute;pointer-events:none}.react-strawberry-toast__toast-icon{width:22px;height:22px;display:flex;align-items:center;justify-content:center}.react-strawberry-toast__fade-in{animation:react-strawberry-toast_fade-in .3s cubic-bezier(.43,.14,.2,1.05)}.react-strawberry-toast__fade-out{animation:react-strawberry-toast_fade-out .3s cubic-bezier(.43,.14,.2,1.05)}.react-strawberry-toast__fade-in-reverse{animation:react-strawberry-toast_fade-in-reverse .3s cubic-bezier(.43,.14,.2,1.05)}.react-strawberry-toast__fade-out-reverse{animation:react-strawberry-toast_fade-out-reverse .3s cubic-bezier(.43,.14,.2,1.05)}.react-strawberry-toast__loading{width:18px;padding:3.5px;aspect-ratio:1;border-radius:50%;background:#6f6f70;--_m: conic-gradient(#0000 10%, #000), linear-gradient(#000 0 0) content-box;-webkit-mask:var(--_m);mask:var(--_m);-webkit-mask-composite:source-out;mask-composite:subtract;animation:l3 1s infinite linear}.react-strawberry-toast__toast-content{pointer-events:auto;box-sizing:border-box;background-color:#fff;padding:10px 10px 10px 15px;display:flex;align-items:center;gap:5px;width:314px;border-radius:8px;box-shadow:2px 4px 10px #0000001a;min-height:54px;max-width:368px;position:relative}.react-strawberry-toast__toast-success:before{content:"";display:inline-block;top:0;left:0;width:7px;height:100%;position:absolute;border-top-left-radius:8px;border-bottom-left-radius:8px;background-color:#1dca82}.react-strawberry-toast__toast-error:before{content:"";display:inline-block;top:0;left:0;width:7px;height:100%;position:absolute;border-top-left-radius:8px;border-bottom-left-radius:8px;background-color:#eb2639}.react-strawberry-toast__toast-warn:before{content:"";display:inline-block;top:0;left:0;width:7px;height:100%;position:absolute;border-top-left-radius:8px;border-bottom-left-radius:8px;background-color:#fcba03}.react-strawberry-toast__toast-info:before{content:"";display:inline-block;top:0;left:0;width:7px;height:100%;position:absolute;border-top-left-radius:8px;border-bottom-left-radius:8px;background-color:#5365e7}.react-strawberry-toast__close-button{background:transparent;border:none;outline:none;width:15px;height:15px;cursor:pointer;position:absolute;right:0;transform:translate(-10px)}
|
package/dist/style3.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@keyframes l3{to{transform:rotate(1turn)}}@keyframes react-strawberry-toast_fade-in{0%{transform:translateY(-100%) scale(.2);opacity:.2}to{transform:translateY(0) scale(1);opacity:1}}@keyframes react-strawberry-toast_fade-out{0%{transform:translateY(0);opacity:1}to{transform:translateY(-100%);opacity:.2}}@keyframes react-strawberry-toast_fade-in-reverse{0%{transform:translateY(100%) scale(.2);opacity:.2}to{transform:translateY(0) scale(1);opacity:1}}@keyframes react-strawberry-toast_fade-out-reverse{0%{transform:translateY(0);opacity:1}to{transform:translateY(100%);opacity:.2}}.react-strawberry-toast__z9999{z-index:9999}.react-strawberry-toast__toast-container{width:100%;position:fixed;z-index:9999;display:flex;align-items:center;flex-direction:column}.react-strawberry-toast__top-left{top:16px;left:calc(-50% + 16px)}.react-strawberry-toast__top-center{top:16px;left:50%;transform:translate(-50%)}.react-strawberry-toast__top-right{top:16px;right:calc(-50% + 16px)}.react-strawberry-toast__bottom-left{bottom:8px;left:calc(-50% + 16px)}.react-strawberry-toast__bottom-center{bottom:8px;left:50%;transform:translate(-50%)}.react-strawberry-toast__bottom-right{bottom:8px;right:calc(-50% + 16px)}.react-strawberry-toast__toast-content-container{position:absolute;pointer-events:none}.react-strawberry-toast__toast-icon{width:22px;height:22px;display:flex;align-items:center;justify-content:center}.react-strawberry-toast__fade-in{animation:react-strawberry-toast_fade-in .3s cubic-bezier(.43,.14,.2,1.05)}.react-strawberry-toast__fade-out{animation:react-strawberry-toast_fade-out .3s cubic-bezier(.43,.14,.2,1.05)}.react-strawberry-toast__fade-in-reverse{animation:react-strawberry-toast_fade-in-reverse .3s cubic-bezier(.43,.14,.2,1.05)}.react-strawberry-toast__fade-out-reverse{animation:react-strawberry-toast_fade-out-reverse .3s cubic-bezier(.43,.14,.2,1.05)}.react-strawberry-toast__loading{width:18px;padding:3.5px;aspect-ratio:1;border-radius:50%;background:#6f6f70;--_m: conic-gradient(#0000 10%, #000), linear-gradient(#000 0 0) content-box;-webkit-mask:var(--_m);mask:var(--_m);-webkit-mask-composite:source-out;mask-composite:subtract;animation:l3 1s infinite linear}.react-strawberry-toast__toast-content{pointer-events:auto;box-sizing:border-box;padding:10px;display:flex;align-items:center;gap:5px;width:314px;border-radius:8px;box-shadow:2px 4px 10px #0000001a;min-height:54px;max-width:368px;position:relative;background-color:#fff}.react-strawberry-toast__toast-success{color:#fff;background-color:#1dca82}.react-strawberry-toast__toast-error{color:#fff;background-color:#eb2639}.react-strawberry-toast__toast-warn{color:#fff;background-color:#fcba03}.react-strawberry-toast__toast-info{color:#fff;background-color:#5365e7}.react-strawberry-toast__close-button{background:transparent;border:none;outline:none;width:15px;height:15px;cursor:pointer;position:absolute;right:0;transform:translate(-10px)}svg .react-strawberry-toast-path{fill:#fff}
|
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": "1.6.
|
|
4
|
+
"version": "1.6.2",
|
|
5
5
|
"author": "dkpark10",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
@@ -42,7 +42,9 @@
|
|
|
42
42
|
"default": "./dist/headless.mjs"
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
|
-
"./dist/style.css": "./dist/style.css"
|
|
45
|
+
"./dist/style.css": "./dist/style.css",
|
|
46
|
+
"./dist/style2.css": "./dist/style2.css",
|
|
47
|
+
"./dist/style3.css": "./dist/style3.css"
|
|
46
48
|
},
|
|
47
49
|
"files": [
|
|
48
50
|
"dist"
|