{"version":3,"file":"LogoTicker_1.BuiCyHfb.mjs","names":["useMemo","useState","useRef"],"sources":["https:/framerusercontent.com/modules/0zFBeI5yF8yAyq3DdFfS/6m38H9NiL66DKtUnmcsC/LogoTicker_1.js"],"sourcesContent":["// Bar pass logos like a ticker\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useMemo,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{motion,useAnimationFrame}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function LogoTicker(props){const{mode=\"components\",components=[],textItems=[\"Item 1\",\"Item 2\",\"Item 3\"],textFont,textColor=\"#000000\",speed=50,gap=40,itemHeight=60,backgroundColor=\"#FFFFFF\",pauseOnHover=true}=props;const dotColor=\"#1C80EE\";const baseItems=useMemo(()=>{return mode===\"text\"?textItems.filter(Boolean):components;},[components,mode,textItems]);const itemsWithDots=useMemo(()=>{if(baseItems.length===0)return[];const out=[];for(let i=0;i<baseItems.length;i++){const node=mode===\"text\"?/*#__PURE__*/_jsx(\"span\",{style:{...textFont,color:textColor,whiteSpace:\"nowrap\",width:\"max-content\"},children:String(baseItems[i]??\"\")}):baseItems[i];out.push({key:`item-${i}`,node});if(i!==baseItems.length-1){out.push({key:`dot-${i}`,node:/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{width:6,height:6,borderRadius:999,backgroundColor:dotColor,flexShrink:0,display:\"inline-block\"}})});}}return out;},[baseItems,dotColor,mode,textColor,textFont]);const[offset,setOffset]=useState(0);const[isPaused,setIsPaused]=useState(false);const containerRef=useRef(null);const contentRef=useRef(null);const[contentWidth,setContentWidth]=useState(0);const isStatic=RenderTarget.current()===RenderTarget.thumbnail;useEffect(()=>{if(typeof window===\"undefined\"||!contentRef.current)return;const updateWidth=()=>{if(contentRef.current){// Calculate total width of one set of components including gaps\nconst children=Array.from(contentRef.current.children).slice(0,itemsWithDots.length);let totalWidth=0;children.forEach(child=>{totalWidth+=child.offsetWidth;});totalWidth+=gap*(itemsWithDots.length-1);startTransition(()=>{setContentWidth(totalWidth);});}};// Use setTimeout to ensure components are rendered\nconst timer=setTimeout(updateWidth,100);window.addEventListener(\"resize\",updateWidth);return()=>{clearTimeout(timer);window.removeEventListener(\"resize\",updateWidth);};},[gap,itemsWithDots.length]);useAnimationFrame((time,delta)=>{if(isStatic||isPaused||!contentWidth)return;startTransition(()=>{setOffset(prev=>{const newOffset=prev+speed*delta/1e3;// Seamless loop: reset when we've scrolled one full set\nreturn newOffset%contentWidth;});});});const handleMouseEnter=()=>{if(pauseOnHover&&!isStatic){startTransition(()=>setIsPaused(true));}};const handleMouseLeave=()=>{if(pauseOnHover&&!isStatic){startTransition(()=>setIsPaused(false));}};// Duplicate items multiple times for seamless loop\nconst duplicatedItems=[...itemsWithDots,...itemsWithDots,...itemsWithDots];return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:\"100%\",height:\"100%\",backgroundColor,overflow:\"hidden\",position:\"relative\",display:\"flex\",alignItems:\"center\"},onMouseEnter:handleMouseEnter,onMouseLeave:handleMouseLeave,children:/*#__PURE__*/_jsx(motion.div,{ref:contentRef,style:{display:\"flex\",gap:`${gap}px`,position:\"absolute\",left:0,transform:`translateX(-${offset}px)`,willChange:\"transform\"},children:duplicatedItems.map((item,index)=>/*#__PURE__*/_jsx(\"div\",{style:{height:`${itemHeight}px`,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",flexShrink:0},children:item.node},`${item.key}-${index}`))})});}addPropertyControls(LogoTicker,{mode:{type:ControlType.Enum,title:\"Mode\",options:[\"components\",\"text\"],optionTitles:[\"Components\",\"Text\"],defaultValue:\"components\",displaySegmentedControl:true},components:{type:ControlType.Array,title:\"Components\",control:{type:ControlType.ComponentInstance},maxCount:20,hidden:({mode})=>mode!==\"components\"},textItems:{type:ControlType.Array,title:\"Text\",control:{type:ControlType.String,defaultValue:\"Item\"},defaultValue:[\"Item 1\",\"Item 2\",\"Item 3\"],maxCount:30,hidden:({mode})=>mode!==\"text\"},textFont:{type:ControlType.Font,title:\"Text Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"},hidden:({mode})=>mode!==\"text\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\",hidden:({mode})=>mode!==\"text\"},speed:{type:ControlType.Number,title:\"Speed\",defaultValue:50,min:10,max:200,step:10,unit:\"px/s\"},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:40,min:10,max:100,step:5,unit:\"px\"},itemHeight:{type:ControlType.Number,title:\"Item Height\",defaultValue:60,min:20,max:200,step:5,unit:\"px\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},pauseOnHover:{type:ControlType.Boolean,title:\"Pause on Hover\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LogoTicker\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LogoTicker_1.map"],"mappings":"mRAIG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,OAAK,aAAa,aAAW,CAAC,EAAE,YAAU,CAAC,SAAS,SAAS,QAAQ,EAAE,WAAS,YAAU,UAAU,QAAM,GAAG,MAAI,GAAG,aAAW,GAAG,kBAAgB,UAAU,eAAa,IAAM,EAAY,EAAS,UAAgB,EAAUA,MAAoB,IAAO,OAAO,EAAU,OAAO,OAAO,EAAE,EAAa,CAAC,EAAW,EAAK,CAAS,CAAC,EAAQ,EAAcA,MAAY,CAAC,GAAG,EAAU,SAAS,EAAE,MAAM,CAAC,EAAE,IAAM,EAAI,CAAC,E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