{"version":3,"file":"CyclingButton.DiOct4EG.mjs","names":["useRef","useMemo","useState"],"sources":["https:/framerusercontent.com/modules/Om8hlWMU295N4QYEPgiq/gRwq0Vg5pK0AJd2supYb/CyclingButton.js"],"sourcesContent":["// User request: \"Quero fazer um botão que ele a cada 3s ele muda o texto pra outro, tipo pra indagar mais a pessoa, e ai depois volta pro original\"\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useMemo,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useInView}from\"framer-motion\";/**\n * @framerIntrinsicWidth 220\n * @framerIntrinsicHeight 44\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function CyclingButton(props){const{originalText,secondaryText,link,openInNewTab,cycleMode,intervalSeconds,enabled,variant,backgroundColor,textColor,borderColor,hoverBackgroundColor,hoverTextColor,radius,paddingX,paddingY,gap,font,animateOnHover,hoverScale,tapScale,disabled,onTap,style}=props;const isStatic=useIsStaticRenderer();const ref=useRef(null);const inView=useInView(ref,{amount:.2});const texts=useMemo(()=>{const base=[originalText,secondaryText].filter(t=>(t??\"\").trim().length>0);if(base.length===0)return[\"Bot\\xe3o\"];if(base.length===1)return[base[0]];return base;},[originalText,secondaryText]);const[index,setIndex]=useState(0);const safeIntervalMs=useMemo(()=>{const ms=(Number.isFinite(intervalSeconds)?intervalSeconds:3)*1e3;return Math.max(200,ms);},[intervalSeconds]);useEffect(()=>{// Reset when texts change\nstartTransition(()=>setIndex(0));},[texts.join(\"\\x00\")]);useEffect(()=>{if(isStatic)return;if(!enabled)return;if(!inView)return;if(texts.length<2)return;if(typeof window===\"undefined\")return;let step=0;const id=window.setInterval(()=>{step+=1;startTransition(()=>{setIndex(prev=>{if(cycleMode===\"alternate\")return prev===0?1:0;// sequence\nreturn(prev+1)%texts.length;});});},safeIntervalMs);return()=>{window.clearInterval(id);};},[isStatic,enabled,inView,texts,safeIntervalMs,cycleMode]);const currentText=useMemo(()=>{if(isStatic)return texts[0];return texts[Math.min(index,texts.length-1)];},[texts,index,isStatic]);const isFullWidth=!!style&&style.width===\"100%\";const isFullHeight=!!style&&style.height===\"100%\";const baseBg=variant===\"solid\"?backgroundColor:\"transparent\";const baseColor=variant===\"solid\"?textColor:borderColor;const baseBorder=variant===\"solid\"?\"none\":variant===\"ghost\"?\"1px solid transparent\":`1px solid ${borderColor}`;const handleClick=()=>{if(disabled)return;if(link&&link.trim().length>0){if(typeof window!==\"undefined\"){if(openInNewTab){window.open(link,\"_blank\",\"noopener,noreferrer\");}else{window.location.href=link;}}return;}onTap?.();};return /*#__PURE__*/_jsx(motion.button,{ref:ref,type:\"button\",\"aria-label\":currentText,disabled:disabled,onClick:handleClick,whileHover:disabled||!animateOnHover?undefined:{scale:hoverScale},whileTap:disabled?undefined:{scale:tapScale},style:{position:\"relative\",width:isFullWidth?\"100%\":\"max-content\",height:isFullHeight?\"100%\":\"max-content\",minWidth:isFullWidth?undefined:\"max-content\",minHeight:isFullHeight?undefined:\"max-content\",display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",gap,padding:`${paddingY}px ${paddingX}px`,borderRadius:radius,border:baseBorder,background:baseBg,color:baseColor,cursor:disabled?\"not-allowed\":\"pointer\",userSelect:\"none\",WebkitTapHighlightColor:\"transparent\",outline:\"none\",...font,...style},onMouseEnter:e=>{if(disabled)return;const el=e.currentTarget;el.style.background=hoverBackgroundColor;el.style.color=hoverTextColor;},onMouseLeave:e=>{const el=e.currentTarget;el.style.background=baseBg;el.style.color=baseColor;},children:/*#__PURE__*/_jsx(\"span\",{style:{width:isFullWidth?\"100%\":\"max-content\",minWidth:isFullWidth?undefined:\"max-content\",textAlign:\"center\",whiteSpace:\"nowrap\",overflow:\"hidden\",textOverflow:\"ellipsis\",lineHeight:\"1.2em\"},children:currentText})});}addPropertyControls(CyclingButton,{originalText:{type:ControlType.String,title:\"Texto 1\",defaultValue:\"Quero saber mais\"},secondaryText:{type:ControlType.String,title:\"Texto 2\",defaultValue:\"Bora conversar?\"},link:{type:ControlType.Link,title:\"Link\",defaultValue:\"\"},openInNewTab:{type:ControlType.Boolean,title:\"Nova aba\",defaultValue:false,enabledTitle:\"Sim\",disabledTitle:\"N\\xe3o\",hidden:({link})=>!link||link.trim().length===0},cycleMode:{type:ControlType.Enum,title:\"Modo\",options:[\"alternate\",\"sequence\"],optionTitles:[\"Alternar\",\"Sequ\\xeancia\"],defaultValue:\"alternate\"},intervalSeconds:{type:ControlType.Number,title:\"Intervalo\",defaultValue:3,min:.2,max:30,step:.1,unit:\"s\"},enabled:{type:ControlType.Boolean,title:\"Ciclo\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},disabled:{type:ControlType.Boolean,title:\"Desabilitado\",defaultValue:false,enabledTitle:\"Sim\",disabledTitle:\"N\\xe3o\"},variant:{type:ControlType.Enum,title:\"Estilo\",options:[\"solid\",\"outline\",\"ghost\"],optionTitles:[\"S\\xf3lido\",\"Outline\",\"Ghost\"],defaultValue:\"solid\"},backgroundColor:{type:ControlType.Color,title:\"Fundo\",defaultValue:\"#000000\",hidden:({variant})=>variant!==\"solid\"},textColor:{type:ControlType.Color,title:\"Texto\",defaultValue:\"#FFFFFF\",hidden:({variant})=>variant!==\"solid\"},borderColor:{type:ControlType.Color,title:\"Borda\",defaultValue:\"#000000\",hidden:({variant})=>variant===\"solid\"},hoverBackgroundColor:{type:ControlType.Color,title:\"Hover Fundo\",defaultValue:\"#111111\"},hoverTextColor:{type:ControlType.Color,title:\"Hover Texto\",defaultValue:\"#FFFFFF\"},radius:{type:ControlType.Number,title:\"Raio\",defaultValue:8,min:0,max:48,step:1,unit:\"px\"},paddingX:{type:ControlType.Number,title:\"Padding X\",defaultValue:16,min:0,max:64,step:1,unit:\"px\"},paddingY:{type:ControlType.Number,title:\"Padding Y\",defaultValue:12,min:0,max:64,step:1,unit:\"px\"},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:8,min:0,max:32,step:1,unit:\"px\"},font:{type:ControlType.Font,title:\"Fonte\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"14px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"}},animateOnHover:{type:ControlType.Boolean,title:\"Anima\\xe7\\xe3o\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},hoverScale:{type:ControlType.Number,title:\"Hover Scale\",defaultValue:1.03,min:1,max:1.2,step:.01,hidden:({animateOnHover})=>!animateOnHover},tapScale:{type:ControlType.Number,title:\"Tap Scale\",defaultValue:.98,min:.8,max:1,step:.01},onTap:{type:ControlType.EventHandler,title:\"Tap\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CyclingButton\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"44\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"220\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CyclingButton.map"],"mappings":"+QAOG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,eAAa,gBAAc,OAAK,eAAa,YAAU,kBAAgB,UAAQ,UAAQ,kBAAgB,YAAU,cAAY,uBAAqB,iBAAe,SAAO,WAAS,WAAS,MAAI,OAAK,iBAAe,aAAW,WAAS,WAAS,QAAM,SAAO,EAAY,EAAS,EAAoB,EAAQ,EAAIA,EAAO,IAAI,EAAQ,EAAO,EAAU,EAAI,CAAC,OAAO,EAAE,CAAC,EAAQ,EAAMC,MAAY,CAAC,IAAM,EAAK,CAAC,EAAa,CAAa,CAAC,CAAC,OAAO,IAAI,GAAG,GAAA,CAAI,KAAK,CAAC,CAAC,OAAO,CAAC,EAA2E,OAAtE,EAAK,SAAS,EAAQ,CAAC,OAAU,EAAK,EAAK,SAAS,EAAQ,CAAC,EAA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