{"version":3,"file":"SheetHandle.Q1GoCBNE.mjs","names":["useRef","useState","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","ce","init_jsx_runtime","c","_e","de","addPropertyControls","init_framer_Bf4_tcb2","useIsStaticRenderer","ControlType","SheetHandle","props","isStatic","rootRef","panelRef","active","setActive","expanded","drag","half","halfHeight","full","fullHeight","findPanel","root","panelName","update","sheetBelow","panel","prev","onResize","html","body","onTouchMove","target","onWheel","lockScroll","scrollTarget","top","selector","el","n","scrollOffset","snap","toFull","dismiss","onDismiss","onPointerDown","onPointerMove","d","dy","dt","wanted","h","overshoot","onPointerUp","style","handleColor","init_SheetHandle"],"sources":["https:/framerusercontent.com/modules/KxqsNnHqoKf4plBeRJhr/BUkXJi2Z3q8MKH16H2NM/SheetHandle.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * Sheet handle\n *\n * Place this as the first child of a bottom-pinned panel inside a fixed\n * overlay. On screens up to \"Sheet below\" px it turns the panel into a\n * draggable bottom sheet: opens at the half height, drags up to the full\n * height, and a swipe down closes it (fires On dismiss, wire it to Dismiss\n * Overlay). While the sheet is open the page behind it cannot scroll (touch\n * included). When the sheet closes for any reason, the page scrolls to\n * \"Scroll to on close\": \"top\", a CSS selector such as #therapists,\n * \"name:<Framer layer name>\" for the first laid-out layer with that name, or\n * empty for no jump. The jump is instant, minus \"Scroll offset\" px. On wider screens it renders nothing and the panel is untouched.\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight fixed\n * @framerIntrinsicHeight 24\n */export default function SheetHandle(props){const{panelName=\"Filters panel\",halfHeight=55,fullHeight=92,sheetBelow=809,handleColor=\"rgba(31, 31, 31, 0.25)\",lockScroll=true,scrollTarget=\"\",scrollOffset=0,onDismiss,style}=props;const isStatic=useIsStaticRenderer();const rootRef=useRef(null);const panelRef=useRef(null);const[active,setActive]=useState(false);const expanded=useRef(false);const drag=useRef(null);const half=()=>Math.round(window.innerHeight*halfHeight/100);const full=()=>Math.round(window.innerHeight*fullHeight/100);function findPanel(){const root=rootRef.current;if(!root)return null;const byName=root.closest(`[data-framer-name=\"${panelName}\"]`);return byName||root.parentElement;}// Take over the panel's height on phones; give it back on unmount.\nuseEffect(()=>{if(isStatic||typeof window===\"undefined\")return;const update=()=>setActive(window.innerWidth<=sheetBelow);update();window.addEventListener(\"resize\",update);return()=>window.removeEventListener(\"resize\",update);},[isStatic,sheetBelow]);useEffect(()=>{if(!active)return;const panel=findPanel();if(!panel)return;panelRef.current=panel;const prev={height:panel.style.height,maxHeight:panel.style.maxHeight,overflowY:panel.style.overflowY,overscrollBehavior:panel.style.overscrollBehavior,transform:panel.style.transform,transition:panel.style.transition,boxSizing:panel.style.boxSizing};panel.style.boxSizing=\"border-box\";panel.style.overflowY=\"auto\";panel.style.overscrollBehavior=\"contain\";panel.style.maxHeight=\"none\";panel.style.height=`${half()}px`;panel.style.transform=\"translateY(0px)\";expanded.current=false;const onResize=()=>{if(drag.current)return;panel.style.height=`${expanded.current?full():half()}px`;};window.addEventListener(\"resize\",onResize);return()=>{window.removeEventListener(\"resize\",onResize);panel.style.height=prev.height;panel.style.maxHeight=prev.maxHeight;panel.style.overflowY=prev.overflowY;panel.style.overscrollBehavior=prev.overscrollBehavior;panel.style.transform=prev.transform;panel.style.transition=prev.transition;panel.style.boxSizing=prev.boxSizing;};},[active,panelName,halfHeight,fullHeight]);// Lock the page behind the sheet. Framer's overlay already sets\n// overflow: hidden on <html> and clears it on close, so this never touches\n// that property (restoring it late left the page stuck). iOS ignores\n// overflow: hidden for touch, so touchmove and wheel outside the panel are\n// cancelled. Unlock on close, then scroll to the target.\nuseEffect(()=>{if(!active||typeof document===\"undefined\")return;const html=document.documentElement;const body=document.body;const panel=panelRef.current;const onTouchMove=e=>{const target=e.target;if(panel&&target&&panel.contains(target))return;if(e.cancelable)e.preventDefault();};const onWheel=e=>{const target=e.target;if(panel&&target&&panel.contains(target))return;if(e.cancelable)e.preventDefault();};if(lockScroll){html.style.overscrollBehavior=\"none\";body.style.overscrollBehavior=\"none\";body.style.touchAction=\"none\";document.addEventListener(\"touchmove\",onTouchMove,{passive:false});document.addEventListener(\"wheel\",onWheel,{passive:false});}return()=>{if(lockScroll){document.removeEventListener(\"touchmove\",onTouchMove);document.removeEventListener(\"wheel\",onWheel);html.style.overscrollBehavior=\"\";body.style.overscrollBehavior=\"\";body.style.touchAction=\"\";}const target=(scrollTarget||\"\").trim();if(!target)return;window.requestAnimationFrame(()=>{let top=0;if(target.toLowerCase()!==\"top\"){const selector=target.toLowerCase().startsWith(\"name:\")?`[data-framer-name=\"${target.slice(5).trim().replace(/\"/g,'\\\\\"')}\"]`:target;let el=null;try{// first match that is actually laid out (breakpoint copies share a name)\nel=Array.from(document.querySelectorAll(selector)).find(n=>n.getBoundingClientRect().height>0)||null;}catch(_){el=null;}if(!el)return;top=el.getBoundingClientRect().top+window.scrollY-scrollOffset;}window.scrollTo({top:Math.max(0,top),behavior:\"auto\"});});};},[active,lockScroll,scrollTarget,scrollOffset]);function snap(toFull){const panel=panelRef.current;if(!panel)return;expanded.current=toFull;panel.style.transition=\"height 0.32s cubic-bezier(0.32, 0.72, 0, 1), transform 0.32s cubic-bezier(0.32, 0.72, 0, 1)\";panel.style.height=`${toFull?full():half()}px`;panel.style.transform=\"translateY(0px)\";}function dismiss(){const panel=panelRef.current;if(!panel){onDismiss&&onDismiss();return;}panel.style.transition=\"transform 0.22s cubic-bezier(0.4, 0, 1, 1)\";panel.style.transform=\"translateY(110%)\";window.setTimeout(()=>onDismiss&&onDismiss(),200);}function onPointerDown(e){const panel=panelRef.current;if(!panel)return;e.currentTarget.setPointerCapture(e.pointerId);panel.style.transition=\"none\";drag.current={startY:e.clientY,startH:panel.getBoundingClientRect().height,lastY:e.clientY,lastT:e.timeStamp,vel:0,moved:false};}function onPointerMove(e){const d=drag.current;const panel=panelRef.current;if(!d||!panel)return;const dy=e.clientY-d.startY;if(Math.abs(dy)>3)d.moved=true;const dt=Math.max(1,e.timeStamp-d.lastT);d.vel=(e.clientY-d.lastY)/dt;d.lastY=e.clientY;d.lastT=e.timeStamp;const wanted=d.startH-dy;const h=Math.min(full(),Math.max(half(),wanted));panel.style.height=`${h}px`;const overshoot=half()-wanted;panel.style.transform=`translateY(${overshoot>0?overshoot:0}px)`;}function onPointerUp(e){const d=drag.current;const panel=panelRef.current;drag.current=null;if(!d||!panel)return;try{e.currentTarget.releasePointerCapture(e.pointerId);}catch(_){}if(!d.moved){snap(!expanded.current);return;}const dy=e.clientY-d.startY;const wanted=d.startH-dy;const overshoot=half()-wanted;if(overshoot>0&&(overshoot>half()*.3||d.vel>.6)){dismiss();return;}if(d.vel<-.3){snap(true);return;}if(d.vel>.3){snap(false);return;}snap(wanted>(half()+full())/2);}if(!active&&!isStatic)return /*#__PURE__*/_jsx(\"div\",{ref:rootRef,style:{...style,position:\"relative\",width:\"100%\",height:0}});return /*#__PURE__*/_jsx(\"div\",{ref:rootRef,role:\"button\",\"aria-label\":\"Drag to resize, swipe down to close\",onPointerDown:isStatic?undefined:onPointerDown,onPointerMove:isStatic?undefined:onPointerMove,onPointerUp:isStatic?undefined:onPointerUp,onPointerCancel:isStatic?undefined:onPointerUp,style:{...style,position:\"relative\",width:\"100%\",height:24,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",touchAction:\"none\",cursor:\"grab\",userSelect:\"none\"},children:/*#__PURE__*/_jsx(\"span\",{style:{display:\"block\",width:72,height:5,borderRadius:999,background:handleColor}})});}addPropertyControls(SheetHandle,{panelName:{type:ControlType.String,title:\"Panel name\",defaultValue:\"Filters panel\"},halfHeight:{type:ControlType.Number,title:\"Half height\",defaultValue:55,min:30,max:90,unit:\"%\"},fullHeight:{type:ControlType.Number,title:\"Full height\",defaultValue:92,min:50,max:100,unit:\"%\"},sheetBelow:{type:ControlType.Number,title:\"Sheet below\",defaultValue:809,min:320,max:1400,unit:\"px\",displayStepper:true},handleColor:{type:ControlType.Color,title:\"Handle\",defaultValue:\"rgba(31, 31, 31, 0.25)\"},lockScroll:{type:ControlType.Boolean,title:\"Lock page scroll\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},scrollTarget:{type:ControlType.String,title:\"Scroll to on close\",defaultValue:\"\",placeholder:\"top, #id or name:Layer\"},scrollOffset:{type:ControlType.Number,title:\"Scroll offset\",defaultValue:0,min:0,max:400,unit:\"px\",displayStepper:true},onDismiss:{type:ControlType.EventHandler,title:\"On dismiss\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SheetHandle\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"24\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SheetHandle.map"],"mappings":"A,8MAgBG,SAAwBe,EAAY,EAAM,CAAC,GAAK,CAAC,YAAU,gBAAgB,aAAW,GAAG,aAAW,GAAG,aAAW,IAAI,cAAY,yBAAyB,aAAW,GAAK,eAAa,GAAG,eAAa,EAAE,YAAU,SAAOC,EAAYC,EAASJ,EAAoB,EAAQK,EAAQlB,EAAO,IAAI,EAAQmB,EAASnB,EAAO,IAAI,EAAO,CAACoB,EAAOC,GAAWpB,EAAS,EAAK,EAAQqB,EAAStB,EAAO,EAAK,EAAQuB,EAAKvB,EAAO,IAAI,EAAQwB,MAAS,KAAK,MAAMnB,EAAO,YAAYoB,EAAW,GAAG,EAAQC,MAAS,KAAK,MAAMrB,EAAO,YAAYsB,EAAW,GAAG,EAAE,SAASC,GAAW,CAAC,IAAMC,EAAKX,EAAQ,QAA4F,OAAhFW,EAA8BA,EAAK,QAAQ,sBAAsBC,EAAU,GAAiB,GAAGD,EAAK,cAAxF,IAAsG,CAC7rBvB,MAAc,CAAC,GAAGW,GAAiBZ,IAAS,OAAY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