{"version":3,"file":"ScrollProgress.CJNumW7R.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/dkrmm0GbqLNfS2R2qabY/pnb0sDTUJMHkYYBMwwwc/ScrollProgress.js"],"sourcesContent":["// Vertical Progress Line with Circles and Scroll Fill\n// Replicates the attached image: gray vertical line with circles, orange fill animates as you scroll\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useRef,useEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Vertical Progress Line with Circles and Scroll Fill\n *\n * @framerIntrinsicWidth 48\n * @framerIntrinsicHeight 600\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ScrollProgress(props){const{backgroundColor,fillColor,circleColor,fillCircleColor,circleCount,progress,lineWidth,circleSize,gap,style}=props;// Clamp progress between 0 and 1\nconst clampedProgress=Math.max(0,Math.min(1,progress));// --- SCROLL ANIMATION LOGIC ---\nconst ref=useRef(null);const[scrollProgress,setScrollProgress]=useState(0);useEffect(()=>{function onScroll(){if(!ref.current)return;const rect=ref.current.getBoundingClientRect();const windowHeight=window.innerHeight||document.documentElement.clientHeight;const total=rect.height;// Calculate how much of the component is above the center of the viewport\nconst centerY=windowHeight/2;let prog=0;if(rect.top<centerY&&rect.bottom>centerY){// Center is within the component\nprog=(centerY-rect.top)/total;}else if(rect.bottom<=centerY){// Center is below the component (scrolled past)\nprog=1;}else if(rect.top>=centerY){// Center is above the component (not reached)\nprog=0;}prog=Math.max(0,Math.min(1,prog));startTransition(()=>setScrollProgress(prog));}if(typeof window!==\"undefined\"){window.addEventListener(\"scroll\",onScroll,{passive:true});onScroll();return()=>window.removeEventListener(\"scroll\",onScroll);}},[]);// Use scrollProgress if in browser, else fallback to prop\nconst animatedProgress=typeof window!==\"undefined\"?scrollProgress:clampedProgress;// Calculate total height\nconst totalLineHeight=(circleCount-1)*gap+circleCount*circleSize;// Calculate fill height\nconst fillHeight=animatedProgress*totalLineHeight;// For gradient at the top of the fill\nconst gradientHeight=Math.min(32,fillHeight);// Render circles\nconst circles=Array.from({length:circleCount}).map((_,i)=>{const y=i*(gap+circleSize);const isFilled=fillHeight>=y+circleSize/2;return /*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",left:\"50%\",top:y,transform:`translate(-50%, 0)`,width:circleSize,height:circleSize,borderRadius:\"50%\",background:isFilled?fillCircleColor:circleColor,boxShadow:`0 0 0 ${props.circleBorderWidth??2}px #fff`}},i);});return /*#__PURE__*/_jsxs(\"div\",{ref:ref,style:{position:\"relative\",width:circleSize*2,height:props.height??totalLineHeight,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",...style},children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",left:\"50%\",top:0,width:lineWidth,height:totalLineHeight,background:backgroundColor,borderRadius:lineWidth/2,transform:`translateX(-50%)`}}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",left:\"50%\",top:0,width:lineWidth,height:fillHeight,background:`linear-gradient(to bottom, ${fillColor} 80%, ${fillColor} 100%)`,borderRadius:lineWidth/2,transform:`translateX(-50%)`,overflow:\"hidden\"},children:fillHeight>gradientHeight&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:gradientHeight,background:`linear-gradient(to bottom, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0) 100%)`,pointerEvents:\"none\"}})}),circles]});}addPropertyControls(ScrollProgress,{backgroundColor:{type:ControlType.Color,title:\"Line Color\",defaultValue:\"#F1F1F6\"},fillColor:{type:ControlType.Color,title:\"Fill Color\",defaultValue:\"#FF7A00\"},circleColor:{type:ControlType.Color,title:\"Circle Color\",defaultValue:\"#F1F1F6\"},fillCircleColor:{type:ControlType.Color,title:\"Fill Circle\",defaultValue:\"#FF7A00\"},circleCount:{type:ControlType.Number,title:\"Circles\",defaultValue:4,min:2,max:10,step:1,displayStepper:true},progress:{type:ControlType.Number,title:\"Progress\",defaultValue:.5,min:0,max:1,step:.01,displayStepper:true},lineWidth:{type:ControlType.Number,title:\"Line Width\",defaultValue:10,min:2,max:32,step:1},circleSize:{type:ControlType.Number,title:\"Circle Size\",defaultValue:20,min:8,max:48,step:1},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:120,min:20,max:500,step:1},height:{type:ControlType.Number,title:\"Height\",defaultValue:600,min:200,max:2e3,step:10},circleBorderWidth:{type:ControlType.Number,title:\"Circle Border\",defaultValue:2,min:0,max:16,step:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollProgress\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"600\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"48\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollProgress.map"],"mappings":"wUAUG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,kBAAgB,YAAU,cAAY,kBAAgB,cAAY,WAAS,YAAU,aAAW,MAAI,SAAO,EAC5J,EAAgB,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,EAAS,CAAC,CAChD,EAAIA,EAAO,KAAK,CAAM,CAAC,EAAe,GAAmBC,EAAS,EAAE,CAAC,MAAc,CAAC,SAAS,GAAU,CAAC,GAAG,CAAC,EAAI,QAAQ,OAAO,IAAM,EAAK,EAAI,QAAQ,uBAAuB,CAAO,EAAa,EAAO,aAAa,SAAS,gBAAgB,aAAmB,EAAM,EAAK,OAC5Q,EAAQ,EAAa,EAAM,EAAK,EAAK,EAAK,IAAI,GAAS,EAAK,OAAO,EACzE,GAAM,EAAQ,EAAK,KAAK,EAAe,EAAK,QAAQ,EACpD,EAAK,EAAW,EAAK,KAAK,IAC1B,EAAK,GAAG,EAAK,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,EAAK,CAAC,CAAC,MAAoB,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