{"version":3,"file":"Changing_text.D9RfTddj.mjs","names":["useState","useRef","_Fragment"],"sources":["https:/framerusercontent.com/modules/UvAn5p5obRDjoWEFSnMc/S6fW5WA0WtLBlzRUxldC/Changing_text.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export function TypewriterSwapText({baseText,variations,speed,pause,fontSize,fontWeight,fontFamily,color,dynamicColor,dynamicFontWeight,textAlign,width,height,direction,padding,maxTextWidth,baseTypingMode,dynamicTypingMode,lineHeight}){const[baseVisible,setBaseVisible]=useState(\"\");const[dynamicVisible,setDynamicVisible]=useState(\"\");const[variationIndex,setVariationIndex]=useState(0);const[initialTyped,setInitialTyped]=useState(false);const timeoutRef=useRef(null);const words=variations.split(\",\").map(w=>w.trim()).filter(Boolean);const word=words.length>0?words[variationIndex%words.length]:\"\";useEffect(()=>{clearTimeout(timeoutRef.current);let i=0;const typeDynamic=()=>{setDynamicVisible(\"\");const type=()=>{if(i<word.length){const char=word[i];if(char)setDynamicVisible(prev=>prev+char);i++;timeoutRef.current=setTimeout(type,speed);}else{timeoutRef.current=setTimeout(()=>{setVariationIndex(prev=>(prev+1)%words.length);},pause);}};type();};const startAnimation=()=>{if(baseTypingMode===\"static\"){setBaseVisible(baseText);if(dynamicTypingMode===\"typing\"){typeDynamic();}else{setDynamicVisible(word);timeoutRef.current=setTimeout(()=>{setVariationIndex(prev=>(prev+1)%words.length);},pause);}}else{setBaseVisible(\"\");const typeBase=()=>{if(i<baseText.length){const char=baseText[i];if(char)setBaseVisible(prev=>prev+char);i++;timeoutRef.current=setTimeout(typeBase,speed);}else{i=0;if(dynamicTypingMode===\"typing\"){typeDynamic();}else{setDynamicVisible(word);timeoutRef.current=setTimeout(()=>{setVariationIndex(prev=>(prev+1)%words.length);},pause);}}};typeBase();}};startAnimation();setInitialTyped(true);return()=>clearTimeout(timeoutRef.current);},[variationIndex,baseText,word,speed,pause,baseTypingMode,dynamicTypingMode]);return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"auto\",padding,boxSizing:\"border-box\",overflow:\"visible\",display:\"flex\",justifyContent:textAlign===\"left\"?\"flex-start\":textAlign===\"right\"?\"flex-end\":\"center\"},children:/*#__PURE__*/_jsx(\"div\",{style:{maxWidth:maxTextWidth,textAlign,fontFamily,fontSize,fontWeight,lineHeight,whiteSpace:\"pre-wrap\",overflowWrap:\"break-word\",wordBreak:\"break-word\"},children:direction===\"vertical\"?/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"div\",{style:{color},children:baseVisible}),/*#__PURE__*/_jsx(\"div\",{style:{color:dynamicColor,fontWeight:dynamicFontWeight},children:dynamicVisible})]}):/*#__PURE__*/_jsxs(\"span\",{style:{color},children:[baseVisible,/*#__PURE__*/_jsx(\"span\",{style:{color:dynamicColor,fontWeight:dynamicFontWeight},children:dynamicVisible})]})})});}TypewriterSwapText.defaultProps={width:600,height:\"auto\"};addPropertyControls(TypewriterSwapText,{baseText:{title:\"Base Text\",type:ControlType.String,defaultValue:\"We build for \"},variations:{title:\"Dynamic Words\",type:ControlType.String,defaultValue:\"startups, agencies, enterprises\"},speed:{title:\"Typing Speed (ms)\",type:ControlType.Number,defaultValue:50,min:10,max:500,step:10},pause:{title:\"Pause Between (ms)\",type:ControlType.Number,defaultValue:1500,min:500,max:5e3,step:100},fontFamily:{title:\"Font Family\",type:ControlType.String,defaultValue:\"Inter, sans-serif\"},fontSize:{title:\"Font Size\",type:ControlType.Number,defaultValue:32,min:10,max:100},fontWeight:{title:\"Base Weight\",type:ControlType.Number,defaultValue:400,min:100,max:900,step:100},color:{title:\"Base Color\",type:ControlType.Color,defaultValue:\"#000000\"},dynamicColor:{title:\"Dynamic Color\",type:ControlType.Color,defaultValue:\"#FF0080\"},dynamicFontWeight:{title:\"Dynamic Weight\",type:ControlType.Number,defaultValue:600,min:100,max:900,step:100},textAlign:{title:\"Text Align\",type:ControlType.Enum,options:[\"left\",\"center\",\"right\"],defaultValue:\"left\"},direction:{title:\"Stack Direction\",type:ControlType.Enum,options:[\"horizontal\",\"vertical\"],optionTitles:[\"Horizontal\",\"Vertical\"],defaultValue:\"horizontal\"},baseTypingMode:{title:\"Base Text Behavior\",type:ControlType.Enum,options:[\"static\",\"typing\"],optionTitles:[\"Stay Still\",\"Typing\"],defaultValue:\"static\"},dynamicTypingMode:{title:\"Dynamic Text Behavior\",type:ControlType.Enum,options:[\"static\",\"typing\"],optionTitles:[\"Stay Still\",\"Typing\"],defaultValue:\"typing\"},padding:{title:\"Padding\",type:ControlType.FusedNumber,defaultValue:0},maxTextWidth:{title:\"Max Text Width\",type:ControlType.Number,defaultValue:600,min:100,max:1e3},lineHeight:{title:\"Line Height\",type:ControlType.Number,defaultValue:1.4,min:1,max:3,step:.1}});\nexport const __FramerMetadata__ = {\"exports\":{\"TypewriterSwapText\":{\"type\":\"reactComponent\",\"name\":\"TypewriterSwapText\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Changing_text.map"],"mappings":"iMAAgL,SAAgB,EAAmB,CAAC,WAAS,aAAW,QAAM,QAAM,WAAS,aAAW,aAAW,QAAM,eAAa,oBAAkB,YAAU,QAAM,SAAO,YAAU,UAAQ,eAAa,iBAAe,oBAAkB,cAAY,CAAC,GAAK,CAAC,EAAY,GAAgBA,EAAS,GAAG,CAAM,CAAC,EAAe,GAAmBA,EAAS,GAAG,CAAM,CAAC,EAAe,GAAmBA,EAAS,EAAE,CAAM,CAAC,EAAa,GAAiBA,EAAS,GAAM,CAAO,EAAWC,EAAO,KAAK,CAAO,EAAM,EAAW,MAAM,IAAI,CAAC,IAAI,GAAG,EAAE,MAAM,CAAC,CAAC,OAAO,QAAQ,CAAO,EAAK,EAAM,OAAO,EAAE,EAAM,EAAe,EAAM,QAAQ,GAAsnC,OAAnnC,MAA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