{"version":3,"file":"ScrollProgressBar.BinAWkEl.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/cQFaOKSJfgnNumVwDWps/ByAjz96NesKWNOcQBShU/ScrollProgressBar.js"],"sourcesContent":["// Simple scroll progress bar with customizable colors and radius\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Scroll Progress Bar\n *\n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 12\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ScrollProgressBar(props){const{backgroundColor,progressColor,borderRadius,height,style}=props;const[progress,setProgress]=useState(0);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;let percent=docHeight>0?Math.min(1,Math.max(0,scrollTop/docHeight)):0;// If at bottom, always show 100%\nif(window.innerHeight+scrollTop>=document.documentElement.scrollHeight-2){percent=1;}startTransition(()=>setProgress(percent));}updateProgress();if(typeof window!==\"undefined\"){window.addEventListener(\"scroll\",updateProgress,{passive:true});window.addEventListener(\"resize\",updateProgress);return()=>{window.removeEventListener(\"scroll\",updateProgress);window.removeEventListener(\"resize\",updateProgress);};}return()=>{};},[]);return /*#__PURE__*/_jsx(\"div\",{style:{...style,width:\"100%\",height:typeof height===\"number\"?`${height}px`:height,background:backgroundColor,borderRadius,overflow:\"hidden\",position:\"relative\",minWidth:40,minHeight:4,opacity:typeof props.opacity===\"number\"?props.opacity:1},children:/*#__PURE__*/_jsx(\"div\",{style:{height:\"100%\",width:`${progress*100}%`,background:progressColor,borderRadius,transition:`width ${props.duration||.2}s ${props.easing||\"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\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:32},height:{type:ControlType.Number,title:\"Height\",defaultValue:12,min:2,max:40,unit:\"px\"},opacity:{type:ControlType.Number,title:\"Opacity\",defaultValue:1,min:0,max:1,step:.01},easing:{type:ControlType.String,title:\"Easing\",defaultValue:\"cubic-bezier(.4,1,.4,1)\",placeholder:\"CSS Easing\"},duration:{type:ControlType.Number,title:\"Duration (s)\",defaultValue:.2,min:.05,max:2,step:.01}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollProgressBar\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"400\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"12\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollProgressBar.map"],"mappings":"sMASG,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,kBAAgB,gBAAc,eAAa,SAAO,SAAO,EAAW,CAAC,EAAS,GAAaA,EAAS,EAAE,CAC2Q,OAD1Q,MAAc,CAAC,SAAS,GAAgB,CAAC,GAAU,IAAS,QAAa,OAAO,SAAW,IAAY,OAAO,IAAM,EAAU,EAAO,SAAS,SAAS,gBAAgB,UAAgB,EAAU,SAAS,gBAAgB,aAAa,EAAO,YAAgB,EAAQ,EAAU,EAAE,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,EAAU,EAAU,CAAC,CAAC,EAC5d,EAAO,YAAY,GAAW,SAAS,gBAAgB,aAAa,IAAG,EAAQ,GAAG,MAAoB,EAAY,EAAQ,CAAC,CAA0R,OAAxR,GAAgB,CAAW,IAAS,WAA8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