{"version":3,"file":"TypingEffect.rn0cZRga.mjs","names":["useState","useRef","timer"],"sources":["https:/framerusercontent.com/modules/i2QR6zPHDYiX4UamUmcN/QdWFHjCh6e12fKHYe4sj/TypingEffect.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";TypingEffect// Typewriter Effect - Clean, dynamic typing animation component for Framer\n;// Features customizable typing speed, font styling, and blinking cursor\n// Perfect for landing pages, hero banners, portfolios, and interactive UI elements\nimport{useState,useEffect,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useInView}from\"framer-motion\";/**\n * Typing Effect Component\n *\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 40\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */function TypingEffect(props){const{useTextArray=false,texts=\"Welcome\",textArray=[\"Hello\",\"Welcome\",\"Hi there\"],typingSpeed=100,probability=.1,delay=1e3,showCursor=true,cursorType=\"default\",cursorColor=\"#000000\",cursorWidth=2,cursorHeight=24,textColor=\"#000000\",font,htmlTag=\"h1\",loopAnimation=true,padding=\"0px\",style}=props;const[currentText,setCurrentText]=useState(\"\");const[currentIndex,setCurrentIndex]=useState(0);const[isDeleting,setIsDeleting]=useState(false);const[calculatedCursorHeight,setCalculatedCursorHeight]=useState(parseInt(font?.fontSize)||24);const[isTypingComplete,setIsTypingComplete]=useState(false);const textRef=useRef(null);const containerRef=useRef(null);const isStatic=useIsStaticRenderer();const isInView=useInView(containerRef,{once:true});// Calculate cursor height from font size\nuseEffect(()=>{if(!textRef.current)return;const computedStyle=window.getComputedStyle(textRef.current);const lineHeight=parseFloat(computedStyle.lineHeight);const fontSize=parseFloat(computedStyle.fontSize);// Use line height if available, otherwise use font size\nconst height=!isNaN(lineHeight)?lineHeight:fontSize;if(height>0){startTransition(()=>{setCalculatedCursorHeight(height);});}},[font]);// Handle typing animation\nuseEffect(()=>{if(isStatic||!isInView)return;const activeText=useTextArray?textArray[currentIndex]:texts;if(!activeText)return;// Typing is complete\nif(!isDeleting&&currentText===activeText){startTransition(()=>{setIsTypingComplete(true);});if(!loopAnimation){return;// Stop if not looping\n}// Wait then start deleting\nconst timer=window.setTimeout(()=>{startTransition(()=>{setIsDeleting(true);setIsTypingComplete(false);});},delay);return()=>clearTimeout(timer);}// Deleting is complete\nif(isDeleting&&currentText===\"\"){startTransition(()=>{setIsDeleting(false);// Move to next word in array mode\nif(useTextArray){setCurrentIndex(prev=>(prev+1)%textArray.length);}});return;}// Calculate next typing step\nconst nextChar=!isDeleting?activeText[currentText.length]:\"\";const shouldPause=!isDeleting&&nextChar===\" \"&&Math.random()<probability;const timeout=shouldPause?delay:isDeleting?typingSpeed/2:typingSpeed;const timer=window.setTimeout(()=>{startTransition(()=>{if(isDeleting){setCurrentText(prev=>prev.slice(0,-1));}else{setCurrentText(prev=>activeText.substring(0,prev.length+1));}});},timeout);return()=>clearTimeout(timer);},[currentText,texts,textArray,currentIndex,isDeleting,useTextArray,typingSpeed,probability,delay,isStatic,loopAnimation,isInView]);const TagComponent=htmlTag;// In canvas (static mode), show the full text\nconst displayText=isStatic?useTextArray?textArray[currentIndex]||textArray[0]||\"\":texts:currentText||\"\\xa0\";// Generate accessible label\nconst ariaLabel=useTextArray?`Typing animation cycling through: ${textArray.join(\", \")}`:`Typing animation: ${texts}`;// Determine cursor dimensions and color\nconst finalCursorColor=cursorType===\"default\"?textColor:cursorColor;const finalCursorWidth=cursorType===\"default\"?2:cursorWidth;const effectiveCursorHeight=cursorType===\"default\"?calculatedCursorHeight:cursorHeight;// Map text-align to flexbox justifyContent\nconst textAlign=font?.textAlign||\"left\";// Detect if we're in fit mode (no explicit width set)\nconst isFitMode=!style?.width||style.width===\"auto\";// In fit mode, text stays horizontal; in fill mode, it can wrap\nconst whiteSpace=isFitMode?\"nowrap\":\"normal\";return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{...style,position:\"relative\",display:\"inline-block\",boxSizing:\"border-box\",padding,width:style?.width,height:style?.height,minWidth:0,minHeight:0,textAlign:textAlign},role:\"region\",\"aria-label\":ariaLabel,\"aria-live\":isStatic?\"off\":\"polite\",\"aria-atomic\":\"true\",children:[/*#__PURE__*/_jsxs(TagComponent,{ref:textRef,style:{margin:0,padding:0,color:textColor,userSelect:\"text\",cursor:\"text\",...font,fontSize:font?.fontSize||\"15px\",display:\"inline\",whiteSpace:whiteSpace,wordBreak:isFitMode?\"normal\":\"break-word\",overflowWrap:isFitMode?\"normal\":\"break-word\"},tabIndex:0,\"aria-label\":isStatic?displayText:isTypingComplete?`${displayText} - typing complete`:`${displayText} - typing in progress`,children:[/*#__PURE__*/_jsx(\"span\",{style:{display:\"inline\"},children:displayText}),showCursor&&/*#__PURE__*/_jsx(\"span\",{style:{display:\"inline-block\",width:`${finalCursorWidth}px`,height:`${effectiveCursorHeight}px`,backgroundColor:finalCursorColor,marginLeft:2,verticalAlign:\"middle\",animation:isStatic?\"none\":\"blink 1.06s step-end infinite\",pointerEvents:\"none\"},\"aria-hidden\":\"true\",role:\"presentation\"})]}),!isStatic&&/*#__PURE__*/_jsx(\"style\",{children:`\n                        @keyframes blink {\n                            0%, 50% { opacity: 1; }\n                            50.01%, 100% { opacity: 0; }\n                        }\n                    `})]});}addPropertyControls(TypingEffect,{useTextArray:{type:ControlType.Boolean,title:\"Mode\",defaultValue:false,enabledTitle:\"Array\",disabledTitle:\"Plain\"},texts:{type:ControlType.String,title:\"Text\",defaultValue:\"Welcome\",displayTextArea:true,hidden:({useTextArray})=>useTextArray},textArray:{type:ControlType.Array,title:\"Text Array\",control:{type:ControlType.String},defaultValue:[\"Hello\",\"Welcome\",\"Hi there\"],hidden:({useTextArray})=>!useTextArray},htmlTag:{type:ControlType.Enum,title:\"HTML Tag\",options:[\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"p\",\"span\",\"div\"],optionTitles:[\"H1\",\"H2\",\"H3\",\"H4\",\"H5\",\"H6\",\"Paragraph\",\"Span\",\"Div\"],defaultValue:\"h1\",displaySegmentedControl:false},padding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"0px\"},typingSpeed:{type:ControlType.Number,title:\"Typing Speed\",defaultValue:100,min:10,max:500,step:10,unit:\"ms\"},probability:{type:ControlType.Number,title:\"Probability\",defaultValue:.1,min:0,max:1,step:.1,displayStepper:false},delay:{type:ControlType.Number,title:\"Delay\",defaultValue:1e3,min:100,max:3e3,step:100,unit:\"ms\"},showCursor:{type:ControlType.Boolean,title:\"Show Cursor\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},cursorType:{type:ControlType.Enum,title:\"Cursor Type\",options:[\"default\",\"custom\"],optionTitles:[\"Default\",\"Custom\"],defaultValue:\"default\",displaySegmentedControl:true,hidden:({showCursor})=>!showCursor},cursorColor:{type:ControlType.Color,title:\"Cursor Color\",defaultValue:\"#000000\",hidden:({showCursor,cursorType})=>!showCursor||cursorType===\"default\"},cursorWidth:{type:ControlType.Number,title:\"Cursor Width\",defaultValue:2,min:1,max:100,step:1,unit:\"px\",hidden:({showCursor,cursorType})=>!showCursor||cursorType===\"default\"},cursorHeight:{type:ControlType.Number,title:\"Cursor Height\",defaultValue:24,min:1,max:100,step:1,unit:\"px\",hidden:({showCursor,cursorType})=>!showCursor||cursorType===\"default\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},loopAnimation:{type:ControlType.Boolean,title:\"Loop Animation\",defaultValue:true,enabledTitle:\"Loop\",disabledTitle:\"Once\"}});export default TypingEffect;\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TypingEffect\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"40\",\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"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