{"version":3,"file":"ScrollProgress.DMeVEcnx.mjs","names":["useRef","useState","__esmMin","init_ssg_sandbox_shims","te","window","_e","c","init_jsx_runtime","ce","init_npm_react_18_3_1","de","addPropertyControls","init_framer_BWFVvmND","useIsStaticRenderer","ControlType","ScrollProgress","props","barRef","progress","setProgress","isStatic","scrollParent","el","overflowY","handleScroll","max","displayProgress","backgroundColor","style","color","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,SAAwBgB,EAAe,EAAM,CAAC,GAAK,CAAC,QAAM,kBAAgB,SAAO,eAAa,SAAOC,EAAYC,EAAOlB,EAAO,IAAI,EAAO,CAACmB,EAASC,GAAanB,EAAS,CAAC,EAAQoB,EAASP,EAAoB,EAAEL,MAAc,CAAC,GAAGY,EAAS,OAAO,IAAIC,EAAa,KAAK,GAAGJ,EAAO,QAAQ,CAC/R,IAAIK,EAAGL,EAAO,QAAQ,cAAc,KAAMK,GAAIA,IAAK,SAAS,MAAK,CAAC,IAAMC,EAAUnB,EAAO,iBAAiBkB,CAAE,CAAC,CAAC,UAAU,GAAGC,IAAY,QAAQA,IAAY,SAAS,CAAC,EAAaD,EAAG,KAAM,CAAC,EAAGA,EAAG,aAAc,CAAC,CAAC,GAAG,CAACD,EAAa,OAAO,SAASG,GAAc,CAAC,IAAMC,EAAIJ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