{"version":3,"file":"PinnedColorBlock.Dn4QAEyV.mjs","names":["useRef","useState","useEffect","_jsx","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","_e","c","init_jsx_runtime","ce","de","init_framer_ChujFWHC","ControlType","useIsStaticRenderer","addPropertyControls","PinnedShell","background","runway","runwayTouch","pinned","colorMs","children","style","id","label","follow","isStatic","outerRef","layerRef","touch","setTouch","reduce","setReduce","outer","layer","x","v","lastY","raf","isPinned","r","frame","onScroll","y","d","t","INOUT","extra","PinnedColorBlock","props","content","colorDuration","child","init_PinnedColorBlock"],"sources":["https:/framerusercontent.com/modules/YLK5N7EzWJWkOTdGuOlY/LceIGp9qEgbWHo4NcIE2/PinnedColorBlock.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";const INOUT=\"cubic-bezier(0.65, 0, 0.35, 1)\";/**\n * The pinned colour block itself: an outer runway (100svh + runway) and a sticky 100svh layer, both painted\n * with the same animated colour, so neither the runway nor the neighbouring sections ever show through while\n * the colour changes. The content follows the scroll with a small damped offset (max 24 px) while pinned.\n * Native scrolling is never blocked (passive listeners only).\n */export function PinnedShell({background,runway,runwayTouch,pinned,colorMs,children,style,id,label,follow=true}){const isStatic=useIsStaticRenderer();const outerRef=useRef(null);const layerRef=useRef(null);const[touch,setTouch]=useState(false);const[reduce,setReduce]=useState(false);useEffect(()=>{if(typeof window===\"undefined\")return;setTouch(!window.matchMedia?.(\"(hover: hover)\").matches);setReduce(!!window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches);},[]);// damped follow: scroll velocity pushes the layer a little, a spring brings it back (no visible overshoot)\nuseEffect(()=>{const outer=outerRef.current,layer=layerRef.current;if(!outer||!layer||isStatic||reduce||!pinned||!follow||typeof window===\"undefined\")return;let x=0,v=0,lastY=window.scrollY,raf=0;const isPinned=()=>{const r=outer.getBoundingClientRect();return r.top<=.5&&r.bottom>=window.innerHeight-.5;};const frame=()=>{// spring (k) and damping (c) tuned close to critical: settles in ~0.5 s, overshoot < 6 px\nv=v*.78-x*.09;x=Math.max(-24,Math.min(24,x+v));layer.style.transform=Math.abs(x)<.05?\"\":`translate3d(0, ${x.toFixed(2)}px, 0)`;if(Math.abs(x)>.05||Math.abs(v)>.05)raf=requestAnimationFrame(frame);else{raf=0;x=0;v=0;layer.style.transform=\"\";}};const onScroll=()=>{const y=window.scrollY,d=y-lastY;lastY=y;if(!isPinned())return;v-=Math.max(-40,Math.min(40,d))*.06;if(!raf)raf=requestAnimationFrame(frame);};window.addEventListener(\"scroll\",onScroll,{passive:true});return()=>{window.removeEventListener(\"scroll\",onScroll);if(raf)cancelAnimationFrame(raf);layer.style.transform=\"\";};},[isStatic,reduce,pinned,follow]);const t=reduce?\"none\":`background-color ${colorMs}ms ${INOUT}`;const extra=touch?runwayTouch:runway;return /*#__PURE__*/_jsx(\"div\",{ref:outerRef,id:id,\"aria-label\":label,role:label?\"region\":undefined,\"data-mf-pinned\":pinned?\"\":undefined,style:{...style,position:\"relative\",width:\"100%\",height:pinned&&!isStatic?`calc(100svh + ${extra}svh)`:\"auto\",background,transition:t},children:/*#__PURE__*/_jsx(\"div\",{style:{position:pinned&&!isStatic?\"sticky\":\"relative\",top:0,width:\"100%\",height:pinned&&!isStatic?\"100svh\":\"auto\",overflow:\"hidden\",background,transition:t},children:/*#__PURE__*/_jsx(\"div\",{ref:layerRef,style:{position:\"relative\",width:\"100%\",height:pinned&&!isStatic?\"100%\":\"auto\",willChange:pinned&&!reduce&&follow?\"transform\":undefined},children:children})})});}/**\n * Pinned Color Block\n *\n * Holds its content as one full-screen block that stays pinned while the\n * page scrolls through a short runway (the \"resistance\"), painted edge to\n * edge in one colour, so neighbouring sections never peek in. Put any frame\n * in the Content slot; animate the Background to change the colour.\n *\n * @framerIntrinsicWidth 1440\n * @framerIntrinsicHeight 900\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight auto\n */export default function PinnedColorBlock(props){const{content,background=\"#F9D9E1\",runway=70,runwayTouch=40,colorDuration=400}=props;const child=content?.[0];return /*#__PURE__*/_jsx(PinnedShell,{background:background,runway:runway,runwayTouch:runwayTouch,pinned:true,colorMs:colorDuration,style:props.style,children:/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"stretch\",justifyContent:\"stretch\"},children:child})});}addPropertyControls(PinnedColorBlock,{content:{type:ControlType.Slot,title:\"Content\",maxCount:1},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"#F9D9E1\"},runway:{type:ControlType.Number,title:\"Runway\",defaultValue:70,min:0,max:200,step:5,unit:\"svh\"},runwayTouch:{type:ControlType.Number,title:\"Runway Touch\",defaultValue:40,min:0,max:200,step:5,unit:\"svh\"},colorDuration:{type:ControlType.Number,title:\"Colour Fade\",defaultValue:400,min:0,max:2e3,step:50,unit:\"ms\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"PinnedShell\":{\"type\":\"reactComponent\",\"name\":\"PinnedShell\",\"slots\":[\"children\"],\"annotations\":{\"framerContractVersion\":\"1\"}},\"default\":{\"type\":\"reactComponent\",\"name\":\"PinnedColorBlock\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerIntrinsicWidth\":\"1440\",\"framerIntrinsicHeight\":\"900\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PinnedColorBlock.map"],"mappings":"A,8MAKG,SAAgBiB,EAAY,CAACC,aAAWC,SAAOC,cAAYC,SAAOC,UAAQC,WAASC,QAAMC,KAAGC,QAAMC,SAAO,IAAM,CAAC,IAAMC,EAASb,EAAoB,EAAQc,EAAS7B,EAAO,IAAI,EAAQ8B,EAAS9B,EAAO,IAAI,EAAO,CAAC+B,EAAMC,GAAU/B,EAAS,EAAK,EAAO,CAACgC,EAAOC,GAAWj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