{"version":3,"file":"TypingText.FpgBqK6P.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/kcFo0xL8H4n4nYbg1FpR/z7NmW9Ozzhk3i0ptlVuo/TypingText.js"],"sourcesContent":["// Typing text effect with multiple words that cycles through an array of words with typing and deleting animations\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function TypingText(props){const{words=[\"Design\",\"Build\",\"Launch\"],typingSpeed=100,deleteSpeed=50,pauseDuration=1e3,font,showCursor=true,cursorColor=\"#000000\",textColor=\"#000000\",style}=props;const[displayText,setDisplayText]=useState(\"\");const[currentWordIndex,setCurrentWordIndex]=useState(0);const[isDeleting,setIsDeleting]=useState(false);const[isPaused,setIsPaused]=useState(false);const timeoutRef=useRef(null);// Calculate the longest word for width stability\nconst longestWord=words.reduce((a,b)=>a.length>b.length?a:b,\"\");useEffect(()=>{if(words.length===0)return;const currentWord=words[currentWordIndex];const animate=()=>{if(isPaused){timeoutRef.current=window.setTimeout(()=>{startTransition(()=>{setIsPaused(false);setIsDeleting(true);});},pauseDuration);return;}if(!isDeleting){// Typing\nif(displayText.length<currentWord.length){timeoutRef.current=window.setTimeout(()=>{startTransition(()=>{setDisplayText(currentWord.slice(0,displayText.length+1));});},typingSpeed);}else{// Finished typing, pause before deleting\nstartTransition(()=>setIsPaused(true));}}else{// Deleting\nif(displayText.length>0){timeoutRef.current=window.setTimeout(()=>{startTransition(()=>{setDisplayText(displayText.slice(0,-1));});},deleteSpeed);}else{// Finished deleting, move to next word\nstartTransition(()=>{setIsDeleting(false);setCurrentWordIndex(prevIndex=>(prevIndex+1)%words.length);});}}};animate();return()=>{if(timeoutRef.current!==null){clearTimeout(timeoutRef.current);}};},[displayText,currentWordIndex,isDeleting,isPaused,words,typingSpeed,deleteSpeed,pauseDuration]);return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",display:\"inline-block\",minWidth:\"max-content\",background:\"transparent\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{...font,color:textColor,whiteSpace:\"nowrap\"},children:displayText}),showCursor&&/*#__PURE__*/_jsx(\"span\",{style:{color:cursorColor,animation:\"blink 1s step-end infinite\",marginLeft:\"2px\",WebkitTextFillColor:cursorColor},children:\"|\"}),/*#__PURE__*/_jsx(\"span\",{style:{...font,visibility:\"hidden\",position:\"absolute\",whiteSpace:\"nowrap\",pointerEvents:\"none\"},\"aria-hidden\":\"true\",children:longestWord}),/*#__PURE__*/_jsx(\"style\",{children:`\n                    @keyframes blink {\n                        0%, 50% { opacity: 1; }\n                        51%, 100% { opacity: 0; }\n                    }\n                `})]});}addPropertyControls(TypingText,{words:{type:ControlType.Array,title:\"Words\",control:{type:ControlType.String},defaultValue:[\"Design\",\"Build\",\"Launch\"]},typingSpeed:{type:ControlType.Number,title:\"Typing Speed\",defaultValue:100,min:10,max:500,step:10,unit:\"ms\"},deleteSpeed:{type:ControlType.Number,title:\"Delete Speed\",defaultValue:50,min:10,max:500,step:10,unit:\"ms\"},pauseDuration:{type:ControlType.Number,title:\"Pause Duration\",defaultValue:1e3,min:0,max:5e3,step:100,unit:\"ms\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"32px\",variant:\"Bold\",letterSpacing:\"-0.02em\",lineHeight:\"1.2em\"}},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},showCursor:{type:ControlType.Boolean,title:\"Show Cursor\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},cursorColor:{type:ControlType.Color,title:\"Cursor Color\",defaultValue:\"#000000\",hidden:({showCursor})=>!showCursor}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TypingText\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"au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