{"version":3,"file":"ScrollProgressBar.6RIQLdd3.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/oCyH5wAgqfXs8LAFlFz6/b0yRL1T2S0EnhgVAudIn/ScrollProgressBar.js"],"sourcesContent":["// Scroll Progress Bar with customizable colors\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * Scroll Progress Bar\n * Shows a progress bar that fills as you scroll the page. Colors are customizable.\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,style}=props;const[progress,setProgress]=useState(0);useEffect(()=>{if(typeof window===\"undefined\")return;function onScroll(){const scrollTop=window.scrollY||window.pageYOffset;const docHeight=document.documentElement.scrollHeight-window.innerHeight;const percent=docHeight>0?Math.min(1,Math.max(0,scrollTop/docHeight)):0;startTransition(()=>setProgress(percent));}window.addEventListener(\"scroll\",onScroll,{passive:true});onScroll();return()=>window.removeEventListener(\"scroll\",onScroll);},[]);if(RenderTarget.current()===RenderTarget.thumbnail)return null;return /*#__PURE__*/_jsx(\"div\",{style:{...style,width:\"100%\",height:props.height,background:backgroundColor,borderRadius:0,overflow:\"hidden\",position:\"relative\"},children:/*#__PURE__*/_jsx(\"div\",{style:{height:\"100%\",width:`${progress*100}%`,background:fillColor,borderRadius:0,transition:\"none\",position:\"absolute\",left:0,top:0},\"aria-valuenow\":Math.round(progress*100),\"aria-valuemin\":0,\"aria-valuemax\":100,role:\"progressbar\"})});}addPropertyControls(ScrollProgressBar,{height:{type:ControlType.Number,title:\"Height\",defaultValue:8,min:2,max:40,unit:\"px\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#EEEEEE\"},fillColor:{type:ControlType.Color,title:\"Fill\",defaultValue:\"#0099FF\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollProgressBar\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"8\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"600\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollProgressBar.map"],"mappings":"6MAUG,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,kBAAgB,YAAU,SAAO,EAAW,CAAC,EAAS,GAAaA,EAAS,EAAE,CAA2f,OAA1f,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,SAAS,GAAU,CAAC,IAAM,EAAU,EAAO,SAAS,EAAO,YAAkB,EAAU,SAAS,gBAAgB,aAAa,EAAO,YAAkB,EAAQ,EAAU,EAAE,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,EAAU,EAAU,CAAC,CAAC,EAAE,MAAoB,EAAY,EAAQ,CAAC,CAAuE,OAArE,EAAO,iBAAiB,SAAS,EAAS,CAAC,QAAQ,GAAK,CAAC,CAAC,GAAU,KAAW,EAAO,oBAAoB,SAAS,EAAS,EAAG,EAAE,CAAC,CAAI,EAAa,SAAS,GAAG,EAAa,UAAiB,KAAyB,EAAK,MAAM,CAAC,MAAM,CAAC,GAAG,EAAM,MAAM,OAAO,OAAO,EAAM,OAAO,WAAW,EAAgB,aAAa,EAAE,SAAS,SAAS,SAAS,WAAW,CAAC,SAAsB,EAAK,MAAM,CAAC,MAAM,CAAC,OAAO,OAAO,MAAM,GAAG,EAAS,IAAI,GAAG,WAAW,EAAU,aAAa,EAAE,WAAW,OAAO,SAAS,WAAW,KAAK,EAAE,IAAI,EAAE,CAAC,gBAAgB,KAAK,MAAM,EAAS,IAAI,CAAC,gBAAgB,EAAE,gBAAgB,IAAI,KAAK,cAAc,CAAC,CAAC,CAAC,sBATvgC,IAAsD,IAAiE,CASk5B,EAAoB,EAAkB,CAAC,OAAO,CAAC,KAAK,EAAY,OAAO,MAAM,SAAS,aAAa,EAAE,IAAI,EAAE,IAAI,GAAG,KAAK,KAAK,CAAC,gBAAgB,CAAC,KAAK,EAAY,MAAM,MAAM,aAAa,aAAa,UAAU,CAAC,UAAU,CAAC,KAAK,EAAY,MAAM,MAAM,OAAO,aAAa,UAAU,CAAC,CAAC"}