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

@radix-ui/react-toast

Package Overview
Dependencies
Maintainers
7
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@radix-ui/react-toast - npm Package Compare versions

Comparing version 0.0.1-rc.6 to 0.0.1-rc.7

1

dist/index.d.ts

@@ -71,2 +71,3 @@ import * as React from "react";

type ToastImplPrivateProps = {
open: boolean;
onClose(): void;

@@ -73,0 +74,0 @@ };

2

dist/index.js

@@ -1,2 +0,2 @@

var e,t=require("@radix-ui/react-visually-hidden").VisuallyHidden,r=require("@radix-ui/react-use-layout-effect").useLayoutEffect,o=require("@radix-ui/react-use-controllable-state").useControllableState,n=require("@radix-ui/react-use-callback-ref").useCallbackRef,s=require("@radix-ui/react-primitive").Primitive,a=require("@radix-ui/react-presence").Presence,i=require("@radix-ui/react-portal").UnstablePortal,c=v({},require("@radix-ui/react-dismissable-layer")),u=require("@radix-ui/react-context").createContextScope,l=require("@radix-ui/react-compose-refs").useComposedRefs,d=require("@radix-ui/primitive").composeEventHandlers,p=v({},require("react-dom")),w=v({},require("react")),f=(e=require("@babel/runtime/helpers/extends"))&&e.__esModule?e.default:e;function v(e,t){return Object.keys(t).forEach((function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})),e}const[m,E]=u("Toast");exports.createToastScope=E;const[T,y]=m("ToastProvider"),x=e=>{const{__scopeToast:t,label:r="Notification",duration:o=5e3,swipeDirection:n="right",swipeThreshold:s=50,children:a}=e,[i,c]=w.useState(null),[u,l]=w.useState(!1),[d,p]=w.useState(0),f=w.useRef(!1);/*#__PURE__*/return w.createElement(T,{scope:t,label:r,duration:o,swipeDirection:n,swipeThreshold:s,toastCount:d,viewport:i,onViewportChange:c,isClosePaused:u,onClosePause:w.useCallback((()=>l(!0)),[]),onCloseResume:w.useCallback((()=>l(!1)),[]),onToastAdd:w.useCallback((()=>p((e=>e+1))),[]),onToastRemove:w.useCallback((()=>p((e=>e-1))),[]),isFocusedToastEscapeKeyDownRef:f},a)};exports.ToastProvider=x;const C=["F8"],b=/*#__PURE__*/w.forwardRef(((e,t)=>{const{__scopeToast:r,hotkey:o=C,label:n="Notifications ({hotkey})",...a}=e,i=y("ToastViewport",r),u=w.useRef(null),d=w.useRef(null),p=l(t,d,i.onViewportChange),v=o.join("+").replace(/Key/g,"").replace(/Digit/g,"");return w.useEffect((()=>{const e=e=>{var t;o.every((t=>e[t]||e.code===t))&&(null===(t=d.current)||void 0===t||t.focus())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[o]),w.useEffect((()=>{const e=u.current;if(e)return e.addEventListener("focusin",i.onClosePause),e.addEventListener("focusout",i.onCloseResume),e.addEventListener("pointerenter",i.onClosePause),e.addEventListener("pointerleave",i.onCloseResume),window.addEventListener("blur",i.onClosePause),window.addEventListener("focus",i.onCloseResume),()=>{e.removeEventListener("focusin",i.onClosePause),e.removeEventListener("focusout",i.onCloseResume),e.removeEventListener("pointerenter",i.onClosePause),e.removeEventListener("pointerleave",i.onCloseResume),window.removeEventListener("blur",i.onClosePause),window.removeEventListener("focus",i.onCloseResume)}}),[i.onCloseResume,i.onClosePause]),w.useEffect((()=>{const e=d.current;if(e){let t=[];const r=new MutationObserver((r=>{const[o]=r;o.addedNodes.forEach((r=>{t.includes(r)||(e.prepend(r),t=[...t,r])}))}));return r.observe(e,{childList:!0}),()=>r.disconnect()}}),[]),/*#__PURE__*/w.createElement(c.Branch,{ref:u,role:"region","aria-label":n.replace("{hotkey}",v),tabIndex:-1,style:{pointerEvents:i.toastCount>0?void 0:"none"}},/*#__PURE__*/w.createElement(s.ol,f({tabIndex:-1},a,{ref:p})))}));exports.ToastViewport=b;const g=/*#__PURE__*/w.forwardRef(((e,t)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:i,...c}=e,[u=!0,l]=o({prop:n,defaultProp:s,onChange:i});/*#__PURE__*/return w.createElement(a,{present:r||u},/*#__PURE__*/w.createElement(R,f({"data-state":u?"open":"closed"},c,{ref:t,onClose:()=>l(!1),onSwipeStart:d(e.onSwipeStart,(e=>{e.currentTarget.setAttribute("data-swipe","start")})),onSwipeMove:d(e.onSwipeMove,(e=>{const{x:t,y:r}=e.detail.delta;e.currentTarget.setAttribute("data-swipe","move"),e.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${t}px`),e.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${r}px`)})),onSwipeCancel:d(e.onSwipeCancel,(e=>{e.currentTarget.setAttribute("data-swipe","cancel"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),e.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")})),onSwipeEnd:d(e.onSwipeEnd,(e=>{const{x:t,y:r}=e.detail.delta;e.currentTarget.setAttribute("data-swipe","end"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),e.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${t}px`),e.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${r}px`),l(!1)}))})))}));exports.Toast=g;const[h,P]=m("Toast",{isInteractive:!1,onClose(){}}),R=/*#__PURE__*/w.forwardRef(((e,t)=>{const{__scopeToast:r,type:o="foreground",duration:a,onClose:i,onEscapeKeyDown:u,onSwipeStart:v,onSwipeMove:m,onSwipeCancel:E,onSwipeEnd:T,...x}=e,C=y("Toast",r),b=w.useRef(null),g=l(t,b),P=w.useRef(null),R=w.useRef(null),D=a||C.duration,_=w.useRef(D),{onToastAdd:k,onToastRemove:L}=C,A=n((()=>{var e,t;(null===(e=b.current)||void 0===e?void 0:e.contains(document.activeElement))&&(null===(t=C.viewport)||void 0===t||t.focus()),i()}));return w.useEffect((()=>{_.current=D}),[D]),w.useEffect((()=>{if(!C.isClosePaused&&D!==1/0){const e=(new Date).getTime(),t=_.current,r=window.setTimeout(A,t);return()=>{const o=(new Date).getTime()-e;_.current=t-o,window.clearTimeout(r)}}}),[D,C.isClosePaused,A]),w.useEffect((()=>(k(),()=>L())),[k,L]),C.viewport?/*#__PURE__*/w.createElement(w.Fragment,null,/*#__PURE__*/w.createElement(S,{__scopeToast:r,role:"status","aria-live":"foreground"===o?"assertive":"polite","aria-atomic":!0},e.children),/*#__PURE__*/w.createElement(h,{scope:r,isInteractive:!0,onClose:A},/*#__PURE__*/p.createPortal(/*#__PURE__*/w.createElement(c.Root,{asChild:!0,onEscapeKeyDown:d(u,(()=>{C.isFocusedToastEscapeKeyDownRef.current||A(),C.isFocusedToastEscapeKeyDownRef.current=!1}))},/*#__PURE__*/w.createElement(s.li,f({role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-swipe-direction":C.swipeDirection},x,{ref:g,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:d(e.onKeyDown,(e=>{"Escape"===e.key&&(null==u||u(e.nativeEvent),e.nativeEvent.defaultPrevented||(C.isFocusedToastEscapeKeyDownRef.current=!0,A()))})),onPointerDown:d(e.onPointerDown,(e=>{0===e.button&&(P.current={x:e.clientX,y:e.clientY})})),onPointerMove:d(e.onPointerMove,(e=>{if(!P.current)return;const t=e.clientX-P.current.x,r=e.clientY-P.current.y,o=Boolean(R.current),n=["left","right"].includes(C.swipeDirection),s=["left","up"].includes(C.swipeDirection)?Math.min:Math.max,a=n?s(0,t):0,i=n?0:s(0,r),c="touch"===e.pointerType?10:2,u={x:a,y:i},l={originalEvent:e,delta:u};o?(R.current=u,M("toast.swipeMove",m,l)):q(u,C.swipeDirection,c)?(R.current=u,M("toast.swipeStart",v,l),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(r)>c)&&(P.current=null)})),onPointerUp:d(e.onPointerUp,(e=>{const t=R.current;if(e.target.releasePointerCapture(e.pointerId),R.current=null,P.current=null,t){const r=e.currentTarget,o={originalEvent:e,delta:t};q(t,C.swipeDirection,C.swipeThreshold)?M("toast.swipeEnd",T,o):M("toast.swipeCancel",E,o),r.addEventListener("click",(e=>e.preventDefault()),{once:!0})}}))}))),C.viewport))):null}));R.propTypes={type(e){if(e.type&&!["foreground","background"].includes(e.type)){throw new Error("Invalid prop `type` supplied to `Toast`. Expected `foreground | background`.")}return null}};const S=e=>{const{__scopeToast:o,...s}=e,a=y("Toast",o),[c,u]=w.useState(!1),[l,d]=w.useState(!1);return function(e=(()=>{})){const t=n(e);r((()=>{let e=0,r=0;return e=window.requestAnimationFrame((()=>r=window.requestAnimationFrame(t))),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(r)}}),[t])}((()=>u(!0))),w.useEffect((()=>{const e=window.setTimeout((()=>d(!0)),1e3);return()=>window.clearTimeout(e)}),[]),l?null:/*#__PURE__*/w.createElement(i,{asChild:!0},/*#__PURE__*/w.createElement(t,{asChild:!0},/*#__PURE__*/w.createElement("div",s,c&&/*#__PURE__*/w.createElement(w.Fragment,null,a.label," ",e.children))))},D=/*#__PURE__*/w.forwardRef(((e,t)=>{const{__scopeToast:r,...o}=e;/*#__PURE__*/return w.createElement(s.div,f({},o,{ref:t}))}));exports.ToastTitle=D;const _=/*#__PURE__*/w.forwardRef(((e,t)=>{const{__scopeToast:r,...o}=e;/*#__PURE__*/return w.createElement(s.div,f({},o,{ref:t}))}));exports.ToastDescription=_;const k=/*#__PURE__*/w.forwardRef(((e,t)=>{const{altText:r,...o}=e,n=P("ToastAction",e.__scopeToast);return r?n.isInteractive?/*#__PURE__*/w.createElement(L,f({},o,{ref:t})):/*#__PURE__*/w.createElement("span",null,r):null}));exports.ToastAction=k,k.propTypes={altText(e){if(!e.altText)throw new Error("Missing prop `altText` expected on `ToastAction`");return null}};const L=/*#__PURE__*/w.forwardRef(((e,t)=>{const{__scopeToast:r,...o}=e,n=P("ToastClose",r);return n.isInteractive?/*#__PURE__*/w.createElement(s.button,f({type:"button"},o,{ref:t,onClick:d(e.onClick,n.onClose)})):null}));function M(e,t,r){const o=r.originalEvent.currentTarget,n=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),o.dispatchEvent(n)}exports.ToastClose=L;const q=(e,t,r=0)=>{const o=Math.abs(e.x),n=Math.abs(e.y),s=o>n;return"left"===t||"right"===t?s&&o>r:!s&&n>r};const A=x;exports.Provider=A;const F=b;exports.Viewport=F;const I=g;exports.Root=I;const K=D;exports.Title=K;const V=_;exports.Description=V;const O=k;exports.Action=O;const $=L;exports.Close=$;
var e,t=require("@radix-ui/react-visually-hidden").VisuallyHidden,r=require("@radix-ui/react-use-layout-effect").useLayoutEffect,o=require("@radix-ui/react-use-controllable-state").useControllableState,n=require("@radix-ui/react-use-callback-ref").useCallbackRef,s=require("@radix-ui/react-primitive").Primitive,a=require("@radix-ui/react-presence").Presence,i=require("@radix-ui/react-portal").UnstablePortal,c=f({},require("@radix-ui/react-dismissable-layer")),u=require("@radix-ui/react-context").createContextScope,l=require("@radix-ui/react-compose-refs").useComposedRefs,d=require("@radix-ui/primitive").composeEventHandlers,p=f({},require("react-dom")),w=f({},require("react")),v=(e=require("@babel/runtime/helpers/extends"))&&e.__esModule?e.default:e;function f(e,t){return Object.keys(t).forEach((function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})),e}const[m,E]=u("Toast");exports.createToastScope=E;const[T,y]=m("ToastProvider"),x=e=>{const{__scopeToast:t,label:r="Notification",duration:o=5e3,swipeDirection:n="right",swipeThreshold:s=50,children:a}=e,[i,c]=w.useState(null),[u,l]=w.useState(0),d=w.useRef(!1),p=w.useRef(!1);/*#__PURE__*/return w.createElement(T,{scope:t,label:r,duration:o,swipeDirection:n,swipeThreshold:s,toastCount:u,viewport:i,onViewportChange:c,onToastAdd:w.useCallback((()=>l((e=>e+1))),[]),onToastRemove:w.useCallback((()=>l((e=>e-1))),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:p},a)};exports.ToastProvider=x;const g=["F8"],b=/*#__PURE__*/w.forwardRef(((e,t)=>{const{__scopeToast:r,hotkey:o=g,label:n="Notifications ({hotkey})",...a}=e,i=y("ToastViewport",r),u=w.useRef(null),d=w.useRef(null),p=l(t,d,i.onViewportChange),f=o.join("+").replace(/Key/g,"").replace(/Digit/g,"");return w.useEffect((()=>{const e=e=>{var t;o.every((t=>e[t]||e.code===t))&&(null===(t=d.current)||void 0===t||t.focus())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[o]),w.useEffect((()=>{const e=u.current,t=d.current;if(e&&t){const r=()=>{const e=new Event("toast.viewportPause");t.dispatchEvent(e),i.isClosePausedRef.current=!0},o=()=>{const e=new Event("toast.viewportResume");t.dispatchEvent(e),i.isClosePausedRef.current=!1};return e.addEventListener("focusin",r),e.addEventListener("focusout",o),e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",o),window.addEventListener("blur",r),window.addEventListener("focus",o),()=>{e.removeEventListener("focusin",r),e.removeEventListener("focusout",o),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",o),window.removeEventListener("blur",r),window.removeEventListener("focus",o)}}}),[i.isClosePausedRef]),w.useEffect((()=>{const e=d.current;if(e){let t=[];const r=new MutationObserver((r=>{const[o]=r;o.addedNodes.forEach((r=>{t.includes(r)||(e.prepend(r),t=[...t,r])}))}));return r.observe(e,{childList:!0}),()=>r.disconnect()}}),[]),/*#__PURE__*/w.createElement(c.Branch,{ref:u,role:"region","aria-label":n.replace("{hotkey}",f),tabIndex:-1,style:{pointerEvents:i.toastCount>0?void 0:"none"}},/*#__PURE__*/w.createElement(s.ol,v({tabIndex:-1},a,{ref:p})))}));exports.ToastViewport=b;const h=/*#__PURE__*/w.forwardRef(((e,t)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:i,...c}=e,[u=!0,l]=o({prop:n,defaultProp:s,onChange:i});/*#__PURE__*/return w.createElement(a,{present:r||u},/*#__PURE__*/w.createElement(R,v({open:u},c,{ref:t,onClose:()=>l(!1),onSwipeStart:d(e.onSwipeStart,(e=>{e.currentTarget.setAttribute("data-swipe","start")})),onSwipeMove:d(e.onSwipeMove,(e=>{const{x:t,y:r}=e.detail.delta;e.currentTarget.setAttribute("data-swipe","move"),e.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${t}px`),e.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${r}px`)})),onSwipeCancel:d(e.onSwipeCancel,(e=>{e.currentTarget.setAttribute("data-swipe","cancel"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),e.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")})),onSwipeEnd:d(e.onSwipeEnd,(e=>{const{x:t,y:r}=e.detail.delta;e.currentTarget.setAttribute("data-swipe","end"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),e.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${t}px`),e.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${r}px`),l(!1)}))})))}));exports.Toast=h;const[C,P]=m("Toast",{isInteractive:!1,onClose(){}}),R=/*#__PURE__*/w.forwardRef(((e,t)=>{const{__scopeToast:r,type:o="foreground",duration:a,open:i,onClose:u,onEscapeKeyDown:f,onSwipeStart:m,onSwipeMove:E,onSwipeCancel:T,onSwipeEnd:x,...g}=e,b=y("Toast",r),h=w.useRef(null),P=l(t,h),R=w.useRef(null),D=w.useRef(null),L=a||b.duration,_=w.useRef(0),k=w.useRef(L),A=w.useRef(0),{onToastAdd:F,onToastRemove:I}=b,K=n((()=>{var e,t;(null===(e=h.current)||void 0===e?void 0:e.contains(document.activeElement))&&(null===(t=b.viewport)||void 0===t||t.focus()),u()})),V=w.useCallback((e=>{e&&e!==1/0&&(window.clearTimeout(A.current),_.current=(new Date).getTime(),A.current=window.setTimeout(K,e))}),[K]);return w.useEffect((()=>{const e=b.viewport;if(e){const t=()=>{V(k.current)},r=()=>{const e=(new Date).getTime()-_.current;k.current=k.current-e,window.clearTimeout(A.current)};return e.addEventListener("toast.viewportPause",r),e.addEventListener("toast.viewportResume",t),()=>{e.removeEventListener("toast.viewportPause",r),e.removeEventListener("toast.viewportResume",t)}}}),[b.viewport,L,V]),w.useEffect((()=>{i&&!b.isClosePausedRef.current&&V(L)}),[i,L,b.isClosePausedRef,V]),w.useEffect((()=>(F(),()=>I())),[F,I]),b.viewport?/*#__PURE__*/w.createElement(w.Fragment,null,/*#__PURE__*/w.createElement(S,{__scopeToast:r,role:"status","aria-live":"foreground"===o?"assertive":"polite","aria-atomic":!0},e.children),/*#__PURE__*/w.createElement(C,{scope:r,isInteractive:!0,onClose:K},/*#__PURE__*/p.createPortal(/*#__PURE__*/w.createElement(c.Root,{asChild:!0,onEscapeKeyDown:d(f,(()=>{b.isFocusedToastEscapeKeyDownRef.current||K(),b.isFocusedToastEscapeKeyDownRef.current=!1}))},/*#__PURE__*/w.createElement(s.li,v({role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":b.swipeDirection},g,{ref:P,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:d(e.onKeyDown,(e=>{"Escape"===e.key&&(null==f||f(e.nativeEvent),e.nativeEvent.defaultPrevented||(b.isFocusedToastEscapeKeyDownRef.current=!0,K()))})),onPointerDown:d(e.onPointerDown,(e=>{0===e.button&&(R.current={x:e.clientX,y:e.clientY})})),onPointerMove:d(e.onPointerMove,(e=>{if(!R.current)return;const t=e.clientX-R.current.x,r=e.clientY-R.current.y,o=Boolean(D.current),n=["left","right"].includes(b.swipeDirection),s=["left","up"].includes(b.swipeDirection)?Math.min:Math.max,a=n?s(0,t):0,i=n?0:s(0,r),c="touch"===e.pointerType?10:2,u={x:a,y:i},l={originalEvent:e,delta:u};o?(D.current=u,M("toast.swipeMove",E,l)):q(u,b.swipeDirection,c)?(D.current=u,M("toast.swipeStart",m,l),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(r)>c)&&(R.current=null)})),onPointerUp:d(e.onPointerUp,(e=>{const t=D.current;if(e.target.releasePointerCapture(e.pointerId),D.current=null,R.current=null,t){const r=e.currentTarget,o={originalEvent:e,delta:t};q(t,b.swipeDirection,b.swipeThreshold)?M("toast.swipeEnd",x,o):M("toast.swipeCancel",T,o),r.addEventListener("click",(e=>e.preventDefault()),{once:!0})}}))}))),b.viewport))):null}));R.propTypes={type(e){if(e.type&&!["foreground","background"].includes(e.type)){throw new Error("Invalid prop `type` supplied to `Toast`. Expected `foreground | background`.")}return null}};const S=e=>{const{__scopeToast:o,...s}=e,a=y("Toast",o),[c,u]=w.useState(!1),[l,d]=w.useState(!1);return function(e=(()=>{})){const t=n(e);r((()=>{let e=0,r=0;return e=window.requestAnimationFrame((()=>r=window.requestAnimationFrame(t))),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(r)}}),[t])}((()=>u(!0))),w.useEffect((()=>{const e=window.setTimeout((()=>d(!0)),1e3);return()=>window.clearTimeout(e)}),[]),l?null:/*#__PURE__*/w.createElement(i,{asChild:!0},/*#__PURE__*/w.createElement(t,{asChild:!0},/*#__PURE__*/w.createElement("div",s,c&&/*#__PURE__*/w.createElement(w.Fragment,null,a.label," ",e.children))))},D=/*#__PURE__*/w.forwardRef(((e,t)=>{const{__scopeToast:r,...o}=e;/*#__PURE__*/return w.createElement(s.div,v({},o,{ref:t}))}));exports.ToastTitle=D;const L=/*#__PURE__*/w.forwardRef(((e,t)=>{const{__scopeToast:r,...o}=e;/*#__PURE__*/return w.createElement(s.div,v({},o,{ref:t}))}));exports.ToastDescription=L;const _=/*#__PURE__*/w.forwardRef(((e,t)=>{const{altText:r,...o}=e,n=P("ToastAction",e.__scopeToast);return r?n.isInteractive?/*#__PURE__*/w.createElement(k,v({},o,{ref:t})):/*#__PURE__*/w.createElement("span",null,r):null}));exports.ToastAction=_,_.propTypes={altText(e){if(!e.altText)throw new Error("Missing prop `altText` expected on `ToastAction`");return null}};const k=/*#__PURE__*/w.forwardRef(((e,t)=>{const{__scopeToast:r,...o}=e,n=P("ToastClose",r);return n.isInteractive?/*#__PURE__*/w.createElement(s.button,v({type:"button"},o,{ref:t,onClick:d(e.onClick,n.onClose)})):null}));function M(e,t,r){const o=r.originalEvent.currentTarget,n=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),o.dispatchEvent(n)}exports.ToastClose=k;const q=(e,t,r=0)=>{const o=Math.abs(e.x),n=Math.abs(e.y),s=o>n;return"left"===t||"right"===t?s&&o>r:!s&&n>r};const A=x;exports.Provider=A;const F=b;exports.Viewport=F;const I=h;exports.Root=I;const K=D;exports.Title=K;const V=L;exports.Description=V;const O=_;exports.Action=O;const $=k;exports.Close=$;
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import{VisuallyHidden as e}from"@radix-ui/react-visually-hidden";import{useLayoutEffect as t}from"@radix-ui/react-use-layout-effect";import{useControllableState as o}from"@radix-ui/react-use-controllable-state";import{useCallbackRef as r}from"@radix-ui/react-use-callback-ref";import{Primitive as n}from"@radix-ui/react-primitive";import{Presence as s}from"@radix-ui/react-presence";import{UnstablePortal as a}from"@radix-ui/react-portal";import*as i from"@radix-ui/react-dismissable-layer";import{createContextScope as c}from"@radix-ui/react-context";import{useComposedRefs as l}from"@radix-ui/react-compose-refs";import{composeEventHandlers as u}from"@radix-ui/primitive";import*as p from"react-dom";import*as d from"react";import m from"@babel/runtime/helpers/esm/extends";const[w,f]=c("Toast");export{f as createToastScope};const[v,T]=w("ToastProvider");export const ToastProvider=e=>{const{__scopeToast:t,label:o="Notification",duration:r=5e3,swipeDirection:n="right",swipeThreshold:s=50,children:a}=e,[i,c]=d.useState(null),[l,u]=d.useState(!1),[p,m]=d.useState(0),w=d.useRef(!1);/*#__PURE__*/return d.createElement(v,{scope:t,label:o,duration:r,swipeDirection:n,swipeThreshold:s,toastCount:p,viewport:i,onViewportChange:c,isClosePaused:l,onClosePause:d.useCallback((()=>u(!0)),[]),onCloseResume:d.useCallback((()=>u(!1)),[]),onToastAdd:d.useCallback((()=>m((e=>e+1))),[]),onToastRemove:d.useCallback((()=>m((e=>e-1))),[]),isFocusedToastEscapeKeyDownRef:w},a)};/*#__PURE__*/const E=["F8"];export const ToastViewport=/*#__PURE__*/d.forwardRef(((e,t)=>{const{__scopeToast:o,hotkey:r=E,label:s="Notifications ({hotkey})",...a}=e,c=T("ToastViewport",o),u=d.useRef(null),p=d.useRef(null),w=l(t,p,c.onViewportChange),f=r.join("+").replace(/Key/g,"").replace(/Digit/g,"");return d.useEffect((()=>{const e=e=>{var t;r.every((t=>e[t]||e.code===t))&&(null===(t=p.current)||void 0===t||t.focus())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[r]),d.useEffect((()=>{const e=u.current;if(e)return e.addEventListener("focusin",c.onClosePause),e.addEventListener("focusout",c.onCloseResume),e.addEventListener("pointerenter",c.onClosePause),e.addEventListener("pointerleave",c.onCloseResume),window.addEventListener("blur",c.onClosePause),window.addEventListener("focus",c.onCloseResume),()=>{e.removeEventListener("focusin",c.onClosePause),e.removeEventListener("focusout",c.onCloseResume),e.removeEventListener("pointerenter",c.onClosePause),e.removeEventListener("pointerleave",c.onCloseResume),window.removeEventListener("blur",c.onClosePause),window.removeEventListener("focus",c.onCloseResume)}}),[c.onCloseResume,c.onClosePause]),d.useEffect((()=>{const e=p.current;if(e){let t=[];const o=new MutationObserver((o=>{const[r]=o;r.addedNodes.forEach((o=>{t.includes(o)||(e.prepend(o),t=[...t,o])}))}));return o.observe(e,{childList:!0}),()=>o.disconnect()}}),[]),/*#__PURE__*/d.createElement(i.Branch,{ref:u,role:"region","aria-label":s.replace("{hotkey}",f),tabIndex:-1,style:{pointerEvents:c.toastCount>0?void 0:"none"}},/*#__PURE__*/d.createElement(n.ol,m({tabIndex:-1},a,{ref:w})))}));/*#__PURE__*/export const Toast=/*#__PURE__*/d.forwardRef(((e,t)=>{const{forceMount:r,open:n,defaultOpen:a,onOpenChange:i,...c}=e,[l=!0,p]=o({prop:n,defaultProp:a,onChange:i});/*#__PURE__*/return d.createElement(s,{present:r||l},/*#__PURE__*/d.createElement(C,m({"data-state":l?"open":"closed"},c,{ref:t,onClose:()=>p(!1),onSwipeStart:u(e.onSwipeStart,(e=>{e.currentTarget.setAttribute("data-swipe","start")})),onSwipeMove:u(e.onSwipeMove,(e=>{const{x:t,y:o}=e.detail.delta;e.currentTarget.setAttribute("data-swipe","move"),e.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${t}px`),e.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${o}px`)})),onSwipeCancel:u(e.onSwipeCancel,(e=>{e.currentTarget.setAttribute("data-swipe","cancel"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),e.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")})),onSwipeEnd:u(e.onSwipeEnd,(e=>{const{x:t,y:o}=e.detail.delta;e.currentTarget.setAttribute("data-swipe","end"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),e.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${t}px`),e.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${o}px`),p(!1)}))})))}));/*#__PURE__*/const[x,y]=w("Toast",{isInteractive:!1,onClose(){}}),C=/*#__PURE__*/d.forwardRef(((e,t)=>{const{__scopeToast:o,type:s="foreground",duration:a,onClose:c,onEscapeKeyDown:w,onSwipeStart:f,onSwipeMove:v,onSwipeCancel:E,onSwipeEnd:y,...C}=e,P=T("Toast",o),R=d.useRef(null),D=l(t,R),S=d.useRef(null),_=d.useRef(null),A=a||P.duration,L=d.useRef(A),{onToastAdd:k,onToastRemove:M}=P,F=r((()=>{var e,t;(null===(e=R.current)||void 0===e?void 0:e.contains(document.activeElement))&&(null===(t=P.viewport)||void 0===t||t.focus()),c()}));return d.useEffect((()=>{L.current=A}),[A]),d.useEffect((()=>{if(!P.isClosePaused&&A!==1/0){const e=(new Date).getTime(),t=L.current,o=window.setTimeout(F,t);return()=>{const r=(new Date).getTime()-e;L.current=t-r,window.clearTimeout(o)}}}),[A,P.isClosePaused,F]),d.useEffect((()=>(k(),()=>M())),[k,M]),P.viewport?/*#__PURE__*/d.createElement(d.Fragment,null,/*#__PURE__*/d.createElement(g,{__scopeToast:o,role:"status","aria-live":"foreground"===s?"assertive":"polite","aria-atomic":!0},e.children),/*#__PURE__*/d.createElement(x,{scope:o,isInteractive:!0,onClose:F},/*#__PURE__*/p.createPortal(/*#__PURE__*/d.createElement(i.Root,{asChild:!0,onEscapeKeyDown:u(w,(()=>{P.isFocusedToastEscapeKeyDownRef.current||F(),P.isFocusedToastEscapeKeyDownRef.current=!1}))},/*#__PURE__*/d.createElement(n.li,m({role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-swipe-direction":P.swipeDirection},C,{ref:D,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:u(e.onKeyDown,(e=>{"Escape"===e.key&&(null==w||w(e.nativeEvent),e.nativeEvent.defaultPrevented||(P.isFocusedToastEscapeKeyDownRef.current=!0,F()))})),onPointerDown:u(e.onPointerDown,(e=>{0===e.button&&(S.current={x:e.clientX,y:e.clientY})})),onPointerMove:u(e.onPointerMove,(e=>{if(!S.current)return;const t=e.clientX-S.current.x,o=e.clientY-S.current.y,r=Boolean(_.current),n=["left","right"].includes(P.swipeDirection),s=["left","up"].includes(P.swipeDirection)?Math.min:Math.max,a=n?s(0,t):0,i=n?0:s(0,o),c="touch"===e.pointerType?10:2,l={x:a,y:i},u={originalEvent:e,delta:l};r?(_.current=l,b("toast.swipeMove",v,u)):h(l,P.swipeDirection,c)?(_.current=l,b("toast.swipeStart",f,u),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(o)>c)&&(S.current=null)})),onPointerUp:u(e.onPointerUp,(e=>{const t=_.current;if(e.target.releasePointerCapture(e.pointerId),_.current=null,S.current=null,t){const o=e.currentTarget,r={originalEvent:e,delta:t};h(t,P.swipeDirection,P.swipeThreshold)?b("toast.swipeEnd",y,r):b("toast.swipeCancel",E,r),o.addEventListener("click",(e=>e.preventDefault()),{once:!0})}}))}))),P.viewport))):null}));C.propTypes={type(e){if(e.type&&!["foreground","background"].includes(e.type)){throw new Error("Invalid prop `type` supplied to `Toast`. Expected `foreground | background`.")}return null}};const g=o=>{const{__scopeToast:n,...s}=o,i=T("Toast",n),[c,l]=d.useState(!1),[u,p]=d.useState(!1);return function(e=(()=>{})){const o=r(e);t((()=>{let e=0,t=0;return e=window.requestAnimationFrame((()=>t=window.requestAnimationFrame(o))),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(t)}}),[o])}((()=>l(!0))),d.useEffect((()=>{const e=window.setTimeout((()=>p(!0)),1e3);return()=>window.clearTimeout(e)}),[]),u?null:/*#__PURE__*/d.createElement(a,{asChild:!0},/*#__PURE__*/d.createElement(e,{asChild:!0},/*#__PURE__*/d.createElement("div",s,c&&/*#__PURE__*/d.createElement(d.Fragment,null,i.label," ",o.children))))};export const ToastTitle=/*#__PURE__*/d.forwardRef(((e,t)=>{const{__scopeToast:o,...r}=e;/*#__PURE__*/return d.createElement(n.div,m({},r,{ref:t}))}));/*#__PURE__*/export const ToastDescription=/*#__PURE__*/d.forwardRef(((e,t)=>{const{__scopeToast:o,...r}=e;/*#__PURE__*/return d.createElement(n.div,m({},r,{ref:t}))}));/*#__PURE__*/export const ToastAction=/*#__PURE__*/d.forwardRef(((e,t)=>{const{altText:o,...r}=e,n=y("ToastAction",e.__scopeToast);return o?n.isInteractive?/*#__PURE__*/d.createElement(ToastClose,m({},r,{ref:t})):/*#__PURE__*/d.createElement("span",null,o):null}));ToastAction.propTypes={altText(e){if(!e.altText)throw new Error("Missing prop `altText` expected on `ToastAction`");return null}};export const ToastClose=/*#__PURE__*/d.forwardRef(((e,t)=>{const{__scopeToast:o,...r}=e,s=y("ToastClose",o);return s.isInteractive?/*#__PURE__*/d.createElement(n.button,m({type:"button"},r,{ref:t,onClick:u(e.onClick,s.onClose)})):null}));/*#__PURE__*/function b(e,t,o){const r=o.originalEvent.currentTarget,n=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:o});t&&r.addEventListener(e,t,{once:!0}),r.dispatchEvent(n)}const h=(e,t,o=0)=>{const r=Math.abs(e.x),n=Math.abs(e.y),s=r>n;return"left"===t||"right"===t?s&&r>o:!s&&n>o};export const Provider=ToastProvider;export const Viewport=ToastViewport;export const Root=Toast;export const Title=ToastTitle;export const Description=ToastDescription;export const Action=ToastAction;export const Close=ToastClose;
import{VisuallyHidden as e}from"@radix-ui/react-visually-hidden";import{useLayoutEffect as t}from"@radix-ui/react-use-layout-effect";import{useControllableState as r}from"@radix-ui/react-use-controllable-state";import{useCallbackRef as o}from"@radix-ui/react-use-callback-ref";import{Primitive as n}from"@radix-ui/react-primitive";import{Presence as s}from"@radix-ui/react-presence";import{UnstablePortal as a}from"@radix-ui/react-portal";import*as i from"@radix-ui/react-dismissable-layer";import{createContextScope as c}from"@radix-ui/react-context";import{useComposedRefs as u}from"@radix-ui/react-compose-refs";import{composeEventHandlers as l}from"@radix-ui/primitive";import*as p from"react-dom";import*as d from"react";import w from"@babel/runtime/helpers/esm/extends";const[v,f]=c("Toast");export{f as createToastScope};const[m,T]=v("ToastProvider");export const ToastProvider=e=>{const{__scopeToast:t,label:r="Notification",duration:o=5e3,swipeDirection:n="right",swipeThreshold:s=50,children:a}=e,[i,c]=d.useState(null),[u,l]=d.useState(0),p=d.useRef(!1),w=d.useRef(!1);/*#__PURE__*/return d.createElement(m,{scope:t,label:r,duration:o,swipeDirection:n,swipeThreshold:s,toastCount:u,viewport:i,onViewportChange:c,onToastAdd:d.useCallback((()=>l((e=>e+1))),[]),onToastRemove:d.useCallback((()=>l((e=>e-1))),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:w},a)};/*#__PURE__*/const E=["F8"];export const ToastViewport=/*#__PURE__*/d.forwardRef(((e,t)=>{const{__scopeToast:r,hotkey:o=E,label:s="Notifications ({hotkey})",...a}=e,c=T("ToastViewport",r),l=d.useRef(null),p=d.useRef(null),v=u(t,p,c.onViewportChange),f=o.join("+").replace(/Key/g,"").replace(/Digit/g,"");return d.useEffect((()=>{const e=e=>{var t;o.every((t=>e[t]||e.code===t))&&(null===(t=p.current)||void 0===t||t.focus())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)}),[o]),d.useEffect((()=>{const e=l.current,t=p.current;if(e&&t){const r=()=>{const e=new Event("toast.viewportPause");t.dispatchEvent(e),c.isClosePausedRef.current=!0},o=()=>{const e=new Event("toast.viewportResume");t.dispatchEvent(e),c.isClosePausedRef.current=!1};return e.addEventListener("focusin",r),e.addEventListener("focusout",o),e.addEventListener("pointerenter",r),e.addEventListener("pointerleave",o),window.addEventListener("blur",r),window.addEventListener("focus",o),()=>{e.removeEventListener("focusin",r),e.removeEventListener("focusout",o),e.removeEventListener("pointerenter",r),e.removeEventListener("pointerleave",o),window.removeEventListener("blur",r),window.removeEventListener("focus",o)}}}),[c.isClosePausedRef]),d.useEffect((()=>{const e=p.current;if(e){let t=[];const r=new MutationObserver((r=>{const[o]=r;o.addedNodes.forEach((r=>{t.includes(r)||(e.prepend(r),t=[...t,r])}))}));return r.observe(e,{childList:!0}),()=>r.disconnect()}}),[]),/*#__PURE__*/d.createElement(i.Branch,{ref:l,role:"region","aria-label":s.replace("{hotkey}",f),tabIndex:-1,style:{pointerEvents:c.toastCount>0?void 0:"none"}},/*#__PURE__*/d.createElement(n.ol,w({tabIndex:-1},a,{ref:v})))}));/*#__PURE__*/export const Toast=/*#__PURE__*/d.forwardRef(((e,t)=>{const{forceMount:o,open:n,defaultOpen:a,onOpenChange:i,...c}=e,[u=!0,p]=r({prop:n,defaultProp:a,onChange:i});/*#__PURE__*/return d.createElement(s,{present:o||u},/*#__PURE__*/d.createElement(g,w({open:u},c,{ref:t,onClose:()=>p(!1),onSwipeStart:l(e.onSwipeStart,(e=>{e.currentTarget.setAttribute("data-swipe","start")})),onSwipeMove:l(e.onSwipeMove,(e=>{const{x:t,y:r}=e.detail.delta;e.currentTarget.setAttribute("data-swipe","move"),e.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${t}px`),e.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${r}px`)})),onSwipeCancel:l(e.onSwipeCancel,(e=>{e.currentTarget.setAttribute("data-swipe","cancel"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),e.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")})),onSwipeEnd:l(e.onSwipeEnd,(e=>{const{x:t,y:r}=e.detail.delta;e.currentTarget.setAttribute("data-swipe","end"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),e.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),e.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${t}px`),e.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${r}px`),p(!1)}))})))}));/*#__PURE__*/const[x,y]=v("Toast",{isInteractive:!1,onClose(){}}),g=/*#__PURE__*/d.forwardRef(((e,t)=>{const{__scopeToast:r,type:s="foreground",duration:a,open:c,onClose:v,onEscapeKeyDown:f,onSwipeStart:m,onSwipeMove:E,onSwipeCancel:y,onSwipeEnd:g,...P}=e,R=T("Toast",r),D=d.useRef(null),L=u(t,D),S=d.useRef(null),_=d.useRef(null),A=a||R.duration,k=d.useRef(0),M=d.useRef(A),F=d.useRef(0),{onToastAdd:I,onToastRemove:K}=R,V=o((()=>{var e,t;(null===(e=D.current)||void 0===e?void 0:e.contains(document.activeElement))&&(null===(t=R.viewport)||void 0===t||t.focus()),v()})),$=d.useCallback((e=>{e&&e!==1/0&&(window.clearTimeout(F.current),k.current=(new Date).getTime(),F.current=window.setTimeout(V,e))}),[V]);return d.useEffect((()=>{const e=R.viewport;if(e){const t=()=>{$(M.current)},r=()=>{const e=(new Date).getTime()-k.current;M.current=M.current-e,window.clearTimeout(F.current)};return e.addEventListener("toast.viewportPause",r),e.addEventListener("toast.viewportResume",t),()=>{e.removeEventListener("toast.viewportPause",r),e.removeEventListener("toast.viewportResume",t)}}}),[R.viewport,A,$]),d.useEffect((()=>{c&&!R.isClosePausedRef.current&&$(A)}),[c,A,R.isClosePausedRef,$]),d.useEffect((()=>(I(),()=>K())),[I,K]),R.viewport?/*#__PURE__*/d.createElement(d.Fragment,null,/*#__PURE__*/d.createElement(h,{__scopeToast:r,role:"status","aria-live":"foreground"===s?"assertive":"polite","aria-atomic":!0},e.children),/*#__PURE__*/d.createElement(x,{scope:r,isInteractive:!0,onClose:V},/*#__PURE__*/p.createPortal(/*#__PURE__*/d.createElement(i.Root,{asChild:!0,onEscapeKeyDown:l(f,(()=>{R.isFocusedToastEscapeKeyDownRef.current||V(),R.isFocusedToastEscapeKeyDownRef.current=!1}))},/*#__PURE__*/d.createElement(n.li,w({role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":c?"open":"closed","data-swipe-direction":R.swipeDirection},P,{ref:L,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:l(e.onKeyDown,(e=>{"Escape"===e.key&&(null==f||f(e.nativeEvent),e.nativeEvent.defaultPrevented||(R.isFocusedToastEscapeKeyDownRef.current=!0,V()))})),onPointerDown:l(e.onPointerDown,(e=>{0===e.button&&(S.current={x:e.clientX,y:e.clientY})})),onPointerMove:l(e.onPointerMove,(e=>{if(!S.current)return;const t=e.clientX-S.current.x,r=e.clientY-S.current.y,o=Boolean(_.current),n=["left","right"].includes(R.swipeDirection),s=["left","up"].includes(R.swipeDirection)?Math.min:Math.max,a=n?s(0,t):0,i=n?0:s(0,r),c="touch"===e.pointerType?10:2,u={x:a,y:i},l={originalEvent:e,delta:u};o?(_.current=u,b("toast.swipeMove",E,l)):C(u,R.swipeDirection,c)?(_.current=u,b("toast.swipeStart",m,l),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(r)>c)&&(S.current=null)})),onPointerUp:l(e.onPointerUp,(e=>{const t=_.current;if(e.target.releasePointerCapture(e.pointerId),_.current=null,S.current=null,t){const r=e.currentTarget,o={originalEvent:e,delta:t};C(t,R.swipeDirection,R.swipeThreshold)?b("toast.swipeEnd",g,o):b("toast.swipeCancel",y,o),r.addEventListener("click",(e=>e.preventDefault()),{once:!0})}}))}))),R.viewport))):null}));g.propTypes={type(e){if(e.type&&!["foreground","background"].includes(e.type)){throw new Error("Invalid prop `type` supplied to `Toast`. Expected `foreground | background`.")}return null}};const h=r=>{const{__scopeToast:n,...s}=r,i=T("Toast",n),[c,u]=d.useState(!1),[l,p]=d.useState(!1);return function(e=(()=>{})){const r=o(e);t((()=>{let e=0,t=0;return e=window.requestAnimationFrame((()=>t=window.requestAnimationFrame(r))),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(t)}}),[r])}((()=>u(!0))),d.useEffect((()=>{const e=window.setTimeout((()=>p(!0)),1e3);return()=>window.clearTimeout(e)}),[]),l?null:/*#__PURE__*/d.createElement(a,{asChild:!0},/*#__PURE__*/d.createElement(e,{asChild:!0},/*#__PURE__*/d.createElement("div",s,c&&/*#__PURE__*/d.createElement(d.Fragment,null,i.label," ",r.children))))};export const ToastTitle=/*#__PURE__*/d.forwardRef(((e,t)=>{const{__scopeToast:r,...o}=e;/*#__PURE__*/return d.createElement(n.div,w({},o,{ref:t}))}));/*#__PURE__*/export const ToastDescription=/*#__PURE__*/d.forwardRef(((e,t)=>{const{__scopeToast:r,...o}=e;/*#__PURE__*/return d.createElement(n.div,w({},o,{ref:t}))}));/*#__PURE__*/export const ToastAction=/*#__PURE__*/d.forwardRef(((e,t)=>{const{altText:r,...o}=e,n=y("ToastAction",e.__scopeToast);return r?n.isInteractive?/*#__PURE__*/d.createElement(ToastClose,w({},o,{ref:t})):/*#__PURE__*/d.createElement("span",null,r):null}));ToastAction.propTypes={altText(e){if(!e.altText)throw new Error("Missing prop `altText` expected on `ToastAction`");return null}};export const ToastClose=/*#__PURE__*/d.forwardRef(((e,t)=>{const{__scopeToast:r,...o}=e,s=y("ToastClose",r);return s.isInteractive?/*#__PURE__*/d.createElement(n.button,w({type:"button"},o,{ref:t,onClick:l(e.onClick,s.onClose)})):null}));/*#__PURE__*/function b(e,t,r){const o=r.originalEvent.currentTarget,n=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),o.dispatchEvent(n)}const C=(e,t,r=0)=>{const o=Math.abs(e.x),n=Math.abs(e.y),s=o>n;return"left"===t||"right"===t?s&&o>r:!s&&n>r};export const Provider=ToastProvider;export const Viewport=ToastViewport;export const Root=Toast;export const Title=ToastTitle;export const Description=ToastDescription;export const Action=ToastAction;export const Close=ToastClose;
//# sourceMappingURL=index.module.js.map
{
"name": "@radix-ui/react-toast",
"version": "0.0.1-rc.6",
"version": "0.0.1-rc.7",
"license": "MIT",

@@ -23,10 +23,10 @@ "source": "src/index.ts",

"@radix-ui/react-context": "0.1.1",
"@radix-ui/react-dismissable-layer": "0.1.4-rc.25",
"@radix-ui/react-portal": "0.1.4-rc.25",
"@radix-ui/react-presence": "0.1.2-rc.17",
"@radix-ui/react-primitive": "0.1.4-rc.25",
"@radix-ui/react-dismissable-layer": "0.1.4-rc.26",
"@radix-ui/react-portal": "0.1.4-rc.26",
"@radix-ui/react-presence": "0.1.2-rc.18",
"@radix-ui/react-primitive": "0.1.4-rc.26",
"@radix-ui/react-use-callback-ref": "0.1.0",
"@radix-ui/react-use-controllable-state": "0.1.0",
"@radix-ui/react-use-layout-effect": "0.1.0",
"@radix-ui/react-visually-hidden": "0.1.4-rc.25"
"@radix-ui/react-visually-hidden": "0.1.4-rc.26"
},

@@ -33,0 +33,0 @@ "peerDependencies": {

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