{"version":3,"file":"TypewriterText.DFY50eo5.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/fe1lM7W5UlybsURfp4ZJ/Ot3tKg5JJKu6POECNVnW/TypewriterText.js"],"sourcesContent":["// Typing effect text component\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * TypewriterText\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function TypewriterText(props){const{text,speed,font,color,style,highlight=\"\",highlightColor=\"#FFBB00\",highlight2=\"\",highlight2Color=\"#00BBFF\",highlight3=\"\",highlight3Color=\"#FF00BB\",highlight4=\"\",highlight4Color=\"#00FFBB\",highlight5=\"\",highlight5Color=\"#BB00FF\",highlight6=\"\",highlight6Color=\"#FF8800\"}=props;const[displayed,setDisplayed]=useState(\"\");const isStatic=useIsStaticRenderer();useEffect(()=>{if(isStatic){startTransition(()=>setDisplayed(text));return;}// Sentence by sentence typing effect\nconst sentences=text.match(/[^.!?]+[.!?]+\\s*/g)||[text];let i=0;let current=\"\";let timeout;function typeSentence(){if(i<sentences.length){current+=sentences[i];startTransition(()=>setDisplayed(current));i++;timeout=window.setTimeout(typeSentence,speed);}}typeSentence();return()=>{if(timeout)clearTimeout(timeout);};},[text,speed,isStatic]);return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",minWidth:5,minHeight:5,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",boxSizing:\"border-box\",overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"span\",{style:{...font,color,...style,width:\"fit-content\",minWidth:0,maxWidth:\"100%\",whiteSpace:\"pre-wrap\",wordBreak:\"break-word\",textAlign:\"center\",boxSizing:\"border-box\",overflowWrap:\"break-word\",overflow:\"hidden\",display:\"block\",fontWeight:font?.variant===\"Bold\"?700:font?.variant===\"Semibold\"?600:font?.variant===\"Medium\"?500:font?.variant===\"Regular\"?400:undefined},\"aria-label\":text,role:\"text\",tabIndex:0,children:(()=>{if(!highlight&&!highlight2&&!highlight3&&!highlight4&&!highlight5&&!highlight6)return displayed;// Support multiple highlights for highlight, highlight2, highlight3, highlight4, highlight5, and highlight6\nlet result=[];let lastIndex=0;let i=0;while(i<displayed.length){// Check highlight1\nif(highlight&&displayed.slice(i,i+highlight.length)===highlight){result.push(/*#__PURE__*/_jsx(\"span\",{style:{color:highlightColor,fontWeight:700},children:displayed.slice(i,i+highlight.length)}));i+=highlight.length;lastIndex=i;continue;}// Check highlight2\nif(highlight2&&displayed.slice(i,i+highlight2.length)===highlight2){result.push(/*#__PURE__*/_jsx(\"span\",{style:{color:highlight2Color,fontWeight:700},children:displayed.slice(i,i+highlight2.length)}));i+=highlight2.length;lastIndex=i;continue;}// Check highlight3\nif(highlight3&&displayed.slice(i,i+highlight3.length)===highlight3){result.push(/*#__PURE__*/_jsx(\"span\",{style:{color:highlight3Color,fontWeight:700},children:displayed.slice(i,i+highlight3.length)}));i+=highlight3.length;lastIndex=i;continue;}// Check highlight4\nif(highlight4&&displayed.slice(i,i+highlight4.length)===highlight4){result.push(/*#__PURE__*/_jsx(\"span\",{style:{color:highlight4Color,fontWeight:700},children:displayed.slice(i,i+highlight4.length)}));i+=highlight4.length;lastIndex=i;continue;}// Check highlight5\nif(highlight5&&displayed.slice(i,i+highlight5.length)===highlight5){result.push(/*#__PURE__*/_jsx(\"span\",{style:{color:highlight5Color,fontWeight:700},children:displayed.slice(i,i+highlight5.length)}));i+=highlight5.length;lastIndex=i;continue;}// Check highlight6\nif(highlight6&&displayed.slice(i,i+highlight6.length)===highlight6){result.push(/*#__PURE__*/_jsx(\"span\",{style:{color:highlight6Color,fontWeight:700},children:displayed.slice(i,i+highlight6.length)}));i+=highlight6.length;lastIndex=i;continue;}// Normal char\nresult.push(displayed[i]);i++;lastIndex=i;}return result;})()})});}addPropertyControls(TypewriterText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Hello, world!\",displayTextArea:true},speed:{type:ControlType.Number,title:\"Speed (ms)\",defaultValue:60,min:10,max:500,step:5,unit:\"ms\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"32px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"}},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"},highlight:{type:ControlType.String,title:\"Highlight Text\",defaultValue:\"\",placeholder:\"Type to highlight...\"},highlightColor:{type:ControlType.Color,title:\"Highlight Color\",defaultValue:\"#FFBB00\"},highlight2:{type:ControlType.String,title:\"Highlight 2 Text\",defaultValue:\"\",placeholder:\"Type to highlight...\"},highlight2Color:{type:ControlType.Color,title:\"Highlight 2 Color\",defaultValue:\"#00BBFF\"},highlight3:{type:ControlType.String,title:\"Highlight 3 Text\",defaultValue:\"\",placeholder:\"Type to highlight...\"},highlight3Color:{type:ControlType.Color,title:\"Highlight 3 Color\",defaultValue:\"#FF00BB\"},highlight4:{type:ControlType.String,title:\"Highlight 4 Text\",defaultValue:\"\",placeholder:\"Type to highlight...\"},highlight4Color:{type:ControlType.Color,title:\"Highlight 4 Color\",defaultValue:\"#00FFBB\"},highlight5:{type:ControlType.String,title:\"Highlight 5 Text\",defaultValue:\"\",placeholder:\"Type to highlight...\"},highlight5Color:{type:ControlType.Color,title:\"Highlight 5 Color\",defaultValue:\"#BB00FF\"},highlight6:{type:ControlType.String,title:\"Highlight 6 Text\",defaultValue:\"\",placeholder:\"Type to highlight...\"},highlight6Color:{type:ControlType.Color,title:\"Highlight 6 Color\",defaultValue:\"#FF8800\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TypewriterText\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TypewriterText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