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

vaul

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vaul - npm Package Compare versions

Comparing version 0.6.6 to 0.6.7

3

dist/index.d.ts

@@ -25,3 +25,2 @@ import * as DialogPrimitive from '@radix-ui/react-dialog';

onRelease?: (event: React.PointerEvent<HTMLDivElement>, open: boolean) => void;
experimentalSafariThemeAnimation?: boolean;
modal?: boolean;

@@ -31,3 +30,3 @@ nested?: boolean;

} & (WithFadeFromProps | WithoutFadeFromProps);
declare function Root({ open: openProp, onOpenChange, children, shouldScaleBackground, onDrag: onDragProp, onRelease: onReleaseProp, experimentalSafariThemeAnimation, snapPoints, nested, closeThreshold, scrollLockTimeout, dismissible, fadeFromIndex, activeSnapPoint: activeSnapPointProp, setActiveSnapPoint: setActiveSnapPointProp, fixed, modal, onClose, }: DialogProps): React.JSX.Element;
declare function Root({ open: openProp, onOpenChange, children, shouldScaleBackground, onDrag: onDragProp, onRelease: onReleaseProp, snapPoints, nested, closeThreshold, scrollLockTimeout, dismissible, fadeFromIndex, activeSnapPoint: activeSnapPointProp, setActiveSnapPoint: setActiveSnapPointProp, fixed, modal, onClose, }: DialogProps): React.JSX.Element;
declare function NestedRoot({ children, onDrag, onOpenChange, ...rest }: DialogProps): React.JSX.Element;

@@ -34,0 +33,0 @@ declare const Drawer: {

"use client"
"use client";var mt=Object.create;var ae=Object.defineProperty;var pt=Object.getOwnPropertyDescriptor;var gt=Object.getOwnPropertyNames;var bt=Object.getPrototypeOf,vt=Object.prototype.hasOwnProperty;var ht=(e,n)=>{for(var t in n)ae(e,t,{get:n[t],enumerable:!0})},Pe=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of gt(n))!vt.call(e,l)&&l!==t&&ae(e,l,{get:()=>n[l],enumerable:!(r=pt(n,l))||r.enumerable});return e};var W=(e,n,t)=>(t=e!=null?mt(bt(e)):{},Pe(n||!e||!e.__esModule?ae(t,"default",{value:e,enumerable:!0}):t,e)),wt=e=>Pe(ae({},"__esModule",{value:!0}),e);var $t={};ht($t,{Drawer:()=>It});module.exports=wt($t);var S=W(require("@radix-ui/react-dialog")),m=W(require("react"));var he=W(require("react")),we=he.default.createContext({drawerRef:{current:null},overlayRef:{current:null},scaleBackground:()=>{},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},dismissible:!1,isOpen:!1,keyboardIsOpen:{current:!1},experimentalSafariThemeAnimation:!1,snapPointsOffset:null,snapPoints:null,modal:!1,shouldFade:!1,activeSnapPoint:null,setActiveSnapPoint:()=>{},visible:!1,closeDrawer:()=>{},setVisible:()=>{}}),le=()=>he.default.useContext(we);function Te(e,{insertAt:n}={}){if(!e||typeof document=="undefined")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",n==="top"&&t.firstChild?t.insertBefore(r,t.firstChild):t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}Te(`[vaul-drawer]{touch-action:none;transform:translate3d(0,100%,0);transition:transform .5s cubic-bezier(.32,.72,0,1)}[vaul-drawer][vaul-drawer-visible=true]{transform:translate3d(0,var(--snap-point-height, 0),0)}[vaul-overlay]{opacity:0;transition:opacity .5s cubic-bezier(.32,.72,0,1)}[vaul-overlay][vaul-drawer-visible=true]{opacity:1}[vaul-overlay][vaul-theme-transition=true]{opacity:1;background:transparent}[vaul-drawer]:after{content:"";position:absolute;top:100%;background:inherit;background-color:inherit;left:0;right:0;height:200%}[vaul-overlay][vaul-snap-points=true]:not([vaul-snap-points-overlay="true"]):not([data-state="closed"]){opacity:0}[vaul-overlay][vaul-snap-points-overlay=true]:not([vaul-drawer-visible="false"]){opacity:1}@keyframes fake-animation{}@keyframes show-theme-overlay{0%{background:var(--vaul-overlay-background-start)}to{background:var(--vaul-overlay-background-end)}}@keyframes hide-theme-overlay{0%{background:var(--vaul-overlay-background-end)}to{background:var(--vaul-overlay-background-start)}}@media (hover: hover) and (pointer: fine){[vaul-drawer]{user-select:none}}
`);var ce=require("react"),Tt=typeof window!="undefined"?ce.useLayoutEffect:ce.useEffect;function De(...e){return(...n)=>{for(let t of e)typeof t=="function"&&t(...n)}}function yt(){return Re(/^Mac/)}function Et(){return Re(/^iPhone/)}function Dt(){return Re(/^iPad/)||yt()&&navigator.maxTouchPoints>1}function Se(){return Et()||Dt()}function Re(e){return typeof window!="undefined"&&window.navigator!=null?e.test(window.navigator.platform):void 0}var ye=typeof document!="undefined"&&window.visualViewport;function ke(e){let n=window.getComputedStyle(e);return/(auto|scroll)/.test(n.overflow+n.overflowX+n.overflowY)}function Ve(e){for(ke(e)&&(e=e.parentElement);e&&!ke(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}var St=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),se=0,Ee;function je(e={}){let{isDisabled:n}=e;Tt(()=>{if(!n)return se++,se===1&&(Se()?Ee=xt():Ee=Rt()),()=>{se--,se===0&&Ee()}},[n])}function Rt(){return De(ue(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`),ue(document.documentElement,"overflow","hidden"))}function xt(){let e,n=0,t=c=>{e=Ve(c.target),!(e===document.documentElement&&e===document.body)&&(n=c.changedTouches[0].pageY)},r=c=>{if(!e||e===document.documentElement||e===document.body){c.preventDefault();return}let o=c.changedTouches[0].pageY,C=e.scrollTop,x=e.scrollHeight-e.clientHeight;x!==0&&((C<=0&&o>n||C>=x&&o<n)&&c.preventDefault(),n=o)},l=c=>{let o=c.target;Z(o)&&o!==document.activeElement&&(c.preventDefault(),o.style.transform="translateY(-2000px)",o.focus(),requestAnimationFrame(()=>{o.style.transform=""}))},a=c=>{let o=c.target;Z(o)&&(o.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{o.style.transform="",ye&&(ye.height<window.innerHeight?requestAnimationFrame(()=>{Fe(o)}):ye.addEventListener("resize",()=>Fe(o),{once:!0}))}))},g=()=>{window.scrollTo(0,0)},i=window.pageXOffset,y=window.pageYOffset,D=De(ue(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`),ue(document.documentElement,"overflow","hidden"));window.scrollTo(0,0);let H=De(Q(document,"touchstart",t,{passive:!1,capture:!0}),Q(document,"touchmove",r,{passive:!1,capture:!0}),Q(document,"touchend",l,{passive:!1,capture:!0}),Q(document,"focus",a,!0),Q(window,"scroll",g));return()=>{D(),H(),window.scrollTo(i,y)}}function ue(e,n,t){let r=e.style[n];return e.style[n]=t,()=>{e.style[n]=r}}function Q(e,n,t,r){return e.addEventListener(n,t,r),()=>{e.removeEventListener(n,t,r)}}function Fe(e){let n=document.scrollingElement||document.documentElement;for(;e&&e!==n;){let t=Ve(e);if(t!==document.documentElement&&t!==document.body&&t!==e){let r=t.getBoundingClientRect().top,l=e.getBoundingClientRect().top,a=e.getBoundingClientRect().bottom,g=t.getBoundingClientRect().bottom;a>g&&(t.scrollTop+=l-r)}e=t.parentElement}}function Z(e){return e instanceof HTMLInputElement&&!St.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}var We=W(require("react"));function Mt(e,n){typeof e=="function"?e(n):e!=null&&(e.current=n)}function Ht(...e){return n=>e.forEach(t=>Mt(t,n))}function xe(...e){return We.useCallback(Ht(...e),e)}var fe=W(require("react")),F=null;function Ue({isOpen:e,modal:n,nested:t}){let r=fe.default.useRef(0);function l(){if(F===null){F={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height};let{scrollX:g,innerHeight:i}=window;document.body.style.setProperty("position","fixed","important"),document.body.style.top=`${-r.current}px`,document.body.style.left=`${-g}px`,document.body.style.right="0px",document.body.style.height="auto",setTimeout(()=>requestAnimationFrame(()=>{let y=i-window.innerHeight;y&&r.current>=i&&(document.body.style.top=`${-(r.current+y)}px`)}),300)}}function a(){if(F!==null){let g=-parseInt(document.body.style.top,10),i=-parseInt(document.body.style.left,10);document.body.style.position=F.position,document.body.style.top=F.top,document.body.style.left=F.left,document.body.style.height=F.height,document.body.style.right="unset",requestAnimationFrame(()=>{window.scrollTo(i,g)}),F=null}}fe.default.useEffect(()=>{function g(){r.current=window.scrollY}return g(),window.addEventListener("scroll",g),()=>{window.removeEventListener("scroll",g)}},[]),fe.default.useEffect(()=>{t||(e?(l(),n||setTimeout(()=>{a()},500)):a())},[e])}var U=W(require("react"));var Ye=new WeakMap;function h(e,n,t=!1){if(!e||!(e instanceof HTMLElement)||!n)return;let r={};Object.entries(n).forEach(([l,a])=>{if(l.startsWith("--")){e.style.setProperty(l,a);return}r[l]=e.style[l],e.style[l]=a}),!t&&Ye.set(e,r)}function de(e,n){if(!e||!(e instanceof HTMLElement))return;let t=Ye.get(e);t&&(n?e.style[n]=t[n]:Object.entries(t).forEach(([r,l])=>{e.style[r]=l}))}function ee(e){let n=window.getComputedStyle(e),t=n.transform||n.webkitTransform||n.mozTransform,r=t.match(/^matrix3d\((.+)\)$/);return r?parseFloat(r[1].split(", ")[13]):(r=t.match(/^matrix\((.+)\)$/),r?parseFloat(r[1].split(", ")[5]):null)}function ze(e){return 8*(Math.log(e+1)-2)}var p={DURATION:.5,EASE:[.32,.72,0,1]},me=.4;var V=W(require("react"));function Be(e){let n=V.default.useRef(e);return V.default.useEffect(()=>{n.current=e}),V.default.useMemo(()=>(...t)=>{var r;return(r=n.current)==null?void 0:r.call(n,...t)},[])}function Ct({defaultProp:e,onChange:n}){let t=V.default.useState(e),[r]=t,l=V.default.useRef(r),a=Be(n);return V.default.useEffect(()=>{l.current!==r&&(a(r),l.current=r)},[r,l,a]),t}function _e({prop:e,defaultProp:n,onChange:t=()=>{}}){let[r,l]=Ct({defaultProp:n,onChange:t}),a=e!==void 0,g=a?e:r,i=Be(t),y=V.default.useCallback(D=>{if(a){let c=typeof D=="function"?D(e):D;c!==e&&i(c)}else l(D)},[a,e,l,i]);return[g,y]}function qe({activeSnapPointProp:e,setActiveSnapPointProp:n,snapPoints:t,drawerRef:r,overlayRef:l,fadeFromIndex:a,onSnapPointChange:g}){let[i,y]=_e({prop:e,defaultProp:t==null?void 0:t[0],onChange:n}),D=U.default.useMemo(()=>i===(t==null?void 0:t[t.length-1]),[t,i]),H=t&&t.length>0&&a&&t[a]===i||!t,c=U.default.useMemo(()=>{var s;return(s=t==null?void 0:t.findIndex(b=>b===i))!=null?s:null},[t,i]),o=U.default.useMemo(()=>{var s;return(s=t==null?void 0:t.map(b=>{let T=typeof window!="undefined",M=typeof b=="string",O=0;M&&(O=parseInt(b,10));let N=M?O:T?b*window.innerHeight:0;return T?window.innerHeight-N:N}))!=null?s:[]},[t]),C=U.default.useMemo(()=>c!==null?o==null?void 0:o[c]:null,[o,c]),x=U.default.useCallback(s=>{var T;let b=(T=o==null?void 0:o.findIndex(M=>M===s))!=null?T:null;g(b),h(r.current,{transition:`transform ${p.DURATION}s cubic-bezier(${p.EASE.join(",")})`,transform:`translate3d(0, ${s}px, 0)`}),o&&b!==o.length-1&&b!==a?h(l.current,{transition:`opacity ${p.DURATION}s cubic-bezier(${p.EASE.join(",")})`,opacity:"0"}):h(l.current,{transition:`opacity ${p.DURATION}s cubic-bezier(${p.EASE.join(",")})`,opacity:"1"}),y(b!==null?t==null?void 0:t[b]:null)},[r,t,o,a,l,y]);U.default.useEffect(()=>{var s;if(e){let b=(s=t==null?void 0:t.findIndex(T=>T===e))!=null?s:null;o&&b&&typeof o[b]=="number"&&x(o[b])}},[e,t,o,x]);function _({draggedDistance:s,closeDrawer:b,velocity:T}){if(a===void 0)return;let M=C-s,O=c===a-1,N=c===0;if(O&&h(l.current,{transition:`opacity ${p.DURATION}s cubic-bezier(${p.EASE.join(",")})`}),T>2&&s<0){b();return}if(T>2&&s>0&&o&&t){x(o[t.length-1]);return}let P=o==null?void 0:o.reduce((L,q)=>typeof L!="number"||typeof q!="number"?L:Math.abs(q-M)<Math.abs(L-M)?q:L);if(T>me&&Math.abs(s)<window.innerHeight*.4){let L=s>0?1:-1;if(L>0&&D){x(o[t.length-1]);return}if(N&&L<0&&b(),c===null)return;x(o[c+L]);return}x(P)}function $({draggedDistance:s}){if(C===null)return;let b=C-s;h(r.current,{transform:`translate3d(0, ${b}px, 0)`})}function j(s,b){if(!t||typeof c!="number"||!o||a===void 0)return null;let T=c===a-1;if(c>=a&&b)return 0;if(T&&!b)return 1;if(!H&&!T)return null;let O=T?c+1:c-1,N=T?o[O]-o[O-1]:o[O+1]-o[O],P=s/Math.abs(N);return T?1-P:P}return{isLastSnapPoint:D,activeSnapPoint:i,shouldFade:H,getPercentageDragged:j,setActiveSnapPoint:y,activeSnapPointIndex:c,onRelease:_,onDrag:$,snapPointsOffset:o}}var Ot=.25,Lt=500,Ke=8,Y=16,Xe=26;function Je({open:e,onOpenChange:n,children:t,shouldScaleBackground:r,onDrag:l,onRelease:a,experimentalSafariThemeAnimation:g,snapPoints:i,nested:y,closeThreshold:D=Ot,scrollLockTimeout:H=Lt,dismissible:c=!0,fadeFromIndex:o=i&&i.length-1,activeSnapPoint:C,setActiveSnapPoint:x,fixed:_,modal:$=!0,onClose:j}){var Ne;let[s=!1,b]=m.default.useState(!1),[T,M]=m.default.useState(!1),[O,N]=m.default.useState(!1),[P,L]=m.default.useState(!1),[q,Me]=m.default.useState(!1),k=m.default.useRef(null),te=m.default.useRef(null),pe=m.default.useRef(null),He=m.default.useRef(null),K=m.default.useRef(null),X=m.default.useRef(!1),ge=m.default.useRef(null),be=m.default.useRef(0),z=m.default.useRef(!1),Ce=m.default.useRef(0),f=m.default.useRef(null),Oe=m.default.useRef(((Ne=f.current)==null?void 0:Ne.getBoundingClientRect().height)||0),{onDrag:et,onRelease:ne}=(void 0)(f,k,T,g),tt=(0,m.useCallback)(u=>{i&&u===J.length-1&&(te.current=new Date)},[]),{activeSnapPoint:nt,activeSnapPointIndex:G,setActiveSnapPoint:Le,onRelease:rt,snapPointsOffset:J,onDrag:ot,shouldFade:Ae,getPercentageDragged:it}=qe({snapPoints:i,activeSnapPointProp:C,setActiveSnapPointProp:x,drawerRef:f,fadeFromIndex:o,overlayRef:k,onSnapPointChange:tt});je({isDisabled:!s||P||!$||q}),Ue({isOpen:s,modal:$,nested:y});function re(){return(window.innerWidth-Xe)/window.innerWidth}function at(u){var d;!c&&!i||f.current&&!f.current.contains(u.target)||(Oe.current=((d=f.current)==null?void 0:d.getBoundingClientRect().height)||0,L(!0),pe.current=new Date,Se()&&window.addEventListener("touchend",()=>X.current=!1,{once:!0}),u.target.setPointerCapture(u.pointerId),be.current=u.clientY)}function Ie(u,d){var A;let v=u,R=new Date,E=(A=window.getSelection())==null?void 0:A.toString(),w=f.current?ee(f.current):null;if(te.current&&R.getTime()-te.current.getTime()<500)return!1;if(w>0)return!0;if(E&&E.length>0)return!1;if(K.current&&R.getTime()-K.current.getTime()<H&&w===0)return K.current=new Date,!1;for(;v;){if(v.scrollHeight>v.clientHeight){if(v.getAttribute("role")==="dialog")return!0;if(d&&v!==document.body&&!w&&w>=0)return K.current=new Date,!1;if(v.scrollTop!==0)return K.current=new Date,!1}v=v.parentNode}return!0}function lt(u){if(P){let d=be.current-u.clientY,v=d>0;if(i&&G===0&&!c||!X.current&&!Ie(u.target,v))return;if(X.current=!0,h(f.current,{transition:"none"}),h(k.current,{transition:"none"}),i&&ot({draggedDistance:d}),d>0&&!i){let I=ze(d);h(f.current,{transform:`translate3d(0, ${Math.min(I*-1,0)}px, 0)`});return}let R=Math.abs(d),E=document.querySelector("[vaul-drawer-wrapper]"),w=R/Oe.current,A=it(R,v);A!==null&&(w=A);let ve=1-w;if((Ae||o&&G===o-1)&&(et(w),l==null||l(u,w),g||h(k.current,{opacity:`${ve}`,transition:"none"},!0)),E&&k.current&&r){let I=Math.min(re()+w*(1-re()),1),ie=8-w*8,dt=Math.max(0,14-w*14);h(E,{borderRadius:`${ie}px`,transform:`scale(${I}) translate3d(0, ${dt}px, 0)`,transition:"none"},!0)}i||h(f.current,{transform:`translate3d(0, ${R}px, 0)`})}}m.default.useEffect(()=>{if(document.querySelector("[vaul-drawer-wrapper]"))return()=>oe(!1)},[]),m.default.useEffect(()=>{var d;function u(){var R;if(!f.current)return;let v=document.activeElement;if(Z(v)||z.current){let E=((R=window.visualViewport)==null?void 0:R.height)||0,w=window.innerHeight-E,A=f.current.getBoundingClientRect().height||0,ve=f.current.getBoundingClientRect().top;if(Math.abs(Ce.current-w)>60&&(z.current=!z.current),i&&i.length>0&&J&&G){let I=J[G]||0;w+=I}if(Ce.current=w,A>E||z.current){let I=f.current.getBoundingClientRect().height,ie=I;I>E&&(ie=E-Xe),_?f.current.style.height=`${I-Math.max(w,0)}px`:f.current.style.height=`${Math.max(ie,E-ve)}px`}else f.current.style.height="initial";i&&i.length>0&&!z.current?f.current.style.bottom="0px":f.current.style.bottom=`${Math.max(w,0)}px`}}return(d=window.visualViewport)==null||d.addEventListener("resize",u),()=>{var v;return(v=window.visualViewport)==null?void 0:v.removeEventListener("resize",u)}},[G,i,J]);function B(){f.current&&(j==null||j(),f.current&&(h(f.current,{transform:"translate3d(0, 100%, 0)",transition:`transform ${p.DURATION}s cubic-bezier(${p.EASE.join(",")})`}),g||h(k.current,{opacity:"0",transition:`opacity ${p.DURATION}s cubic-bezier(${p.EASE.join(",")})`}),oe(!1)),M(!1),setTimeout(()=>{b(!1)},300),setTimeout(()=>{i&&Le(i[0])},500))}m.default.useEffect(()=>{if(!s&&r){let u=setTimeout(()=>{de(document.body)},200);return()=>clearTimeout(u)}},[s,r]),m.default.useEffect(()=>{e?b(!0):B()},[e]),m.default.useEffect(()=>{O&&(n==null||n(s))},[s]),m.default.useEffect(()=>{N(!0)},[]);function $e(){if(!f.current)return;let u=document.querySelector("[vaul-drawer-wrapper]"),d=ee(f.current);h(f.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${p.DURATION}s cubic-bezier(${p.EASE.join(",")})`}),g||h(k.current,{transition:`opacity ${p.DURATION}s cubic-bezier(${p.EASE.join(",")})`,opacity:"1"}),r&&d&&d>0&&s&&h(u,{borderRadius:`${Ke}px`,overflow:"hidden",transform:`scale(${re()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top",transitionProperty:"transform, border-radius",transitionDuration:`${p.DURATION}s`,transitionTimingFunction:`cubic-bezier(${p.EASE.join(",")})`},!0)}function st(u){if(!P||!f.current)return;X.current&&Z(u.target)&&u.target.blur(),X.current=!1,L(!1),He.current=new Date;let d=ee(f.current);if(!Ie(u.target,!1)||!d||Number.isNaN(d)||pe.current===null)return;let v=u.clientY,R=He.current.getTime()-pe.current.getTime(),E=be.current-v,w=Math.abs(E)/R;if(w>.05&&(Me(!0),setTimeout(()=>{Me(!1)},200)),i){rt({draggedDistance:E,closeDrawer:B,velocity:w});return}if(E>0){$e(),a==null||a(u,!0),ne(!0);return}if(w>me){B(),a==null||a(u,!1),ne(!1);return}let A=Math.min(f.current.getBoundingClientRect().height||0,window.innerHeight);if(d>=A*D){B(),a==null||a(u,!1),ne(!1);return}a==null||a(u,!0),ne(!0),$e()}m.default.useEffect(()=>{s&&(te.current=new Date,M(!0),oe(!0))},[s]);function oe(u){let d=document.querySelector("[vaul-drawer-wrapper]");!d||!r||(u?(h(document.body,{background:"black"},!0),h(d,{borderRadius:`${Ke}px`,overflow:"hidden",transform:`scale(${re()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top",transitionProperty:"transform, border-radius",transitionDuration:`${p.DURATION}s`,transitionTimingFunction:`cubic-bezier(${p.EASE.join(",")})`})):(de(d,"transform"),de(d,"borderRadius"),h(d,{transitionProperty:"transform, border-radius",transitionDuration:`${p.DURATION}s`,transitionTimingFunction:`cubic-bezier(${p.EASE.join(",")})`})))}function ut(u){let d=u?(window.innerWidth-Y)/window.innerWidth:1,v=u?-Y:0;ge.current&&window.clearTimeout(ge.current),h(f.current,{transition:`transform ${p.DURATION}s cubic-bezier(${p.EASE.join(",")})`,transform:`scale(${d}) translate3d(0, ${v}px, 0)`}),!u&&f.current&&(ge.current=setTimeout(()=>{h(f.current,{transition:"none",transform:`translate3d(0, ${ee(f.current)}px, 0)`})},500))}function ct(u,d){if(d<0)return;let v=(window.innerWidth-Y)/window.innerWidth,R=v+d*(1-v),E=-Y+d*Y;h(f.current,{transform:`scale(${R}) translate3d(0, ${E}px, 0)`,transition:"none"})}function ft(u,d){let v=d?(window.innerWidth-Y)/window.innerWidth:1,R=d?-Y:0;d&&h(f.current,{transition:`transform ${p.DURATION}s cubic-bezier(${p.EASE.join(",")})`,transform:`scale(${v}) translate3d(0, ${R}px, 0)`})}return m.default.createElement(S.Root,{modal:$,onOpenChange:u=>{u?b(u):B()},open:s},m.default.createElement(we.Provider,{value:{visible:T,activeSnapPoint:nt,snapPoints:i,setActiveSnapPoint:Le,drawerRef:f,overlayRef:k,scaleBackground:oe,onPress:at,setVisible:M,onRelease:st,onDrag:lt,dismissible:c,isOpen:s,shouldFade:Ae,closeDrawer:B,onNestedDrag:ct,onNestedOpenChange:ut,onNestedRelease:ft,keyboardIsOpen:z,modal:$,snapPointsOffset:J,experimentalSafariThemeAnimation:g}},t))}var Qe=m.default.forwardRef(function({children:e,style:n,...t},r){let{overlayRef:l,snapPoints:a,onRelease:g,experimentalSafariThemeAnimation:i,shouldFade:y,isOpen:D,visible:H}=le(),c=xe(r,l),o=a&&a.length>0;return m.default.createElement(S.Overlay,{onMouseUp:g,ref:c,"vaul-drawer-visible":H&&!i?"true":"false","vaul-overlay":"","vaul-snap-points":D&&o?"true":"false","vaul-snap-points-overlay":D&&y?"true":"false","vaul-theme-transition":i?"true":"false",...t})});Qe.displayName="Drawer.Overlay";var Ze=m.default.forwardRef(function({children:e,onOpenAutoFocus:n,onPointerDownOutside:t,onAnimationEnd:r,style:l,...a},g){let{drawerRef:i,onPress:y,onRelease:D,onDrag:H,dismissible:c,keyboardIsOpen:o,snapPointsOffset:C,visible:x,closeDrawer:_,modal:$}=le(),j=xe(g,i);return m.default.createElement(S.Content,{onOpenAutoFocus:s=>{n?n(s):(s.preventDefault(),i.current.focus())},onPointerDown:y,onPointerDownOutside:s=>{if(!$){s.preventDefault();return}o.current&&(o.current=!1),s.preventDefault(),c&&(_(),t==null||t(s))},onPointerMove:H,onPointerUp:D,ref:j,style:C?{"--snap-point-height":`${C[0]}px`,...l}:l,...a,"vaul-drawer":"","vaul-drawer-visible":x?"true":"false"},e)});Ze.displayName="Drawer.Content";function At({children:e,onDrag:n,onOpenChange:t,...r}){let{onNestedDrag:l,onNestedOpenChange:a,onNestedRelease:g}=le();if(!l)throw new Error("Drawer.NestedRoot must be placed in another drawer");return m.default.createElement(Je,{nested:!0,onClose:()=>{a(!1)},onDrag:(i,y)=>{l(i,y),n==null||n(i,y)},onOpenChange:i=>{i&&a(i),t==null||t(i)},onRelease:g,...r},e)}var It={Root:Je,NestedRoot:At,Content:Ze,Overlay:Qe,Trigger:S.Trigger,Portal:S.Portal,Close:S.Close,Title:S.Title,Description:S.Description};0&&(module.exports={Drawer});
"use client";var ut=Object.create;var ie=Object.defineProperty;var ct=Object.getOwnPropertyDescriptor;var ft=Object.getOwnPropertyNames;var dt=Object.getPrototypeOf,mt=Object.prototype.hasOwnProperty;var pt=(e,n)=>{for(var t in n)ie(e,t,{get:n[t],enumerable:!0})},$e=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of ft(n))!mt.call(e,a)&&a!==t&&ie(e,a,{get:()=>n[a],enumerable:!(r=ct(n,a))||r.enumerable});return e};var Y=(e,n,t)=>(t=e!=null?ut(dt(e)):{},$e(n||!e||!e.__esModule?ie(t,"default",{value:e,enumerable:!0}):t,e)),gt=e=>$e(ie({},"__esModule",{value:!0}),e);var Ot={};pt(Ot,{Drawer:()=>Ct});module.exports=gt(Ot);var D=Y(require("@radix-ui/react-dialog")),d=Y(require("react"));var ve=Y(require("react")),he=ve.default.createContext({drawerRef:{current:null},overlayRef:{current:null},scaleBackground:()=>{},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},dismissible:!1,isOpen:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,modal:!1,shouldFade:!1,activeSnapPoint:null,setActiveSnapPoint:()=>{},visible:!1,closeDrawer:()=>{},setVisible:()=>{}}),ae=()=>ve.default.useContext(he);function we(e,{insertAt:n}={}){if(!e||typeof document=="undefined")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",n==="top"&&t.firstChild?t.insertBefore(r,t.firstChild):t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}we(`[vaul-drawer]{touch-action:none;transform:translate3d(0,100%,0);transition:transform .5s cubic-bezier(.32,.72,0,1)}[vaul-drawer][vaul-drawer-visible=true]{transform:translate3d(0,var(--snap-point-height, 0),0)}[vaul-overlay]{opacity:0;transition:opacity .5s cubic-bezier(.32,.72,0,1)}[vaul-overlay][vaul-drawer-visible=true]{opacity:1}[vaul-drawer]:after{content:"";position:absolute;top:100%;background:inherit;background-color:inherit;left:0;right:0;height:200%}[vaul-overlay][vaul-snap-points=true]:not([vaul-snap-points-overlay="true"]):not([data-state="closed"]){opacity:0}[vaul-overlay][vaul-snap-points-overlay=true]:not([vaul-drawer-visible="false"]){opacity:1}@keyframes fake-animation{}@media (hover: hover) and (pointer: fine){[vaul-drawer]{user-select:none}}
`);var ue=require("react"),bt=typeof window!="undefined"?ue.useLayoutEffect:ue.useEffect;function ye(...e){return(...n)=>{for(let t of e)typeof t=="function"&&t(...n)}}function vt(){return Se(/^Mac/)}function ht(){return Se(/^iPhone/)}function wt(){return Se(/^iPad/)||vt()&&navigator.maxTouchPoints>1}function De(){return ht()||wt()}function Se(e){return typeof window!="undefined"&&window.navigator!=null?e.test(window.navigator.platform):void 0}var Ee=typeof document!="undefined"&&window.visualViewport;function Ne(e){let n=window.getComputedStyle(e);return/(auto|scroll)/.test(n.overflow+n.overflowX+n.overflowY)}function Fe(e){for(Ne(e)&&(e=e.parentElement);e&&!Ne(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}var Et=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),le=0,Te;function Ve(e={}){let{isDisabled:n}=e;bt(()=>{if(!n)return le++,le===1&&(De()?Te=yt():Te=Tt()),()=>{le--,le===0&&Te()}},[n])}function Tt(){return ye(se(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`),se(document.documentElement,"overflow","hidden"))}function yt(){let e,n=0,t=u=>{e=Fe(u.target),!(e===document.documentElement&&e===document.body)&&(n=u.changedTouches[0].pageY)},r=u=>{if(!e||e===document.documentElement||e===document.body){u.preventDefault();return}let o=u.changedTouches[0].pageY,C=e.scrollTop,H=e.scrollHeight-e.clientHeight;H!==0&&((C<=0&&o>n||C>=H&&o<n)&&u.preventDefault(),n=o)},a=u=>{let o=u.target;Z(o)&&o!==document.activeElement&&(u.preventDefault(),o.style.transform="translateY(-2000px)",o.focus(),requestAnimationFrame(()=>{o.style.transform=""}))},i=u=>{let o=u.target;Z(o)&&(o.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{o.style.transform="",Ee&&(Ee.height<window.innerHeight?requestAnimationFrame(()=>{Pe(o)}):Ee.addEventListener("resize",()=>Pe(o),{once:!0}))}))},l=()=>{window.scrollTo(0,0)},p=window.pageXOffset,T=window.pageYOffset,S=ye(se(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`),se(document.documentElement,"overflow","hidden"));window.scrollTo(0,0);let M=ye(Q(document,"touchstart",t,{passive:!1,capture:!0}),Q(document,"touchmove",r,{passive:!1,capture:!0}),Q(document,"touchend",a,{passive:!1,capture:!0}),Q(document,"focus",i,!0),Q(window,"scroll",l));return()=>{S(),M(),window.scrollTo(p,T)}}function se(e,n,t){let r=e.style[n];return e.style[n]=t,()=>{e.style[n]=r}}function Q(e,n,t,r){return e.addEventListener(n,t,r),()=>{e.removeEventListener(n,t,r)}}function Pe(e){let n=document.scrollingElement||document.documentElement;for(;e&&e!==n;){let t=Fe(e);if(t!==document.documentElement&&t!==document.body&&t!==e){let r=t.getBoundingClientRect().top,a=e.getBoundingClientRect().top,i=e.getBoundingClientRect().bottom,l=t.getBoundingClientRect().bottom;i>l&&(t.scrollTop+=a-r)}e=t.parentElement}}function Z(e){return e instanceof HTMLInputElement&&!Et.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}var je=Y(require("react"));function Dt(e,n){typeof e=="function"?e(n):e!=null&&(e.current=n)}function St(...e){return n=>e.forEach(t=>Dt(t,n))}function Re(...e){return je.useCallback(St(...e),e)}var ce=Y(require("react")),F=null;function We({isOpen:e,modal:n,nested:t}){let r=ce.default.useRef(0);function a(){if(F===null){F={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height};let{scrollX:l,innerHeight:p}=window;document.body.style.setProperty("position","fixed","important"),document.body.style.top=`${-r.current}px`,document.body.style.left=`${-l}px`,document.body.style.right="0px",document.body.style.height="auto",setTimeout(()=>requestAnimationFrame(()=>{let T=p-window.innerHeight;T&&r.current>=p&&(document.body.style.top=`${-(r.current+T)}px`)}),300)}}function i(){if(F!==null){let l=-parseInt(document.body.style.top,10),p=-parseInt(document.body.style.left,10);document.body.style.position=F.position,document.body.style.top=F.top,document.body.style.left=F.left,document.body.style.height=F.height,document.body.style.right="unset",requestAnimationFrame(()=>{window.scrollTo(p,l)}),F=null}}ce.default.useEffect(()=>{function l(){r.current=window.scrollY}return l(),window.addEventListener("scroll",l),()=>{window.removeEventListener("scroll",l)}},[]),ce.default.useEffect(()=>{t||(e?(a(),n||setTimeout(()=>{i()},500)):i())},[e])}var k=Y(require("react"));var Ue=new WeakMap;function h(e,n,t=!1){if(!e||!(e instanceof HTMLElement)||!n)return;let r={};Object.entries(n).forEach(([a,i])=>{if(a.startsWith("--")){e.style.setProperty(a,i);return}r[a]=e.style[a],e.style[a]=i}),!t&&Ue.set(e,r)}function fe(e,n){if(!e||!(e instanceof HTMLElement))return;let t=Ue.get(e);t&&(n?e.style[n]=t[n]:Object.entries(t).forEach(([r,a])=>{e.style[r]=a}))}function ee(e){let n=window.getComputedStyle(e),t=n.transform||n.webkitTransform||n.mozTransform,r=t.match(/^matrix3d\((.+)\)$/);return r?parseFloat(r[1].split(", ")[13]):(r=t.match(/^matrix\((.+)\)$/),r?parseFloat(r[1].split(", ")[5]):null)}function Ye(e){return 8*(Math.log(e+1)-2)}var g={DURATION:.5,EASE:[.32,.72,0,1]},de=.4;var V=Y(require("react"));function ke(e){let n=V.default.useRef(e);return V.default.useEffect(()=>{n.current=e}),V.default.useMemo(()=>(...t)=>{var r;return(r=n.current)==null?void 0:r.call(n,...t)},[])}function Rt({defaultProp:e,onChange:n}){let t=V.default.useState(e),[r]=t,a=V.default.useRef(r),i=ke(n);return V.default.useEffect(()=>{a.current!==r&&(i(r),a.current=r)},[r,a,i]),t}function ze({prop:e,defaultProp:n,onChange:t=()=>{}}){let[r,a]=Rt({defaultProp:n,onChange:t}),i=e!==void 0,l=i?e:r,p=ke(t),T=V.default.useCallback(S=>{if(i){let u=typeof S=="function"?S(e):S;u!==e&&p(u)}else a(S)},[i,e,a,p]);return[l,T]}function Be({activeSnapPointProp:e,setActiveSnapPointProp:n,snapPoints:t,drawerRef:r,overlayRef:a,fadeFromIndex:i,onSnapPointChange:l}){let[p,T]=ze({prop:e,defaultProp:t==null?void 0:t[0],onChange:n}),S=k.default.useMemo(()=>p===(t==null?void 0:t[t.length-1]),[t,p]),M=t&&t.length>0&&i&&t[i]===p||!t,u=k.default.useMemo(()=>{var m;return(m=t==null?void 0:t.findIndex(b=>b===p))!=null?m:null},[t,p]),o=k.default.useMemo(()=>{var m;return(m=t==null?void 0:t.map(b=>{let w=typeof window!="undefined",L=typeof b=="string",O=0;L&&(O=parseInt(b,10));let A=L?O:w?b*window.innerHeight:0;return w?window.innerHeight-A:A}))!=null?m:[]},[t]),C=k.default.useMemo(()=>u!==null?o==null?void 0:o[u]:null,[o,u]),H=k.default.useCallback(m=>{var w;let b=(w=o==null?void 0:o.findIndex(L=>L===m))!=null?w:null;l(b),h(r.current,{transition:`transform ${g.DURATION}s cubic-bezier(${g.EASE.join(",")})`,transform:`translate3d(0, ${m}px, 0)`}),o&&b!==o.length-1&&b!==i?h(a.current,{transition:`opacity ${g.DURATION}s cubic-bezier(${g.EASE.join(",")})`,opacity:"0"}):h(a.current,{transition:`opacity ${g.DURATION}s cubic-bezier(${g.EASE.join(",")})`,opacity:"1"}),T(b!==null?t==null?void 0:t[b]:null)},[r,t,o,i,a,T]);k.default.useEffect(()=>{var m;if(e){let b=(m=t==null?void 0:t.findIndex(w=>w===e))!=null?m:null;o&&b&&typeof o[b]=="number"&&H(o[b])}},[e,t,o,H]);function P({draggedDistance:m,closeDrawer:b,velocity:w}){if(i===void 0)return;let L=C-m,O=u===i-1,A=u===0;if(O&&h(a.current,{transition:`opacity ${g.DURATION}s cubic-bezier(${g.EASE.join(",")})`}),w>2&&m<0){b();return}if(w>2&&m>0&&o&&t){H(o[t.length-1]);return}let W=o==null?void 0:o.reduce((I,B)=>typeof I!="number"||typeof B!="number"?I:Math.abs(B-L)<Math.abs(I-L)?B:I);if(w>de&&Math.abs(m)<window.innerHeight*.4){let I=m>0?1:-1;if(I>0&&S){H(o[t.length-1]);return}if(A&&I<0&&b(),u===null)return;H(o[u+I]);return}H(W)}function j({draggedDistance:m}){if(C===null)return;let b=C-m;h(r.current,{transform:`translate3d(0, ${b}px, 0)`})}function R(m,b){if(!t||typeof u!="number"||!o||i===void 0)return null;let w=u===i-1;if(u>=i&&b)return 0;if(w&&!b)return 1;if(!M&&!w)return null;let O=w?u+1:u-1,A=w?o[O]-o[O-1]:o[O+1]-o[O],W=m/Math.abs(A);return w?1-W:W}return{isLastSnapPoint:S,activeSnapPoint:p,shouldFade:M,getPercentageDragged:R,setActiveSnapPoint:T,activeSnapPointIndex:u,onRelease:P,onDrag:j,snapPointsOffset:o}}var xt=.25,Mt=500,_e=8,z=16,qe=26;function Ke({open:e,onOpenChange:n,children:t,shouldScaleBackground:r,onDrag:a,onRelease:i,snapPoints:l,nested:p,closeThreshold:T=xt,scrollLockTimeout:S=Mt,dismissible:M=!0,fadeFromIndex:u=l&&l.length-1,activeSnapPoint:o,setActiveSnapPoint:C,fixed:H,modal:P=!0,onClose:j}){var Ie;let[R=!1,m]=d.default.useState(!1),[b,w]=d.default.useState(!1),[L,O]=d.default.useState(!1),[A,W]=d.default.useState(!1),[I,B]=d.default.useState(!1),U=d.default.useRef(null),te=d.default.useRef(null),me=d.default.useRef(null),xe=d.default.useRef(null),K=d.default.useRef(null),X=d.default.useRef(!1),pe=d.default.useRef(null),ge=d.default.useRef(0),_=d.default.useRef(!1),Me=d.default.useRef(0),f=d.default.useRef(null),He=d.default.useRef(((Ie=f.current)==null?void 0:Ie.getBoundingClientRect().height)||0),Je=(0,d.useCallback)(s=>{l&&s===J.length-1&&(te.current=new Date)},[]),{activeSnapPoint:Qe,activeSnapPointIndex:G,setActiveSnapPoint:Ce,onRelease:Ze,snapPointsOffset:J,onDrag:et,shouldFade:Oe,getPercentageDragged:tt}=Be({snapPoints:l,activeSnapPointProp:o,setActiveSnapPointProp:C,drawerRef:f,fadeFromIndex:u,overlayRef:U,onSnapPointChange:Je});Ve({isDisabled:!R||A||!P||I}),We({isOpen:R,modal:P,nested:p});function ne(){return(window.innerWidth-qe)/window.innerWidth}function nt(s){var c;!M&&!l||f.current&&!f.current.contains(s.target)||(He.current=((c=f.current)==null?void 0:c.getBoundingClientRect().height)||0,W(!0),me.current=new Date,De()&&window.addEventListener("touchend",()=>X.current=!1,{once:!0}),s.target.setPointerCapture(s.pointerId),ge.current=s.clientY)}function Le(s,c){var $;let v=s,x=new Date,y=($=window.getSelection())==null?void 0:$.toString(),E=f.current?ee(f.current):null;if(te.current&&x.getTime()-te.current.getTime()<500)return!1;if(E>0)return!0;if(y&&y.length>0)return!1;if(K.current&&x.getTime()-K.current.getTime()<S&&E===0)return K.current=new Date,!1;for(;v;){if(v.scrollHeight>v.clientHeight){if(v.getAttribute("role")==="dialog")return!0;if(c&&v!==document.body&&!E&&E>=0)return K.current=new Date,!1;if(v.scrollTop!==0)return K.current=new Date,!1}v=v.parentNode}return!0}function rt(s){if(A){let c=ge.current-s.clientY,v=c>0;if(l&&G===0&&!M||!X.current&&!Le(s.target,v))return;if(X.current=!0,h(f.current,{transition:"none"}),h(U.current,{transition:"none"}),l&&et({draggedDistance:c}),c>0&&!l){let N=Ye(c);h(f.current,{transform:`translate3d(0, ${Math.min(N*-1,0)}px, 0)`});return}let x=Math.abs(c),y=document.querySelector("[vaul-drawer-wrapper]"),E=x/He.current,$=tt(x,v);$!==null&&(E=$);let be=1-E;if((Oe||u&&G===u-1)&&(a==null||a(s,E),h(U.current,{opacity:`${be}`,transition:"none"},!0)),y&&U.current&&r){let N=Math.min(ne()+E*(1-ne()),1),oe=8-E*8,st=Math.max(0,14-E*14);h(y,{borderRadius:`${oe}px`,transform:`scale(${N}) translate3d(0, ${st}px, 0)`,transition:"none"},!0)}l||h(f.current,{transform:`translate3d(0, ${x}px, 0)`})}}d.default.useEffect(()=>{if(document.querySelector("[vaul-drawer-wrapper]"))return()=>re(!1)},[]),d.default.useEffect(()=>{var c;function s(){var x;if(!f.current)return;let v=document.activeElement;if(Z(v)||_.current){let y=((x=window.visualViewport)==null?void 0:x.height)||0,E=window.innerHeight-y,$=f.current.getBoundingClientRect().height||0,be=f.current.getBoundingClientRect().top;if(Math.abs(Me.current-E)>60&&(_.current=!_.current),l&&l.length>0&&J&&G){let N=J[G]||0;E+=N}if(Me.current=E,$>y||_.current){let N=f.current.getBoundingClientRect().height,oe=N;N>y&&(oe=y-qe),H?f.current.style.height=`${N-Math.max(E,0)}px`:f.current.style.height=`${Math.max(oe,y-be)}px`}else f.current.style.height="initial";l&&l.length>0&&!_.current?f.current.style.bottom="0px":f.current.style.bottom=`${Math.max(E,0)}px`}}return(c=window.visualViewport)==null||c.addEventListener("resize",s),()=>{var v;return(v=window.visualViewport)==null?void 0:v.removeEventListener("resize",s)}},[G,l,J]);function q(){f.current&&(j==null||j(),f.current&&(h(f.current,{transform:"translate3d(0, 100%, 0)",transition:`transform ${g.DURATION}s cubic-bezier(${g.EASE.join(",")})`}),h(U.current,{opacity:"0",transition:`opacity ${g.DURATION}s cubic-bezier(${g.EASE.join(",")})`}),re(!1)),setTimeout(()=>{w(!1),m(!1)},300),setTimeout(()=>{l&&Ce(l[0])},500))}d.default.useEffect(()=>{if(!R&&r){let s=setTimeout(()=>{fe(document.body)},200);return()=>clearTimeout(s)}},[R,r]),d.default.useEffect(()=>{e?m(!0):q()},[e]),d.default.useEffect(()=>{L&&(n==null||n(R))},[R]),d.default.useEffect(()=>{O(!0)},[]);function Ae(){if(!f.current)return;let s=document.querySelector("[vaul-drawer-wrapper]"),c=ee(f.current);h(f.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${g.DURATION}s cubic-bezier(${g.EASE.join(",")})`}),h(U.current,{transition:`opacity ${g.DURATION}s cubic-bezier(${g.EASE.join(",")})`,opacity:"1"}),r&&c&&c>0&&R&&h(s,{borderRadius:`${_e}px`,overflow:"hidden",transform:`scale(${ne()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top",transitionProperty:"transform, border-radius",transitionDuration:`${g.DURATION}s`,transitionTimingFunction:`cubic-bezier(${g.EASE.join(",")})`},!0)}function ot(s){if(!A||!f.current)return;X.current&&Z(s.target)&&s.target.blur(),X.current=!1,W(!1),xe.current=new Date;let c=ee(f.current);if(!Le(s.target,!1)||!c||Number.isNaN(c)||me.current===null)return;let v=s.clientY,x=xe.current.getTime()-me.current.getTime(),y=ge.current-v,E=Math.abs(y)/x;if(E>.05&&(B(!0),setTimeout(()=>{B(!1)},200)),l){Ze({draggedDistance:y,closeDrawer:q,velocity:E});return}if(y>0){Ae(),i==null||i(s,!0);return}if(E>de){q(),i==null||i(s,!1);return}let $=Math.min(f.current.getBoundingClientRect().height||0,window.innerHeight);if(c>=$*T){q(),i==null||i(s,!1);return}i==null||i(s,!0),Ae()}d.default.useEffect(()=>{R&&(te.current=new Date,w(!0),re(!0))},[R]);function re(s){let c=document.querySelector("[vaul-drawer-wrapper]");!c||!r||(s?(h(document.body,{background:"black"},!0),h(c,{borderRadius:`${_e}px`,overflow:"hidden",transform:`scale(${ne()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top",transitionProperty:"transform, border-radius",transitionDuration:`${g.DURATION}s`,transitionTimingFunction:`cubic-bezier(${g.EASE.join(",")})`})):(fe(c,"transform"),fe(c,"borderRadius"),h(c,{transitionProperty:"transform, border-radius",transitionDuration:`${g.DURATION}s`,transitionTimingFunction:`cubic-bezier(${g.EASE.join(",")})`})))}function it(s){let c=s?(window.innerWidth-z)/window.innerWidth:1,v=s?-z:0;pe.current&&window.clearTimeout(pe.current),h(f.current,{transition:`transform ${g.DURATION}s cubic-bezier(${g.EASE.join(",")})`,transform:`scale(${c}) translate3d(0, ${v}px, 0)`}),!s&&f.current&&(pe.current=setTimeout(()=>{h(f.current,{transition:"none",transform:`translate3d(0, ${ee(f.current)}px, 0)`})},500))}function at(s,c){if(c<0)return;let v=(window.innerWidth-z)/window.innerWidth,x=v+c*(1-v),y=-z+c*z;h(f.current,{transform:`scale(${x}) translate3d(0, ${y}px, 0)`,transition:"none"})}function lt(s,c){let v=c?(window.innerWidth-z)/window.innerWidth:1,x=c?-z:0;c&&h(f.current,{transition:`transform ${g.DURATION}s cubic-bezier(${g.EASE.join(",")})`,transform:`scale(${v}) translate3d(0, ${x}px, 0)`})}return d.default.createElement(D.Root,{modal:P,onOpenChange:s=>{s?m(s):q()},open:R},d.default.createElement(he.Provider,{value:{visible:b,activeSnapPoint:Qe,snapPoints:l,setActiveSnapPoint:Ce,drawerRef:f,overlayRef:U,scaleBackground:re,onPress:nt,setVisible:w,onRelease:ot,onDrag:rt,dismissible:M,isOpen:R,shouldFade:Oe,closeDrawer:q,onNestedDrag:at,onNestedOpenChange:it,onNestedRelease:lt,keyboardIsOpen:_,modal:P,snapPointsOffset:J}},t))}var Xe=d.default.forwardRef(function({children:e,style:n,...t},r){let{overlayRef:a,snapPoints:i,onRelease:l,shouldFade:p,isOpen:T,visible:S}=ae(),M=Re(r,a),u=i&&i.length>0;return d.default.createElement(D.Overlay,{onMouseUp:l,ref:M,"vaul-drawer-visible":S?"true":"false","vaul-overlay":"","vaul-snap-points":T&&u?"true":"false","vaul-snap-points-overlay":T&&p?"true":"false",...t})});Xe.displayName="Drawer.Overlay";var Ge=d.default.forwardRef(function({children:e,onOpenAutoFocus:n,onPointerDownOutside:t,onAnimationEnd:r,style:a,...i},l){let{drawerRef:p,onPress:T,onRelease:S,onDrag:M,dismissible:u,keyboardIsOpen:o,snapPointsOffset:C,visible:H,closeDrawer:P,modal:j}=ae(),R=Re(l,p);return d.default.createElement(D.Content,{onOpenAutoFocus:m=>{n?n(m):(m.preventDefault(),p.current.focus())},onPointerDown:T,onPointerDownOutside:m=>{if(!j){m.preventDefault();return}o.current&&(o.current=!1),m.preventDefault(),u&&(P(),t==null||t(m))},onPointerMove:M,onPointerUp:S,ref:R,style:C?{"--snap-point-height":`${C[0]}px`,...a}:a,...i,"vaul-drawer":"","vaul-drawer-visible":H?"true":"false"},e)});Ge.displayName="Drawer.Content";function Ht({children:e,onDrag:n,onOpenChange:t,...r}){let{onNestedDrag:a,onNestedOpenChange:i,onNestedRelease:l}=ae();if(!a)throw new Error("Drawer.NestedRoot must be placed in another drawer");return d.default.createElement(Ke,{nested:!0,onClose:()=>{i(!1)},onDrag:(p,T)=>{a(p,T),n==null||n(p,T)},onOpenChange:p=>{p&&i(p),t==null||t(p)},onRelease:l,...r},e)}var Ct={Root:Ke,NestedRoot:Ht,Content:Ge,Overlay:Xe,Trigger:D.Trigger,Portal:D.Portal,Close:D.Close,Title:D.Title,Description:D.Description};0&&(module.exports={Drawer});
//# sourceMappingURL=index.js.map
{
"name": "vaul",
"version": "0.6.6",
"version": "0.6.7",
"description": "Drawer component for React.",

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

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