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.1 to 0.7.2

4

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