{"version":3,"file":"ScrollProgress.D4GnEGNz.mjs","names":["useRef","useState","useEffect","startTransition","_jsx","__esmMin","init_ssg_sandbox_shims","te","window","_e","c","init_jsx_runtime","ce","init_npm_react_18_3_1","de","addPropertyControls","init_framer_ChujFWHC","useIsStaticRenderer","ControlType","ScrollProgress","props","color","backgroundColor","height","borderRadius","style","barRef","progress","setProgress","isStatic","scrollParent","el","overflowY","handleScroll","max","displayProgress","init_ScrollProgress"],"sources":["https:/framerusercontent.com/modules/FLTvvzyBjUM6DhIEfj1E/HTdXe3XZcloiPB7TJzKK/ScrollProgress.js"],"sourcesContent":["// Scroll Progress component that tracks the scroll progress of its immediate parent Stack, not the window\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * Scroll Progress - tracks the scroll of its parent Stack\n * @framerIntrinsicWidth 360\n * @framerIntrinsicHeight 8\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ScrollProgress(props){const{color,backgroundColor,height,borderRadius,style}=props;const barRef=useRef(null);const[progress,setProgress]=useState(0);const isStatic=useIsStaticRenderer();useEffect(()=>{if(isStatic)return;let scrollParent=null;if(barRef.current){// Traverse up to find scrollable parent (Stack)\nlet el=barRef.current.parentElement;while(el&&el!==document.body){const overflowY=window.getComputedStyle(el).overflowY;if(overflowY===\"auto\"||overflowY===\"scroll\"){scrollParent=el;break;}el=el.parentElement;}}if(!scrollParent)return;function handleScroll(){const max=scrollParent.scrollHeight-scrollParent.clientHeight;if(max<=0){startTransition(()=>setProgress(0));return;}startTransition(()=>setProgress(scrollParent.scrollTop/max));}handleScroll();scrollParent.addEventListener(\"scroll\",handleScroll);return()=>{scrollParent?.removeEventListener(\"scroll\",handleScroll);};},[isStatic]);// Animate width but show static at preview/canvas\nconst displayProgress=isStatic?0:progress;return /*#__PURE__*/_jsx(\"div\",{ref:barRef,style:{width:\"100%\",height,background:backgroundColor,borderRadius,position:\"relative\",overflow:\"hidden\",...style},\"aria-hidden\":true,children:/*#__PURE__*/_jsx(\"div\",{style:{width:`${displayProgress*100}%`,height:\"100%\",background:color,borderRadius,transition:isStatic?\"none\":\"width 0.45s cubic-bezier(0.33,1,0.68,1)\"}})});}addPropertyControls(ScrollProgress,{color:{type:ControlType.Color,title:\"Bar Color\",defaultValue:\"#0099FF\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#EEEEEE\"},height:{type:ControlType.Number,title:\"Height\",defaultValue:8,min:2,max:40,step:1,unit:\"px\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:24}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollProgress\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"8\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicWidth\":\"360\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollProgress.map"],"mappings":"A,qNAOG,SAAwBmB,EAAeC,EAAM,CAAC,GAAK,CAACC,QAAMC,kBAAgBC,SAAOC,eAAaC,SAAOL,EAAYM,EAAO1B,EAAO,IAAI,EAAO,CAAC2B,EAASC,GAAa3B,EAAS,CAAC,EAAQ4B,EAASZ,EAAoB,EAAEf,MAAc,CAAC,GAAG2B,EAAS,OAAO,IAAIC,EAAa,KAAK,GAAGJ,EAAO,QAAQ,CAC/R,IAAIK,EAAGL,EAAO,QAAQ,cAAc,KAAMK,GAAIA,IAAK,SAAS,MAAK,CAAC,IAAMC,EAAUxB,EAAO,iBAAiBuB,CAAE,CAAC,CAAC,UAAU,GAAGC,IAAY,QAAQA,IAAY,SAAS,CAACF,EAAaC,EAAG,KAAM,CAACA,EAAGA,EAAG,aAAc,CAAC,CAAC,GAAG,CAACD,EAA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