{"version":3,"file":"TypingText.RUX1qQBQ.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/cualGHFi4sCdSTRWkrfZ/tjin0wFLHKcLuM6ZHp6y/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\":\"auto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