{"version":3,"file":"TypingEffect.BJZIBhAP.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/gQm3iA4uMoEk1k8MnRHo/ylh1PH6ZqNEQwgUltUYS/TypingEffect.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 200\n * @framerDisableUnlink\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export function TypingEffect({textToType,colors,interval,typingSpeed,fontFamily,fontSize,fontWeight,lineHeight,textAlign,letterSpacing}){const[currentText,setCurrentText]=useState(\"\");const[index,setIndex]=useState(0);const[charIndex,setCharIndex]=useState(0);const[colorIndex,setColorIndex]=useState(0);const[isDeleting,setIsDeleting]=useState(false);const[startTyping,setStartTyping]=useState(false);const initialDelay=500;useEffect(()=>{if(!textToType||textToType.length===0)return;setStartTyping(false);const initialTimeout=setTimeout(()=>{setStartTyping(true);},initialDelay);return()=>clearTimeout(initialTimeout);},[index,textToType,initialDelay]);useEffect(()=>{if(!startTyping)return;const stringToType=textToType[index];const type=()=>{if(!isDeleting){if(charIndex<stringToType.length){setCurrentText(prev=>prev+stringToType.charAt(charIndex));setCharIndex(charIndex+1);}else{setTimeout(()=>{setIsDeleting(true);},interval);}}else{if(charIndex>0){setCurrentText(prev=>prev.slice(0,-1));setCharIndex(charIndex-1);}else{setIsDeleting(false);setColorIndex(prevColorIndex=>(prevColorIndex+1)%colors.length);setCurrentText(\"\");setCharIndex(0);setIndex(prevIndex=>(prevIndex+1)%textToType.length);setStartTyping(false);// Delay the start of typing the next text\nsetTimeout(()=>{setStartTyping(true);},initialDelay);}}};const timeoutId=setTimeout(type,typingSpeed);return()=>clearTimeout(timeoutId);},[charIndex,index,textToType,colors,interval,typingSpeed,startTyping,isDeleting]);// Add Google Fonts link to head\nuseEffect(()=>{const linkElement=document.createElement(\"link\");linkElement.href=`https://fonts.googleapis.com/css2?family=${fontFamily.replace(/\\s+/g,\"+\")}:wght@${fontWeight}&display=swap`;linkElement.rel=\"stylesheet\";document.head.appendChild(linkElement);return()=>{document.head.removeChild(linkElement);};},[fontFamily,fontWeight]);return /*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",alignItems:\"center\",position:\"relative\"},children:/*#__PURE__*/_jsxs(\"span\",{style:{fontFamily,fontWeight,fontSize,lineHeight:`${lineHeight}em`,textAlign,letterSpacing:`${letterSpacing}em`,color:colors[colorIndex],whiteSpace:\"pre\"},children:[currentText,/*#__PURE__*/_jsx(\"span\",{id:\"typing-cursor\",style:{position:\"relative\",display:\"inline-block\",width:fontSize*.6,height:fontSize*.6,borderRadius:\"50%\",backgroundColor:colors[colorIndex],marginLeft:10,animation:startTyping?`blink ${typingSpeed*.01}s step-end infinite`:\"none\"}})]})});}addPropertyControls(TypingEffect,{textToType:{type:ControlType.Array,title:\"Text to Type\",propertyControl:{type:ControlType.String}},colors:{type:ControlType.Array,title:\"Colors\",propertyControl:{type:ControlType.Color},description:\"------------------------\"},typingSpeed:{type:ControlType.Number,title:\"Typing Speed (ms)\",defaultValue:100},interval:{type:ControlType.Number,title:\"Interval (ms)\",defaultValue:2e3,max:5e3,description:\"Higher values make the animation slower, while lower values make it faster.\"},fontFamily:{type:ControlType.String,title:\"Font Family\",defaultValue:\"Arial\"},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:16,min:8,max:100,step:1,displayStepper:true},fontWeight:{type:ControlType.Enum,title:\"Font Weight\",options:[\"100\",\"200\",\"300\",\"400\",\"500\",\"600\",\"700\",\"800\",\"900\"],optionTitles:[\"Thin\",\"Extra Light\",\"Light\",\"Regular\",\"Medium\",\"Semi Bold\",\"Bold\",\"Extra Bold\",\"Black\"],defaultValue:\"400\"},lineHeight:{type:ControlType.Number,title:\"Line Height\",defaultValue:1,min:.5,max:3,step:.1,displayStepper:true},textAlign:{type:ControlType.Enum,title:\"Text Align\",options:[\"left\",\"center\",\"right\",\"justify\"],optionTitles:[\"Left\",\"Center\",\"Right\",\"Justify\"],defaultValue:\"left\"},letterSpacing:{type:ControlType.Number,title:\"Letter Spacing\",defaultValue:0,min:-.5,max:5,step:.1,displayStepper:true,description:\"Made by *Otvos Studio*\\n Contact me for support [( ✉️ contact).](https://waitlist-otvos-studio.framer.website/)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"TypingEffect\":{\"type\":\"reactComponent\",\"name\":\"TypingEffect\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"200\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"200\",\"framerDisableUnlink\":\"* @framerSupportedLayoutWidth fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TypingEffect.map"],"mappings":"iRAMG,SAAgB,EAAa,CAAC,aAAW,SAAO,WAAS,cAAY,aAAW,WAAS,aAAW,aAAW,YAAU,iBAAe,CAAC,GAAK,CAAC,EAAY,GAAgBA,EAAS,GAAG,CAAM,CAAC,EAAM,GAAUA,EAAS,EAAE,CAAM,CAAC,EAAU,GAAcA,EAAS,EAAE,CAAM,CAAC,EAAW,GAAeA,EAAS,EAAE,CAAM,CAAC,EAAW,GAAeA,EAAS,GAAM,CAAM,CAAC,EAAY,GAAgBA,EAAS,GAAM,CAEnE,OAF2F,MAAc,CAAC,GAAG,CAAC,GAAY,EAAW,SAAS,EAAE,OAAO,EAAe,GAAM,CAAC,IAAM,EAAe,eAAe,CAAC,EAAe,GAAK,EAAG,IAAa,CAAC,UAAU,aAAa,EAAe,EAAG,CAAC,EAAM,EAAW,IAAa,CAAC,CAAC,MAAc,CAAC,GAAG,CAAC,EAAY,OAAO,IAAM,EAAa,EAAW,GACvpB,EAAU,eADmqB,CAAK,EAAkM,EAAU,GAAG,EAAe,GAAM,EAAK,MAAM,EAAE,GAAG,CAAC,CAAC,EAAa,EAAU,EAAE,GAAO,EAAc,G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