Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sonner

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sonner - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

25

dist/index.d.ts
import React from 'react';
type ToastTypes = 'normal' | 'action' | 'success' | 'error' | 'loading';
type PromiseData = {
loading: string;
type PromiseT = Promise<any> | (() => Promise<any>);
type PromiseData = ExternalToast & {
loading: string | React.ReactNode;
success: string | React.ReactNode;
error: string | React.ReactNode;
};
type PromiseT = Promise<any> | (() => Promise<any>);
interface ToastT {
id: number;
title?: string;
title?: string | React.ReactNode;
type?: ToastTypes;

@@ -19,2 +19,3 @@ icon?: React.ReactNode;

duration?: number;
delete?: boolean;
important?: boolean;

@@ -30,5 +31,5 @@ action?: {

promise?: PromiseT;
promiseData?: PromiseData;
style?: React.CSSProperties;
className?: string;
descriptionClassName?: string;
}

@@ -38,8 +39,9 @@ type Position = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'top-center' | 'bottom-center';

declare const toast: ((message: string, data?: ExternalToast) => void) & {
success: (message: string, data?: ExternalToast) => void;
error: (message: string, data?: ExternalToast) => void;
custom: (jsx: (id: number) => React.ReactElement) => void;
message: (message: string, data?: ExternalToast) => void;
promise: (promise: PromiseT, data?: PromiseData) => void;
declare const toast: ((message: string | React.ReactNode, data?: ExternalToast) => number) & {
success: (message: string | React.ReactNode, data?: ExternalToast) => number;
error: (message: string | React.ReactNode, data?: ExternalToast) => number;
custom: (jsx: (id: number) => React.ReactElement, data?: ExternalToast) => void;
message: (message: string | React.ReactNode, data?: ExternalToast) => number;
promise: (promise: PromiseT, data?: PromiseData) => number;
dismiss: (id: number) => number;
};

@@ -49,2 +51,3 @@

className?: string;
descriptionClassName?: string;
style?: React.CSSProperties;

@@ -51,0 +54,0 @@ }

"use client"
var ht=Object.create;var j=Object.defineProperty;var gt=Object.getOwnPropertyDescriptor;var bt=Object.getOwnPropertyNames;var vt=Object.getPrototypeOf,yt=Object.prototype.hasOwnProperty;var xt=(o,a)=>{for(var t in a)j(o,t,{get:a[t],enumerable:!0})},st=(o,a,t,r)=>{if(a&&typeof a=="object"||typeof a=="function")for(let i of bt(a))!yt.call(o,i)&&i!==t&&j(o,i,{get:()=>a[i],enumerable:!(r=gt(a,i))||r.enumerable});return o};var rt=(o,a,t)=>(t=o!=null?ht(vt(o)):{},st(a||!o||!o.__esModule?j(t,"default",{value:o,enumerable:!0}):t,o)),Tt=o=>st(j({},"__esModule",{value:!0}),o);var Yt={};xt(Yt,{Toaster:()=>Dt,toast:()=>lt});module.exports=Tt(Yt);var e=rt(require("react"));function G(o,{insertAt:a}={}){if(!o||typeof document=="undefined")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",a==="top"&&t.firstChild?t.insertBefore(r,t.firstChild):t.appendChild(r),r.styleSheet?r.styleSheet.cssText=o:r.appendChild(document.createTextNode(o))}G(`[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 6px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999}[data-sonner-toaster][data-x-position=right]{right:max(var(--offset),env(safe-area-inset-right))}[data-sonner-toaster][data-x-position=left]{left:max(var(--offset),env(safe-area-inset-left))}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translate(-50%)}[data-sonner-toaster][data-y-position=top]{top:max(var(--offset),env(safe-area-inset-top))}[data-sonner-toaster][data-y-position=bottom]{bottom:max(var(--offset),env(safe-area-inset-bottom))}[data-sonner-toast]{--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);display:flex;align-items:center;gap:6px;position:absolute;opacity:0;transform:var(--y);padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;touch-action:none;will-change:transform,opacity,height;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}[data-sonner-toast][data-y-position=top]{top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}[data-sonner-toast] [data-description]{font-weight:400;line-height:1.4;color:inherit}[data-sonner-toast] [data-title]{font-weight:500;color:inherit}[data-sonner-toast] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:-3px;margin-right:4px}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);animation:sonner-fade-in .3s ease forwards}[data-sonner-toast] [data-icon]>*{flex-shrink:0}[data-sonner-toast] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:auto;border:none;cursor:pointer;outline:none;transition:opacity .4s,box-shadow .2s}[data-sonner-toast] [data-button]:focus-visible{box-shadow:0 0 0 2px #0006}[data-sonner-toast] [data-button]:first-of-type{margin-left:auto}[data-sonner-toast] [data-cancel]{color:var(--color);background:var(--border-color)}[data-sonner-toast] [data-close-button]{position:absolute;left:0;top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--gray1);color:var(--gray12);border:1px solid var(--gray4);transform:translate(-35%,-35%);border-radius:50%;opacity:0;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast]:hover [data-close-button]{opacity:1}[data-sonner-toast]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]:before{content:"";position:absolute;left:0;right:0;height:100%}[data-sonner-toast][data-y-position=top][data-swiping=true]:before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]:before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]:before{content:"";position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast]:after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y: translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-expanded=false][data-front=false]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y: translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{opacity:0}[data-sonner-toast][data-removed=true][data-front=false]:before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toast]{left:0;right:0;width:calc(100% - 32px)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true] [data-sonner-toast][data-type=success],[data-rich-colors=true] [data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true] [data-sonner-toast][data-type=error],[data-rich-colors=true] [data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}
`);var g=rt(require("react")),nt=o=>{switch(o){case"success":return St;case"error":return Et;default:}},wt=Array(12).fill(0),it=({visible:o})=>g.default.createElement("div",{className:"sonner-loading-wrapper","data-visible":o},g.default.createElement("div",{className:"sonner-spinner"},wt.map((a,t)=>g.default.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${t}`})))),St=g.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},g.default.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"}));var Et=g.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},g.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"}));var P=0,X=class{constructor(){this.subscribe=a=>(this.subscribers.push(a),()=>{let t=this.subscribers.indexOf(a);this.subscribers.splice(t,1)});this.publish=a=>{this.subscribers.forEach(t=>t(a))};this.message=(a,t)=>{this.publish({...t,id:P++,title:a})};this.error=(a,t)=>{this.publish({...t,id:P++,type:"error",title:a})};this.success=(a,t)=>{this.publish({...t,id:P++,type:"success",title:a})};this.promise=(a,t)=>{this.publish({promiseData:t,promise:a,id:P++})};this.custom=a=>{let t=P++;this.publish({jsx:a(t),id:t})};this.subscribers=[]}},b=new X,kt=(o,a)=>{b.publish({title:o,...a,id:P++})},Pt=kt,lt=Object.assign(Pt,{success:b.success,error:b.error,custom:b.custom,message:b.message,promise:b.promise});var Ct=3,It="32px",Nt=4e3,Mt=356,dt=14,Bt=20,zt=200,Ht=o=>{var at;let{invert:a,toast:t,interacting:r,setHeights:i,visibleToasts:U,heights:x,index:m,toasts:_,expanded:C,removeToast:I,closeButton:F,style:$,className:h="",duration:v,position:N,expandByDefault:T}=o,[M,K]=e.default.useState(!1),[p,B]=e.default.useState(!1),[z,H]=e.default.useState(!1),[D,w]=e.default.useState(!1),[d,y]=e.default.useState(null),[Y,l]=e.default.useState(0),[c,A]=e.default.useState(0),f=e.default.useRef(null),L=m===0,ct=m+1<=U,q=t.type,ut=t.className||"",O=e.default.useMemo(()=>x.findIndex(s=>s.toastId===t.id)||0,[x,t.id]),Q=e.default.useMemo(()=>t.duration||v||Nt,[t.duration,v]),V=e.default.useRef(0),S=e.default.useRef(0),W=e.default.useRef(Q),Z=e.default.useRef(0),R=e.default.useRef(null),[tt,pt]=N.split("-"),et=e.default.useMemo(()=>x.reduce((s,n,u)=>u>=O?s:s+n.height,0),[x,O]),ft=t.invert||a,J=d==="loading";S.current=e.default.useMemo(()=>O*dt+et,[O,et]),e.default.useEffect(()=>{K(!0)},[]),e.default.useEffect(()=>{t.promise&&(y("loading"),t.promise instanceof Promise?t.promise.then(()=>{y("success")}).catch(()=>{y("error")}):typeof t.promise=="function"&&t.promise().then(()=>{y("success")}).catch(()=>{y("error")}))},[t]);let E=e.default.useCallback(()=>{B(!0),l(S.current),i(s=>s.filter(n=>n.toastId!==t.id)),setTimeout(()=>{I(t)},zt)},[t,I,i,S]);e.default.useEffect(()=>{if(t.promise&&d==="loading")return;let s;return C||r?(()=>{if(Z.current<V.current){let k=new Date().getTime()-V.current;W.current=W.current-k}Z.current=new Date().getTime()})():(()=>{V.current=new Date().getTime(),s=setTimeout(()=>{E()},W.current)})(),()=>clearTimeout(s)},[C,r,T,t,Q,E,t.promise,d]),e.default.useEffect(()=>{let s=f.current;if(s){let n=s.getBoundingClientRect().height;return A(n),i(u=>[{toastId:t.id,height:n},...u]),()=>i(u=>u.filter(k=>k.toastId!==t.id))}},[i,t.id]);let mt=e.default.useMemo(()=>{switch(d){case"loading":return t.promiseData.loading;case"success":return t.promiseData.success;case"error":return t.promiseData.error;default:return null}},[t.promiseData,d]);return e.default.createElement("li",{"aria-live":t.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:f,className:h+" "+ut,"data-sonner-toast":"","data-mounted":M,"data-promise":Boolean(t.promise),"data-removed":p,"data-visible":ct,"data-y-position":tt,"data-x-position":pt,"data-index":m,"data-front":L,"data-swiping":z,"data-type":q,"data-invert":ft,"data-swipe-out":D,"data-expanded":Boolean(C||T&&M),style:{"--index":m,"--toasts-before":m,"--z-index":_.length-m,"--offset":`${p?Y:S.current}px`,"--initial-height":T?"auto":`${c}px`,...$,...t.style},onPointerDown:s=>{J||(l(S.current),s.target.setPointerCapture(s.pointerId),s.target.tagName!=="BUTTON"&&(H(!0),R.current=s.clientY))},onPointerUp:()=>{var n,u;if(D)return;let s=Number(((n=f.current)==null?void 0:n.style.getPropertyValue("--swipe-amount").replace("px",""))||0);if(Math.abs(s)>=Bt){l(S.current),E(),w(!0);return}(u=f.current)==null||u.style.setProperty("--swipe-amount","0px"),R.current=null,H(!1)},onPointerMove:s=>{var k,ot;if(!R.current)return;let n=s.clientY-R.current;if(!(tt==="top"?n<0:n>0)){(k=f.current)==null||k.style.setProperty("--swipe-amount","0px");return}(ot=f.current)==null||ot.style.setProperty("--swipe-amount",`${n}px`)}},F?e.default.createElement("button",{"aria-label":"Close toast","data-disabled":J,"data-close-button":!0,onClick:J?void 0:E},e.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.default.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.default.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,t.jsx?t.jsx:e.default.createElement(e.default.Fragment,null,q||t.icon||t.promise?e.default.createElement("div",{"data-icon":""},t.promise?e.default.createElement(it,{visible:d==="loading"}):null,t.icon||nt(d!=null?d:t.type)):null,e.default.createElement("div",{"data-content":""},e.default.createElement("div",{"data-title":""},(at=t.title)!=null?at:mt),t.description?e.default.createElement("div",{"data-description":""},t.description):null),t.cancel?e.default.createElement("button",{"data-button":!0,"data-cancel":!0,onClick:()=>{var s;E(),(s=t.cancel)!=null&&s.onClick&&t.cancel.onClick()}},t.cancel.label):null,t.action?e.default.createElement("button",{"data-button":"",onClick:()=>{var s;E(),(s=t.action)==null||s.onClick()}},t.action.label):null))},Dt=o=>{var Y;let{invert:a,position:t="bottom-right",hotkey:r=["altKey","KeyT"],expand:i,closeButton:U,className:x,offset:m,theme:_="light",richColors:C,duration:I,style:F,visibleToasts:$=Ct,toastOptions:h}=o,[v,N]=e.default.useState([]),[T,M]=e.default.useState([]),[K,p]=e.default.useState(!1),[B,z]=e.default.useState(!1),[H,D]=t.split("-"),w=e.default.useRef(null),d=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=e.default.useCallback(l=>N(c=>c.filter(({id:A})=>A!==l.id)),[]);return e.default.useEffect(()=>b.subscribe(l=>{N(c=>[l,...c])}),[]),e.default.useEffect(()=>{v.length<=1&&p(!1)},[v]),e.default.useEffect(()=>{let l=c=>{var f;r.every(L=>c[L]||c.code===L)&&(p(!0),(f=w.current)==null||f.focus()),c.code==="Escape"&&(document.activeElement===w.current||w.current.contains(document.activeElement))&&p(!1)};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[r]),e.default.createElement("div",{role:"region","aria-label":`Notifications ${d}`,tabIndex:-1},e.default.createElement("ol",{tabIndex:-1,ref:w,className:x,"data-sonner-toaster":!0,"data-theme":_,"data-rich-colors":C,"data-y-position":H,"data-x-position":D,style:{"--front-toast-height":`${(Y=T[0])==null?void 0:Y.height}px`,"--offset":m||It,"--width":`${Mt}px`,"--gap":`${dt}px`,...F},onMouseEnter:()=>p(!0),onMouseMove:()=>p(!0),onMouseLeave:()=>{B||p(!1)},onPointerDown:()=>{z(!0)},onPointerUp:()=>z(!1)},v.map((l,c)=>e.default.createElement(Ht,{key:l.id,index:c,toast:l,duration:I,className:h==null?void 0:h.className,invert:a,visibleToasts:$,closeButton:U,interacting:B,position:t,style:h==null?void 0:h.style,removeToast:y,toasts:v,heights:T,setHeights:M,expandByDefault:i,expanded:K}))))};0&&(module.exports={Toaster,toast});
var bt=Object.create;var j=Object.defineProperty;var vt=Object.getOwnPropertyDescriptor;var yt=Object.getOwnPropertyNames;var xt=Object.getPrototypeOf,Tt=Object.prototype.hasOwnProperty;var wt=(s,a)=>{for(var t in a)j(s,t,{get:a[t],enumerable:!0})},st=(s,a,t,o)=>{if(a&&typeof a=="object"||typeof a=="function")for(let l of yt(a))!Tt.call(s,l)&&l!==t&&j(s,l,{get:()=>a[l],enumerable:!(o=vt(a,l))||o.enumerable});return s};var rt=(s,a,t)=>(t=s!=null?bt(xt(s)):{},st(a||!s||!s.__esModule?j(t,"default",{value:s,enumerable:!0}):t,s)),St=s=>st(j({},"__esModule",{value:!0}),s);var At={};wt(At,{Toaster:()=>Yt,toast:()=>lt});module.exports=St(At);var e=rt(require("react"));function G(s,{insertAt:a}={}){if(!s||typeof document=="undefined")return;let t=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",a==="top"&&t.firstChild?t.insertBefore(o,t.firstChild):t.appendChild(o),o.styleSheet?o.styleSheet.cssText=s:o.appendChild(document.createTextNode(s))}G(`[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 6px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999}[data-sonner-toaster][data-x-position=right]{right:max(var(--offset),env(safe-area-inset-right))}[data-sonner-toaster][data-x-position=left]{left:max(var(--offset),env(safe-area-inset-left))}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translate(-50%)}[data-sonner-toaster][data-y-position=top]{top:max(var(--offset),env(safe-area-inset-top))}[data-sonner-toaster][data-y-position=bottom]{bottom:max(var(--offset),env(safe-area-inset-bottom))}[data-sonner-toast]{--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;will-change:transform,opacity,height;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}[data-sonner-toast][data-y-position=top]{top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}[data-sonner-toast] [data-description]{font-weight:400;line-height:1.4;color:inherit}[data-sonner-toast] [data-title]{font-weight:500;color:inherit}[data-sonner-toast] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:-3px;margin-right:4px}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);animation:sonner-fade-in .3s ease forwards}[data-sonner-toast] [data-icon]>*{flex-shrink:0}[data-sonner-toast] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:auto;border:none;cursor:pointer;outline:none;transition:opacity .4s,box-shadow .2s}[data-sonner-toast] [data-button]:focus-visible{box-shadow:0 0 0 2px #0006}[data-sonner-toast] [data-button]:first-of-type{margin-left:auto}[data-sonner-toast] [data-cancel]{color:var(--color);background:var(--border-color)}[data-sonner-toast] [data-close-button]{position:absolute;left:0;top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--gray1);color:var(--gray12);border:1px solid var(--gray4);transform:translate(-35%,-35%);border-radius:50%;opacity:0;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast]:hover [data-close-button]{opacity:1}[data-sonner-toast]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]:before{content:"";position:absolute;left:0;right:0;height:100%}[data-sonner-toast][data-y-position=top][data-swiping=true]:before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]:before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]:before{content:"";position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast]:after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y: translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y: translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{opacity:0}[data-sonner-toast][data-removed=true][data-front=false]:before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toast]{left:0;right:0;width:calc(100% - 32px)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true] [data-sonner-toast][data-type=success],[data-rich-colors=true] [data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true] [data-sonner-toast][data-type=error],[data-rich-colors=true] [data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}
`);var y=rt(require("react")),nt=s=>{switch(s){case"success":return kt;case"error":return Ct;default:}},Et=Array(12).fill(0),it=({visible:s})=>y.default.createElement("div",{className:"sonner-loading-wrapper","data-visible":s},y.default.createElement("div",{className:"sonner-spinner"},Et.map((a,t)=>y.default.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${t}`})))),kt=y.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},y.default.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"}));var Ct=y.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},y.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"}));var N=0,X=class{constructor(){this.subscribe=a=>(this.subscribers.push(a),()=>{let t=this.subscribers.indexOf(a);this.subscribers.splice(t,1)});this.publish=a=>{this.subscribers.forEach(t=>t(a))};this.dismiss=a=>(this.subscribers.forEach(t=>t({id:a,dismiss:!0})),a);this.message=(a,t)=>{let o=N++;return this.publish({...t,id:o,title:a}),o};this.error=(a,t)=>{let o=N++;return this.publish({...t,id:o,type:"error",title:a}),o};this.success=(a,t)=>{let o=N++;return this.publish({...t,id:o,type:"success",title:a}),o};this.promise=(a,t)=>{let o=N++;return this.publish({...t,promise:a,id:o}),o};this.custom=(a,t)=>{let o=N++;this.publish({jsx:a(o),id:o,...t})};this.subscribers=[]}},f=new X,Nt=(s,a)=>{let t=N++;return f.publish({title:s,...a,id:t}),t},Pt=Nt,lt=Object.assign(Pt,{success:f.success,error:f.error,custom:f.custom,message:f.message,promise:f.promise,dismiss:f.dismiss});var It=3,Bt="32px",Mt=4e3,zt=356,dt=14,Dt=20,Ht=200,Rt=s=>{var at;let{invert:a,toast:t,interacting:o,setHeights:l,visibleToasts:O,heights:w,index:h,toasts:U,expanded:P,removeToast:M,closeButton:_,style:F,className:c="",descriptionClassName:S="",duration:E,position:z,expandByDefault:I}=s,[D,g]=e.default.useState(!1),[B,H]=e.default.useState(!1),[$,R]=e.default.useState(!1),[x,K]=e.default.useState(!1),[u,b]=e.default.useState(null),[d,i]=e.default.useState(0),[v,Y]=e.default.useState(0),m=e.default.useRef(null),ct=h===0,ut=h+1<=O,q=t.type,pt=t.className||"",mt=t.descriptionClassName||"",A=e.default.useMemo(()=>w.findIndex(r=>r.toastId===t.id)||0,[w,t.id]),Q=e.default.useMemo(()=>t.duration||E||Mt,[t.duration,E]),V=e.default.useRef(0),k=e.default.useRef(0),W=e.default.useRef(Q),Z=e.default.useRef(0),L=e.default.useRef(null),[tt,ft]=z.split("-"),et=e.default.useMemo(()=>w.reduce((r,n,p)=>p>=A?r:r+n.height,0),[w,A]),ht=t.invert||a,J=u==="loading";k.current=e.default.useMemo(()=>A*dt+et,[A,et]),e.default.useEffect(()=>{g(!0)},[]),e.default.useEffect(()=>{t.promise&&(b("loading"),t.promise instanceof Promise?t.promise.then(()=>{b("success")}).catch(()=>{b("error")}):typeof t.promise=="function"&&t.promise().then(()=>{b("success")}).catch(()=>{b("error")}))},[t]);let T=e.default.useCallback(()=>{H(!0),i(k.current),l(r=>r.filter(n=>n.toastId!==t.id)),setTimeout(()=>{M(t)},Ht)},[t,M,l,k]);e.default.useEffect(()=>{if(t.promise&&u==="loading")return;let r;return P||o?(()=>{if(Z.current<V.current){let C=new Date().getTime()-V.current;W.current=W.current-C}Z.current=new Date().getTime()})():(()=>{V.current=new Date().getTime(),r=setTimeout(()=>{T()},W.current)})(),()=>clearTimeout(r)},[P,o,I,t,Q,T,t.promise,u]),e.default.useEffect(()=>{let r=m.current;if(r){let n=r.getBoundingClientRect().height;return Y(n),l(p=>[{toastId:t.id,height:n},...p]),()=>l(p=>p.filter(C=>C.toastId!==t.id))}},[l,t.id]),e.default.useEffect(()=>{t.delete&&T()},[t.delete]);let gt=e.default.useMemo(()=>{if(!(n=>Boolean(n.promise))(t))return null;switch(u){case"loading":return t.loading;case"success":return t.success;case"error":return t.error;default:return null}},[u]);return e.default.createElement("li",{"aria-live":t.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:m,className:c+" "+pt,"data-sonner-toast":"","data-styled":!Boolean(t.jsx),"data-mounted":D,"data-promise":Boolean(t.promise),"data-removed":B,"data-visible":ut,"data-y-position":tt,"data-x-position":ft,"data-index":h,"data-front":ct,"data-swiping":$,"data-type":q,"data-invert":ht,"data-swipe-out":x,"data-expanded":Boolean(P||I&&D),style:{"--index":h,"--toasts-before":h,"--z-index":U.length-h,"--offset":`${B?d:k.current}px`,"--initial-height":I?"auto":`${v}px`,...F,...t.style},onPointerDown:r=>{J||(i(k.current),r.target.setPointerCapture(r.pointerId),r.target.tagName!=="BUTTON"&&(R(!0),L.current=r.clientY))},onPointerUp:()=>{var n,p;if(x)return;let r=Number(((n=m.current)==null?void 0:n.style.getPropertyValue("--swipe-amount").replace("px",""))||0);if(Math.abs(r)>=Dt){i(k.current),T(),K(!0);return}(p=m.current)==null||p.style.setProperty("--swipe-amount","0px"),L.current=null,R(!1)},onPointerMove:r=>{var C,ot;if(!L.current)return;let n=r.clientY-L.current;if(!(tt==="top"?n<0:n>0)){(C=m.current)==null||C.style.setProperty("--swipe-amount","0px");return}(ot=m.current)==null||ot.style.setProperty("--swipe-amount",`${n}px`)}},_&&!t.jsx?e.default.createElement("button",{"aria-label":"Close toast","data-disabled":J,"data-close-button":!0,onClick:J?void 0:T},e.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.default.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.default.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,t.jsx||e.default.isValidElement(t.title)?t.jsx||t.title:e.default.createElement(e.default.Fragment,null,q||t.icon||t.promise?e.default.createElement("div",{"data-icon":""},t.promise?e.default.createElement(it,{visible:u==="loading"}):null,t.icon||nt(u!=null?u:t.type)):null,e.default.createElement("div",{"data-content":""},e.default.createElement("div",{"data-title":""},(at=t.title)!=null?at:gt),t.description?e.default.createElement("div",{"data-description":"",className:S+mt},t.description):null),t.cancel?e.default.createElement("button",{"data-button":!0,"data-cancel":!0,onClick:()=>{var r;T(),(r=t.cancel)!=null&&r.onClick&&t.cancel.onClick()}},t.cancel.label):null,t.action?e.default.createElement("button",{"data-button":"",onClick:()=>{var r;T(),(r=t.action)==null||r.onClick()}},t.action.label):null))},Yt=s=>{var b;let{invert:a,position:t="bottom-right",hotkey:o=["altKey","KeyT"],expand:l,closeButton:O,className:w,offset:h,theme:U="light",richColors:P,duration:M,style:_,visibleToasts:F=It,toastOptions:c}=s,[S,E]=e.default.useState([]),[z,I]=e.default.useState([]),[D,g]=e.default.useState(!1),[B,H]=e.default.useState(!1),[$,R]=t.split("-"),x=e.default.useRef(null),K=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),u=e.default.useCallback(d=>E(i=>i.filter(({id:v})=>v!==d.id)),[]);return e.default.useEffect(()=>f.subscribe(d=>{if(d.dismiss){E(i=>i.map(v=>v.id===d.id?{...v,delete:!0}:v));return}E(i=>[d,...i])}),[]),e.default.useEffect(()=>{S.length<=1&&g(!1)},[S]),e.default.useEffect(()=>{let d=i=>{var Y;o.every(m=>i[m]||i.code===m)&&(g(!0),(Y=x.current)==null||Y.focus()),i.code==="Escape"&&(document.activeElement===x.current||x.current.contains(document.activeElement))&&g(!1)};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[o]),e.default.createElement("div",{role:"region","aria-label":`Notifications ${K}`,tabIndex:-1},e.default.createElement("ol",{tabIndex:-1,ref:x,className:w,"data-sonner-toaster":!0,"data-theme":U,"data-rich-colors":P,"data-y-position":$,"data-x-position":R,style:{"--front-toast-height":`${(b=z[0])==null?void 0:b.height}px`,"--offset":h||Bt,"--width":`${zt}px`,"--gap":`${dt}px`,..._},onMouseEnter:()=>g(!0),onMouseMove:()=>g(!0),onMouseLeave:()=>{B||g(!1)},onPointerDown:()=>{H(!0)},onPointerUp:()=>H(!1)},S.map((d,i)=>e.default.createElement(Rt,{key:d.id,index:i,toast:d,duration:M,className:c==null?void 0:c.className,descriptionClassName:c==null?void 0:c.descriptionClassName,invert:a,visibleToasts:F,closeButton:O,interacting:B,position:t,style:c==null?void 0:c.style,removeToast:u,toasts:S,heights:z,setHeights:I,expandByDefault:l,expanded:D}))))};0&&(module.exports={Toaster,toast});
//# sourceMappingURL=index.js.map
{
"name": "sonner",
"version": "0.1.5",
"version": "0.1.6",
"description": "An opinionated toast component for React.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -93,8 +93,8 @@ https://user-images.githubusercontent.com/36730035/220868994-f0c92862-7e7d-487c-ab3a-540e7b48ab4a.mp4

### Custom
### Custom JSX
Render custom JSX.
You can pass jsx as the first argument instead of a string to render custom jsx while maintaining default styling. You can use the headless version below for a custom, unstyled toast.
```jsx
toast.custom(() => <div>This is a custom component</div>);
toast(<div>A custom toast with default styling</div>);
```

@@ -104,2 +104,14 @@

### Headless
You can use `toast.custom` to render an unstyled toast with custom jsx while maintaining the functionality.
```jsx
toast.custom((t) => (
<div>
This is a custom component <button onClick={() => toast.dismiss(t)}>close</button>
</div>
));
```
### Theme

@@ -137,3 +149,5 @@

```jsx
<Toaster toastOptions={{ style: { background: 'red' }, className: 'my-toast' }} />
<Toaster
toastOptions={{ style: { background: 'red' }, className: 'my-toast', descriptionClassName: 'my-toast-description' }}
/>
```

@@ -149,2 +163,3 @@

className: 'my-toast',
descriptionClassName: 'my-toast-description',
});

@@ -177,2 +192,12 @@ ```

### Programmatically remove toast
To remove a toast programmatically use `toast.dismiss(id)`.
```jsx
const toastId = toast('Event has been created');
toast.dismiss(toastId);
```
## Keyboard focus

@@ -185,1 +210,5 @@

```
```
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc