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.7.7 to 0.7.8

4

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