{"version":3,"file":"SheetHandle.DGSvChPA.mjs","names":["useRef","useState"],"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":"+MAgBG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,YAAU,gBAAgB,aAAW,GAAG,aAAW,GAAG,aAAW,IAAI,cAAY,yBAAyB,aAAW,GAAK,eAAa,GAAG,eAAa,EAAE,YAAU,SAAO,EAAY,EAAS,EAAoB,EAAQ,EAAQA,EAAO,IAAI,EAAQ,EAASA,EAAO,IAAI,EAAO,CAAC,EAAO,GAAWC,EAAS,EAAK,EAAQ,EAASD,EAAO,EAAK,EAAQ,EAAKA,EAAO,IAAI,EAAQ,MAAS,KAAK,MAAM,EAAO,YAAY,EAAW,GAAG,EAAQ,MAAS,KAAK,MAAM,EAAO,YAAY,EAAW,GAAG,EAAE,SAAS,GAAW,CAAC,IAAM,EAAK,EAAQ,QAA4F,OAAhF,EAA8B,EAAK,QAAQ,sBAAsB,EAAU,GAAiB,GAAG,EAAK,cAAxF,IAAsG,CAC7rB,MAAc,CAAC,GAAG,GAAiB,IAAS,OAAY,OAAO,IAAM,MAAW,EAAU,EAAO,YAAY,CAAU,EAAoD,OAAlD,EAAO,EAAE,EAAO,iBAAiB,SAAS,CAAM,MAAY,EAAO,oBAAoB,SAAS,CAAM,CAAE,EAAE,CAAC,EAAS,CAAU,CAAC,EAAE,MAAc,CAAC,GAAG,CAAC,EAAO,OAAO,IAAM,EAAM,EAAU,EAAE,GAAG,CAAC,EAAM,OAAO,EAAS,QAAQ,EAAM,IAAM,EAAK,CAAC,OAAO,EAAM,MAAM,OAAO,UAAU,EAAM,MAAM,UAAU,UAAU,EAAM,MAAM,UAAU,mBAAmB,EAAM,MAAM,mBAAmB,UAAU,EAAM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