{"version":3,"file":"Ticker.BZGS3ZEz.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/4XZv5sUxenDGOj5eLqzg/N65l1hGO9GLPpLG2Bpaq/Ticker.js"],"sourcesContent":["// Looping promotional ticker with editable text\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useRef,useEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * Looping Promotional Ticker\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight fixed\n */export default function Ticker(props){const{messages=[{message:\"Get 25% off all items with code PROMO25!\"},{message:\"New collection out now!\"},{message:\"Free shipping on orders over $50!\"}],speed,background,color,font={fontSize:\"22px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"},borderRadius,style}=props;const isStatic=useIsStaticRenderer();const containerRef=useRef(null);const tickerRef=useRef(null);const[currentIndex,setCurrentIndex]=useState(0);const[show,setShow]=useState(true);const[justAppeared,setJustAppeared]=useState(true);const hasMessages=messages&&messages.length>0;const currentMessage=hasMessages?messages[currentIndex%messages.length].message:\"\";// Show the next message every X ms\nuseEffect(()=>{if(isStatic)return;if(!hasMessages)return;startTransition(()=>setShow(true));let fadeTimeout;let nextTimeout;if(typeof window!==\"undefined\"){fadeTimeout=window.setTimeout(()=>{startTransition(()=>setShow(false));nextTimeout=window.setTimeout(()=>{startTransition(()=>setCurrentIndex(v=>(v+1)%messages.length));startTransition(()=>setShow(true));},300)// Transition duration\n;},Math.max(1300+currentMessage.length*70,1800));}return()=>{if(typeof window!==\"undefined\"){if(fadeTimeout!==undefined)window.clearTimeout(fadeTimeout);if(nextTimeout!==undefined)window.clearTimeout(nextTimeout);}};},[currentIndex,currentMessage,isStatic,messages.length,hasMessages]);// Subtle first appearance animation\nuseEffect(()=>{if(isStatic){startTransition(()=>setJustAppeared(false));return;}let appearTimeout;if(typeof window!==\"undefined\"){appearTimeout=window.setTimeout(()=>{startTransition(()=>setJustAppeared(false));},600);}return()=>{if(typeof window!==\"undefined\"&&appearTimeout!==undefined){window.clearTimeout(appearTimeout);}};},[isStatic]);// Render only the current message centered with fade animation\nreturn /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:\"100%\",height:\"100%\",background,color,borderRadius,position:\"relative\",overflow:\"hidden\",display:\"flex\",alignItems:\"center\",...font,...style,whiteSpace:\"nowrap\",paddingLeft:16,paddingRight:16,justifyContent:\"center\",opacity:justAppeared?0:1,transform:justAppeared?\"scale(0.96)\":\"scale(1)\",transition:\"opacity 0.4s ease, transform 0.4s ease\"},\"aria-label\":\"Promotional Ticker\",role:\"region\",children:/*#__PURE__*/_jsx(\"span\",{ref:tickerRef,style:{display:\"inline-block\",minWidth:0,maxWidth:\"100%\",overflow:\"hidden\",textOverflow:\"ellipsis\",opacity:show?1:0,transition:\"opacity 0.3s ease, transform 0.3s ease\",transform:show?\"scale(1)\":\"scale(0.96)\",textAlign:\"center\",...font,color},children:currentMessage})});}addPropertyControls(Ticker,{messages:{type:ControlType.Array,title:\"Messages\",control:{type:ControlType.Object,controls:{message:{type:ControlType.String,title:\"Message\",defaultValue:\"Get 25% off all items with code PROMO25!\"}}},maxCount:10,defaultValue:[{message:\"Get 25% off all items with code PROMO25!\"},{message:\"New collection out now!\"},{message:\"Free shipping on orders over $50!\"}]},speed:{type:ControlType.Number,title:\"Speed\",defaultValue:60,min:10,max:400,unit:\"px/s\",step:1},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"#F5F5F5\"},color:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},font:{type:ControlType.Font,title:\"Font\",defaultFontType:\"sans-serif\",controls:\"extended\",defaultValue:{fontSize:\"22px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"}},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:64,step:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Ticker\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Ticker.map"],"mappings":"gNAKG,SAAwB,EAAO,EAAM,CAAC,GAAK,CAAC,WAAS,CAAC,CAAC,QAAQ,2CAA2C,CAAC,CAAC,QAAQ,0BAA0B,CAAC,CAAC,QAAQ,oCAAoC,CAAC,CAAC,QAAM,aAAW,QAAM,OAAK,CAAC,SAAS,OAAO,QAAQ,WAAW,cAAc,UAAU,WAAW,QAAQ,CAAC,eAAa,SAAO,EAAY,EAAS,GAAqB,CAAO,EAAaA,EAAO,KAAK,CAAO,EAAUA,EAAO,KAAK,CAAM,CAAC,EAAa,GAAiBC,EAAS,EAAE,CAAM,CAAC,EAAK,GAASA,EAAS,GAAK,CAAM,CAAC,EAAa,GAAiBA,EAAS,GAAK,CAAO,EAAY,GAAU,EAAS,OAAO,EAAQ,EAAe,EAAY,EAAS,EAAa,EAAS,QAAQ,QAAQ,GAI7qB,OAHA,MAAc,CAAoB,GAAhB,GAAmB,CAAC,EAAY,OAAO,MAAoB,EAAQ,GAAK,CAAC,CAAC,IAAI,EAAgB,EAC9D,OADoF,IAAS,SAAa,EAAY,EAAO,eAAe,CAAC,MAAoB,EAAQ,GAAM,CAAC,CAAC,EAAY,EAAO,eAAe,CAAC,MAAoB,EAAgB,IAAI,EAAE,GAAG,EAAS,OAAO,CAAC,CAAC,MAAoB,EAAQ,GAAK,CAAC,EAAG,IAAI,EAC3W,KAAK,IAAI,KAAK,EAAe,OAAO,GAAG,KAAK,CAAC,MAAY,CAAW,IAAS,SAAgB,IAAc,IAAA,IAAU,EAAO,aAAa,EAAY,CAAI,IAAc,IAAA,IAAU,EAAO,aAAa,EAAY,IAAM,CAAC,EAAa,EAAe,EAAS,EAAS,OAAO,EAAY,CAAC,CAC7R,MAAc,CAAC,GAA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