{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/rIpOhFvOVw901YsYvjkK/ws0v4KCZbbkeCKWPpuaW/ScrollIndicator.js"],
  "sourcesContent": ["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * Scroll Indicator that binds to a scrollable container by ID\n * \n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function ScrollIndicator(props){const{targetId,cardWidth,dotSize,dotSpacing,activeColor,inactiveColor,style,useDynamicDots,dotCount:fixedDotCount}=props;const[activeDot,setActiveDot]=useState(0);const[calculatedDotCount,setCalculatedDotCount]=useState(fixedDotCount);const scrollListenerRef=useRef();// Effect for initial scroll hint animation\nuseEffect(()=>{if(typeof window===\"undefined\"||RenderTarget.current()===RenderTarget.thumbnail)return;const targetElement=document.getElementById(targetId);if(!targetElement)return;// Add a small delay before starting the animation\nconst animationTimeout=setTimeout(()=>{// Scroll to +60px\ntargetElement.scrollTo({left:60,behavior:\"smooth\"});// Then scroll back to 0 after a short delay\nsetTimeout(()=>{targetElement.scrollTo({left:0,behavior:\"smooth\"});},500);},500);return()=>clearTimeout(animationTimeout);},[targetId]);// Main effect for scroll tracking\nuseEffect(()=>{if(typeof window===\"undefined\")return;const targetElement=document.getElementById(targetId);if(!targetElement)return;// Calculate the number of dots based on scrollable width\nconst calculateDotCount=()=>{if(!targetElement||!useDynamicDots)return;const scrollableWidth=targetElement.scrollWidth;const containerWidth=targetElement.clientWidth;// Calculate how many complete cards fit in the scrollable area\n// Add 1 because we need dots for partial views too\nconst totalCards=Math.ceil(scrollableWidth/cardWidth);const visibleCards=Math.floor(containerWidth/cardWidth);// The number of dots is the number of possible scroll positions\n// which is total cards minus visible cards plus 1\nconst newDotCount=Math.max(1,totalCards-visibleCards+1);startTransition(()=>{setCalculatedDotCount(newDotCount);});};const handleScroll=()=>{if(!targetElement)return;const scrollPosition=targetElement.scrollLeft;const maxScroll=targetElement.scrollWidth-targetElement.clientWidth;// Calculate active dot based on scroll percentage\nconst dots=useDynamicDots?calculatedDotCount:fixedDotCount;const scrollRatio=maxScroll>0?scrollPosition/maxScroll:0;const newActiveDot=Math.min(dots-1,Math.round(scrollRatio*(dots-1)));startTransition(()=>{setActiveDot(newActiveDot);});};// Calculate dot count initially\ncalculateDotCount();// Store the listener reference for cleanup\nscrollListenerRef.current=handleScroll;// Initial calculation of active dot\nhandleScroll();// Add scroll event listener\ntargetElement.addEventListener(\"scroll\",handleScroll);// No need for hint hiding logic anymore\n// Add resize listener to recalculate dot count if needed\nconst resizeObserver=new ResizeObserver(()=>{calculateDotCount();handleScroll();});resizeObserver.observe(targetElement);// Cleanup function\nreturn()=>{if(targetElement&&scrollListenerRef.current){targetElement.removeEventListener(\"scroll\",scrollListenerRef.current);// No need to remove hint scroll listener\n}resizeObserver.disconnect();};},[targetId,cardWidth,useDynamicDots,fixedDotCount,calculatedDotCount]);const handleDotClick=index=>{if(typeof window===\"undefined\")return;const targetElement=document.getElementById(targetId);if(!targetElement)return;const dots=useDynamicDots?calculatedDotCount:fixedDotCount;const maxScroll=targetElement.scrollWidth-targetElement.clientWidth;// Calculate the scroll position based on the dot index\n// For dynamic dots, we use the percentage of the way through the dots\nconst scrollPosition=dots>1?index/(dots-1)*maxScroll:0;targetElement.scrollTo({left:scrollPosition,behavior:\"smooth\"});};return /*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",justifyContent:\"center\",alignItems:\"center\",gap:dotSpacing,padding:\"10px 0\",position:\"relative\",...style},children:Array.from({length:useDynamicDots?calculatedDotCount:fixedDotCount}).map((_,index)=>/*#__PURE__*/_jsx(\"button\",{onClick:()=>handleDotClick(index),style:{width:dotSize,height:dotSize,borderRadius:\"50%\",backgroundColor:index===activeDot?activeColor:inactiveColor,border:\"none\",padding:0,cursor:\"pointer\",transition:\"background-color 0.3s ease\"},\"aria-label\":`Go to slide ${index+1}`,\"aria-current\":index===activeDot?\"true\":\"false\"},index))});}addPropertyControls(ScrollIndicator,{targetId:{type:ControlType.String,title:\"Target ID\",defaultValue:\"scroll-wrapper-trending\",placeholder:\"Enter element ID\"},useDynamicDots:{type:ControlType.Boolean,title:\"Dynamic Dots\",defaultValue:true,enabledTitle:\"Auto\",disabledTitle:\"Fixed\"},dotCount:{type:ControlType.Number,title:\"Dot Count\",defaultValue:5,min:1,max:20,step:1,hidden:({useDynamicDots})=>useDynamicDots},cardWidth:{type:ControlType.Number,title:\"Card Width\",defaultValue:300,min:50,max:1e3,step:10,unit:\"px\"},dotSize:{type:ControlType.Number,title:\"Dot Size\",defaultValue:10,min:4,max:20,step:1,unit:\"px\"},dotSpacing:{type:ControlType.Number,title:\"Dot Spacing\",defaultValue:8,min:2,max:30,step:1,unit:\"px\"},activeColor:{type:ControlType.Color,title:\"Active Color\",defaultValue:\"#000000\"},inactiveColor:{type:ControlType.Color,title:\"Inactive Color\",defaultValue:\"#CCCCCC\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollIndicator\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollIndicator.map"],
  "mappings": "qKAKkB,SAARA,EAAiCC,EAAM,CAAC,GAAK,CAAC,SAAAC,EAAS,UAAAC,EAAU,QAAAC,EAAQ,WAAAC,EAAW,YAAAC,EAAY,cAAAC,EAAc,MAAAC,EAAM,eAAAC,EAAe,SAASC,CAAa,EAAET,EAAW,CAACU,EAAUC,CAAY,EAAEC,EAAS,CAAC,EAAO,CAACC,EAAmBC,CAAqB,EAAEF,EAASH,CAAa,EAAQM,EAAkBC,EAAO,EAC5TC,EAAU,IAAI,CAAC,GAAG,OAAOC,EAAS,KAAaC,EAAa,QAAQ,IAAIA,EAAa,UAAU,OAAO,IAAMC,EAA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AO,EAAE,SAAS,CAAC,KAAKA,EAAY,OAAO,MAAM,YAAY,aAAa,EAAE,IAAI,EAAE,IAAI,GAAG,KAAK,EAAE,OAAO,CAAC,CAAC,eAAAjC,CAAc,IAAIA,CAAc,EAAE,UAAU,CAAC,KAAKiC,EAAY,OAAO,MAAM,aAAa,aAAa,IAAI,IAAI,GAAG,IAAI,IAAI,KAAK,GAAG,KAAK,IAAI,EAAE,QAAQ,CAAC,KAAKA,EAAY,OAAO,MAAM,WAAW,aAAa,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,EAAE,KAAK,IAAI,EAAE,WAAW,CAAC,KAAKA,EAAY,OAAO,MAAM,cAAc,aAAa,EAAE,IAAI,EAAE,IAAI,GAAG,KAAK,EAAE,KAAK,IAAI,EAAE,YAAY,CAAC,KAAKA,EAAY,MAAM,MAAM,eAAe,aAAa,SAAS,EAAE,cAAc,CAAC,KAAKA,EAAY,MAAM,MAAM,iBAAiB,aAAa,SAAS,CAAC,CAAC",
  "names": ["ScrollIndicator", "props", "targetId", "cardWidth", "dotSize", "dotSpacing", "activeColor", "inactiveColor", "style", "useDynamicDots", "fixedDotCount", "activeDot", "setActiveDot", "ye", "calculatedDotCount", "setCalculatedDotCount", "scrollListenerRef", "pe", "ue", "window", "RenderTarget", "targetElement", "animationTimeout", "calculateDotCount", "scrollableWidth", "containerWidth", "totalCards", "visibleCards", "newDotCount", "Z", "handleScroll", "scrollPosition", "maxScroll", "dots", "scrollRatio", "newActiveDot", "resizeObserver", "handleDotClick", "index", "p", "_", "addPropertyControls", "ControlType"]
}
