{"version":3,"file":"ScrollTimeline.ByW8CHVt.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/HbwfTmsqHhjgPmiTikvd/IXmtykvPK03uGK0QCKLe/ScrollTimeline.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{motion,useScroll,useSpring,useTransform}from\"framer-motion\";import{useRef,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function ScrollTimeline(props){const{steps,lineColor,activeColor,textColor,activeTextColor,titleFont,descriptionFont,gap,lineThickness,dotSize,style,className}=props;const containerRef=useRef(null);const{scrollYProgress}=useScroll({target:containerRef,offset:[\"start center\",\"end center\"]});const scaleY=useSpring(scrollYProgress,{stiffness:100,damping:30,restDelta:.001});return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,className:className,style:{...style,display:\"flex\",flexDirection:\"column\",gap:gap,position:\"relative\",paddingLeft:dotSize/2+20},children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",left:dotSize/2-lineThickness/2,top:dotSize/2,bottom:dotSize/2,width:lineThickness,background:lineColor,borderRadius:lineThickness}}),/*#__PURE__*/_jsx(motion.div,{style:{position:\"absolute\",left:dotSize/2-lineThickness/2,top:dotSize/2,bottom:dotSize/2,width:lineThickness,background:activeColor,borderRadius:lineThickness,originY:0,scaleY:scaleY}}),steps.map((step,index)=>/*#__PURE__*/_jsx(TimelineItem,{step:step,index:index,total:steps.length,scrollYProgress:scrollYProgress,...props},index))]});}function TimelineItem({step,index,total,scrollYProgress,activeColor,lineColor,textColor,activeTextColor,titleFont,descriptionFont,dotSize,lineThickness}){const ref=useRef(null);const[isActive,setIsActive]=useState(false);// Calculate the threshold for this specific item\n// We want the item to become active when the scroll line passes its position\n// The line goes from top (0) to bottom (1).\n// Approximate position of this item in the list:\nconst threshold=index/(total-1||1);useTransform(scrollYProgress,value=>{// Add a small buffer so it activates slightly before the exact center line hits it\nif(typeof value===\"number\"){if(value>=threshold-.05&&!isActive){setIsActive(true);}else if(value<threshold-.05&&isActive){setIsActive(false);}}return value;});const handleClick=()=>{if(step.targetId){const element=document.getElementById(step.targetId);if(element){element.scrollIntoView({behavior:\"smooth\"});}}};return /*#__PURE__*/_jsxs(motion.div,{ref:ref,onClick:handleClick,whileHover:{scale:1.02},transition:{type:\"spring\",stiffness:400,damping:17},style:{position:\"relative\",display:\"flex\",flexDirection:\"column\",justifyContent:\"center\",minHeight:80,cursor:step.targetId?\"pointer\":\"default\",originX:0},children:[/*#__PURE__*/_jsx(motion.div,{initial:false,animate:{backgroundColor:isActive?activeColor:lineColor,scale:isActive?1.2:1,borderColor:isActive?activeColor:lineColor},style:{position:\"absolute\",left:-(dotSize/2+20)+(dotSize/2-dotSize/2),width:dotSize,height:dotSize,borderRadius:\"50%\",border:`2px solid ${lineColor}`,background:lineColor,zIndex:2}}),/*#__PURE__*/_jsxs(motion.div,{initial:false,animate:{opacity:isActive?1:.5,x:isActive?0:-10},transition:{duration:.4},style:{display:\"flex\",flexDirection:\"column\",gap:8},children:[/*#__PURE__*/_jsx(\"span\",{style:{...titleFont,color:isActive?activeTextColor:textColor,transition:\"color 0.3s ease\"},children:step.title}),/*#__PURE__*/_jsx(\"span\",{style:{...descriptionFont,color:textColor,opacity:.8},children:step.description})]})]});}addPropertyControls(ScrollTimeline,{steps:{type:ControlType.Array,title:\"Steps\",control:{type:ControlType.Object,controls:{title:{type:ControlType.String,defaultValue:\"Step Title\"},description:{type:ControlType.String,defaultValue:\"Description text goes here.\",displayTextArea:true},targetId:{type:ControlType.String,title:\"Target ID\",placeholder:\"section-id\"}}},defaultValue:[{title:\"Research\",description:\"Gathering requirements and understanding user needs.\"},{title:\"Design\",description:\"Creating wireframes and high-fidelity prototypes.\"},{title:\"Development\",description:\"Building the solution using modern technologies.\"},{title:\"Testing\",description:\"Ensuring quality and reliability of the product.\"},{title:\"Launch\",description:\"Deploying to production and monitoring metrics.\"}]},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:40,min:0,max:200},lineThickness:{type:ControlType.Number,title:\"Line Width\",defaultValue:4,min:1,max:20},dotSize:{type:ControlType.Number,title:\"Dot Size\",defaultValue:16,min:8,max:40},lineColor:{type:ControlType.Color,title:\"Base Color\",defaultValue:\"#E5E5E5\"},activeColor:{type:ControlType.Color,title:\"Active Color\",defaultValue:\"#0099FF\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#666666\"},activeTextColor:{type:ControlType.Color,title:\"Active Text\",defaultValue:\"#000000\"},titleFont:{type:ControlType.Font,title:\"Title Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:20,variant:\"Semibold\",lineHeight:1.2}},descriptionFont:{type:ControlType.Font,title:\"Desc Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:16,variant:\"Regular\",lineHeight:1.5}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollTimeline\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollTimeline.map"],"mappings":"+PAGG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,QAAM,YAAU,cAAY,YAAU,kBAAgB,YAAU,kBAAgB,MAAI,gBAAc,UAAQ,QAAM,aAAW,EAAY,EAAaA,EAAO,KAAK,CAAM,CAAC,mBAAiB,EAAU,CAAC,OAAO,EAAa,OAAO,CAAC,eAAe,aAAa,CAAC,CAAC,CAAO,EAAO,EAAU,EAAgB,CAAC,UAAU,IAAI,QAAQ,GAAG,UAAU,KAAK,CAAC,CAAC,OAAoB,EAAM,MAAM,CAAC,IAAI,EAAuB,YAAU,MAAM,CAAC,GAAG,EAAM,QAAQ,OAAO,cAAc,SAAa,MAAI,SAAS,WA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