{"version":3,"file":"ScrollProgressBar.DIundF6h.mjs","names":["useState","useRef","useState","useRef"],"sources":["https:/framerusercontent.com/modules/ee8Fi6EE1dizTE6MeZik/x0dT6TcSwq2k7yEIQrIE/Scroll_progress.js","https:/framerusercontent.com/modules/wFfhoItMJmZAqOP2gJlg/Y8Ygy20rvb9HKDANrIXM/ScrollProgressBar.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,useRef}from\"react\";export function withProgress(Component){return props=>{const[progress,setProgress]=useState(0);const[isScrolling,setIsScrolling]=useState(false);const prevScrollY=useRef(0);useEffect(()=>{const calculateProgress=()=>{const startEl=document.getElementById(\"start\");const endEl=document.getElementById(\"end\");if(startEl&&endEl){const sectionHeight=endEl.offsetTop-startEl.offsetTop;const scrollDistance=window.pageYOffset||document.documentElement.scrollTop;const sectionScrollDistance=scrollDistance-startEl.offsetTop;const sectionProgress=sectionScrollDistance/sectionHeight*120// Adjusted to 100 for percentage\n;setProgress(Math.min(Math.max(sectionProgress,0),100))// Ensure progress is between 0 and 100\n;}};const handleScroll=()=>{const scrollY=window.pageYOffset||document.documentElement.scrollTop;if(scrollY!==prevScrollY.current){prevScrollY.current=scrollY;calculateProgress();setIsScrolling(true);}};const handleScrollEnd=()=>{setIsScrolling(false);};calculateProgress();window.addEventListener(\"scroll\",handleScroll);window.addEventListener(\"scrollend\",handleScrollEnd);return()=>{window.removeEventListener(\"scroll\",handleScroll);window.removeEventListener(\"scrollend\",handleScrollEnd);};},[]);return /*#__PURE__*/_jsx(Component,{...props,style:{width:`${progress}%`,transition:isScrolling?\"none\":\"width 0.4s ease-in-out\",position:\"fixed\",top:0,left:0,height:\"8px\",backgroundColor:\"#FEF4C6\",zIndex:9999}});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withProgress\":{\"type\":\"reactHoc\",\"name\":\"withProgress\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Scroll_progress.map","// Simple scroll progress bar with customizable colors and radius\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Scroll Progress Bar\n * Shows a progress bar at the top of the page that fills as you scroll.\n *\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 8\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ScrollProgressBar(props){const{backgroundColor,progressColor,height,borderRadius,style}=props;const[progress,setProgress]=useState(0);const ticking=useRef(false);useEffect(()=>{function onScroll(){if(!ticking.current){window.requestAnimationFrame(()=>{const scrollTop=window.scrollY||window.pageYOffset;const docHeight=document.documentElement.scrollHeight-window.innerHeight;const percent=docHeight>0?Math.min(1,scrollTop/docHeight):0;startTransition(()=>setProgress(percent));ticking.current=false;});ticking.current=true;}}if(typeof window!==\"undefined\"){window.addEventListener(\"scroll\",onScroll,{passive:true});onScroll();return()=>window.removeEventListener(\"scroll\",onScroll);}},[]);return /*#__PURE__*/_jsx(\"div\",{style:{...style,width:\"100%\",height,background:backgroundColor,borderRadius,overflow:\"hidden\",position:\"relative\"},children:/*#__PURE__*/_jsx(\"div\",{style:{height:\"100%\",width:`${progress*100}%`,background:progressColor,borderRadius,transition:\"width 0.2s cubic-bezier(.4,1,.4,1)\",position:\"absolute\",left:0,top:0},\"aria-valuenow\":Math.round(progress*100),\"aria-valuemin\":0,\"aria-valuemax\":100,role:\"progressbar\"})});}addPropertyControls(ScrollProgressBar,{backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#EEEEEE\"},progressColor:{type:ControlType.Color,title:\"Progress\",defaultValue:\"#0099FF\"},height:{type:ControlType.Number,title:\"Height\",defaultValue:8,min:2,max:32,unit:\"px\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:0,min:0,max:0,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollProgressBar\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"8\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"400\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollProgressBar.map"],"mappings":"iUAAwF,SAAgB,EAAa,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,EAAS,EAAY,CAACE,EAAS,GAAQ,CAAC,EAAY,EAAe,CAACA,EAAS,IAAa,EAAYC,EAAO,GAEiP,OAF9O,MAAc,CAAC,IAAM,MAAsB,CAAC,IAAM,EAAQ,SAAS,eAAe,SAAe,EAAM,SAAS,eAAe,OAAO,GAAG,GAAS,EAAM,CAAC,IAAM,EAAc,EAAM,UAAU,EAAQ,UAAgB,EAAe,EAAO,aAAa,SAAS,gBAAgB,UAAgB,EAAsB,EAAe,EAAQ,UAAgB,EAAgB,EAAsB,EAAc,IACtpB,EAAY,KAAK,IAAI,KAAK,IAAI,EAAgB,GAAG,KAChD,CAAC,EAAO,MAAiB,CAAC,IAAM,EAAQ,EAAO,aAAa,SAAS,gBAAgB,UAAa,IAAU,EAAY,UAAS,EAAY,QAAQ,EAAQ,IAAoB,EAAe,IAAQ,EAAO,MAAoB,CAAC,EAAe,GAAQ,EAAyH,OAAxH,IAAoB,EAAO,iBAAiB,SAAS,GAAc,EAAO,iBAAiB,YAAY,OAA2B,CAAC,EAAO,oBAAoB,SAAS,GAAc,EAAO,oBAAoB,YAAY,EAAkB,CAAE,EAAC,EAAE,EAAsB,EAAK,EAAU,CAAC,GAAG,EAAM,MAAM,CAAC,MAAM,GAAG,EAAS,GAAG,WAAW,EAAY,OAAO,yBAAyB,SAAS,QAAQ,IAAI,EAAE,KAAK,EAAE,OAAO,MAAM,gBAAgB,UAAU,OAAO,KAAK,CAAC,CAAG,CAAE,8BCQvsB,SAAwB,EA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