{"version":3,"file":"ScrollProgressBar.DPdoJsX1.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/QFkVHF9O7PgICwULYIDA/cQ5RVvUTE0pwl8Kf0Odv/ScrollProgressBar.js"],"sourcesContent":["// 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 *\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 8\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ScrollProgressBar(props){const{backgroundColor,fillColor,height,borderRadius,style}=props;const[progress,setProgress]=useState(0);const ticking=useRef(false);useEffect(()=>{function updateProgress(){if(typeof window===\"undefined\"||typeof document===\"undefined\")return;const scrollTop=window.scrollY||document.documentElement.scrollTop;const docHeight=document.documentElement.scrollHeight-window.innerHeight;const percent=docHeight>0?Math.min(1,Math.max(0,scrollTop/docHeight)):0;startTransition(()=>setProgress(percent));ticking.current=false;}function onScroll(){if(!ticking.current){window.requestAnimationFrame(updateProgress);ticking.current=true;}}window.addEventListener(\"scroll\",onScroll,{passive:true});updateProgress();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:fillColor,borderRadius,transition:\"width 0.15s 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\"},fillColor:{type:ControlType.Color,title:\"Fill Color\",defaultValue:\"#0099FF\"},height:{type:ControlType.Number,title:\"Height\",defaultValue:8,min:2,max:32,unit:\"px\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:32,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollProgressBar\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicWidth\":\"600\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"8\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollProgressBar.map"],"mappings":"wMASG,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,kBAAgB,YAAU,SAAO,eAAa,SAAO,EAAW,CAAC,EAAS,GAAaA,EAAS,CAAC,EAAQ,EAAQC,EAAO,EAAK,EAA2nB,OAAznB,MAAc,CAAC,SAAS,GAAgB,CAAC,GAAU,IAAS,QAAa,OAAO,SAAW,IAAY,OAAO,IAAM,EAAU,EAAO,SAAS,SAAS,gBAAgB,UAAgB,EAAU,SAAS,gBAAgB,aAAa,EAAO,YAAkB,EAAQ,EAAU,EAAE,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,EAAU,CAAS,CAAC,EAAE,EAAE,MAAoB,EAAY,CAAO,CAAC,EAAE,EAAQ,QAAQ,EAAM,CAAC,SAAS,GAAU,CAAC,AAAkE,EAAQ,WAArD,EAAO,sBAAsB,CAAc,EAAkB,GAAM,CAA4E,OAA3E,EAAO,iBAAiB,SAAS,EAAS,CAAC,QAAQ,EAAI,CAAC,EAAE,EAAe,MAAY,EAAO,oBAAoB,SAAS,CAAQ,CAAE,EAAE,CAAC,CAAC,EAAsB,EAAK,MAAM,CAAC,MAAM,CAAC,GAAG,EAAM,MAAM,OAAO,SAAO,WAAW,EAAgB,eAAa,SAAS,SAAS,SAAS,UAAU,EAAE,SAAsB,EAAK,MAAM,CAAC,MAAM,CAAC,OAAO,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