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.6 to 0.7.7

4

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