{"version":3,"file":"ScrollProgressIndicator_2.B8sQ_T0h.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/0R25sbYRu38P7YtVtxPr/52vhN6k8YT2gVdGGOOIw/ScrollProgressIndicator_2.js"],"sourcesContent":["// Page Scroll Progress Indicator\n// Horizontal line at the top that fills as user scrolls, with solid or gradient fill\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer,RenderTarget}from\"framer\";/**\n * Page Scroll Progress Indicator\n *\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 8\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ScrollProgressIndicator(props){const{fillType,solidColor,gradientStart,gradientEnd,height,background,borderRadius,style}=props;const[progress,setProgress]=useState(0);const[ariaProgress,setAriaProgress]=useState(0);const isStatic=useIsStaticRenderer();const fillRef=useRef(null);const containerRef=useRef(null);const rafRef=useRef(null);// Calculate scroll progress\nuseEffect(()=>{if(isStatic||typeof window===\"undefined\")return;function applyProgress(){const scrollTop=window.scrollY||window.pageYOffset;const docHeight=document.documentElement.scrollHeight-window.innerHeight;const percent=docHeight>0?Math.min(Math.max(scrollTop/docHeight,0),1):0;// Update bar without re-rendering for performance\nif(fillRef.current){fillRef.current.style.transform=`scaleX(${percent})`;}// Keep aria in sync (throttled by rAF)\nconst ariaValue=Math.round(percent*100);startTransition(()=>setAriaProgress(ariaValue));startTransition(()=>setProgress(percent));}function onScroll(){if(rafRef.current!=null)return;rafRef.current=window.requestAnimationFrame(()=>{rafRef.current=null;applyProgress();});}// Set up scroll listener\nwindow.addEventListener(\"scroll\",onScroll,{passive:true});// Initial calculation\napplyProgress();return()=>{window.removeEventListener(\"scroll\",onScroll);if(rafRef.current!=null)window.cancelAnimationFrame(rafRef.current);};},[isStatic]);// Fill style\nconst fillStyle={position:\"absolute\",top:0,left:0,height,width:\"100%\",borderRadius,transformOrigin:\"0% 50%\",transform:`scaleX(${progress})`,willChange:\"transform\",background:fillType===\"solid\"?solidColor:`linear-gradient(90deg, ${gradientStart}, ${gradientEnd})`};// Container style\nconst containerStyle={position:\"relative\",width:\"100%\",height,background,borderRadius,overflow:\"visible\",...style};// Hide in thumbnail\nif(RenderTarget.current()===RenderTarget.thumbnail)return null;return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:containerStyle,\"aria-label\":\"Scroll progress bar\",role:\"progressbar\",\"aria-valuenow\":ariaProgress,\"aria-valuemin\":0,\"aria-valuemax\":100,children:/*#__PURE__*/_jsx(\"div\",{ref:fillRef,style:fillStyle})});}addPropertyControls(ScrollProgressIndicator,{fillType:{type:ControlType.Enum,title:\"Fill Type\",options:[\"solid\",\"gradient\"],optionTitles:[\"Solid\",\"Gradient\"],defaultValue:\"solid\",displaySegmentedControl:true},solidColor:{type:ControlType.Color,title:\"Solid Color\",defaultValue:\"#0099FF\",hidden:({fillType})=>fillType!==\"solid\"},gradientStart:{type:ControlType.Color,title:\"Gradient Start\",defaultValue:\"#0099FF\",hidden:({fillType})=>fillType!==\"gradient\"},gradientEnd:{type:ControlType.Color,title:\"Gradient End\",defaultValue:\"#8855FF\",hidden:({fillType})=>fillType!==\"gradient\"},height:{type:ControlType.Number,title:\"Height\",defaultValue:8,min:2,max:32,unit:\"px\"},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"#EEEEEE\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:4,min:0,max:32,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollProgressIndicator\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"8\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"600\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Scr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