{"version":3,"file":"TextTypewriter.CP78Avxp.mjs","names":["React.useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/BGdtLVPpHI8b7LMkiOFc/smDUUx6KuuDv9pLzrEcp/TextTypewriter.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n * @framerDisableUnlink\n **/export default function TextTypewriter(props){const{content,specificWords,specificWordsColor,font,fontColor,cursor,typingSpeed,delay,effect,blink}=props;const[displayedContent,setDisplayedContent]=React.useState(\"\");const[wordIndex,setWordIndex]=React.useState(0);const[isDeleting,setIsDeleting]=React.useState(false);const[isBlinking,setIsBlinking]=React.useState(false);React.useEffect(()=>{const fullContent=`${content} ${specificWords[wordIndex]||\"\"}`;if(!isDeleting&&displayedContent.length===fullContent.length){setIsBlinking(true);setTimeout(()=>{setIsDeleting(true);setIsBlinking(false);},effect.delay);}else if(isDeleting&&displayedContent.length===content.length){setWordIndex(prevIndex=>(prevIndex+1)%specificWords.length);setIsDeleting(false);}const timeoutId=setTimeout(()=>{setDisplayedContent(current=>{const text=fullContent.substring(0,current.length+(isDeleting?-1:1));return text;});},effect.typingSpeed);return()=>clearTimeout(timeoutId);},[displayedContent,isDeleting,wordIndex,content,specificWords,effect.delay,effect.typingSpeed,specificWordsColor,cursor]);const renderContent=()=>/*#__PURE__*/_jsxs(_Fragment,{children:[displayedContent.substring(0,content.length),/*#__PURE__*/_jsx(\"span\",{style:{color:specificWordsColor},children:displayedContent.substring(content.length)})]});return /*#__PURE__*/_jsxs(\"div\",{style:{...font,color:fontColor,whiteSpace:\"pre-wrap\",position:\"relative\",wordWrap:\"break-word\"},children:[renderContent(),isBlinking&&cursor.blink?/*#__PURE__*/_jsx(motion.span,{animate:{opacity:[0,1]},transition:{repeat:Infinity,duration:.6,repeatType:\"reverse\",type:\"spring\",delay:.2},style:{display:\"inline-block\",width:cursor.cursorWidth,height:cursor.cursorHeight,backgroundColor:cursor.cursorColor,verticalAlign:\"middle\",marginLeft:\"0\",overflow:\"visible\",marginBottom:\"0.2em\"}}):/*#__PURE__*/_jsx(\"span\",{style:{display:\"inline-block\",width:cursor.cursorWidth,height:cursor.cursorHeight,backgroundColor:cursor.cursorColor,verticalAlign:\"middle\",marginLeft:\"0\",overflow:\"visible\",marginBottom:\"0.2em\"}})]});}TextTypewriter.defaultProps={content:\"Typewritter.\",specificWords:[\"Cycle.\",\"Content.\",\"Color.\",\"Cursor.\",\"Blink.\",\"Transition.\"],effect:{typingSpeed:100,delay:1500}};addPropertyControls(TextTypewriter,{font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",displayTextAlignment:false,defaultFontType:\"sans-serif\",defaultValue:{fontSize:15,lineHeight:1,letterSpacing:0}},content:{type:ControlType.String,title:\"Content\",placeholder:\"Type something…\",displayTextArea:true},fontColor:{type:ControlType.Color,title:\"‎\",defaultValue:\"#000000\"},specificWords:{type:ControlType.Array,title:\"Typewritter\",propertyControl:{type:ControlType.String}},specificWordsColor:{type:ControlType.Color,title:\"‎\",defaultValue:\"#0599ff\"},cursor:{type:ControlType.Object,title:\"Cursor\",controls:{cursorColor:{type:ControlType.Color,title:\"Color\",defaultValue:\"#0599ff\"},cursorHeight:{type:ControlType.Number,title:\"Height\",displayStepper:true,defaultValue:18},cursorWidth:{type:ControlType.Number,title:\"Width\",displayStepper:true,defaultValue:2},blink:{type:ControlType.Boolean,title:\"Blinking\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"}}},effect:{type:ControlType.Object,title:\"Transition\",controls:{typingSpeed:{type:ControlType.Number,title:\"Speed\",min:1,max:200,defaultValue:100},delay:{type:ControlType.Number,title:\"Delay\",min:0,max:5e3,defaultValue:2e3}}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextTypewriter\",\"slots\":[],\"annotations\":{\"framerDisableUnlink\":\"\",\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextTypewriter.map"],"mappings":"gPAII,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,UAAQ,gBAAc,qBAAmB,OAAK,YAAU,SAAO,cAAY,QAAM,SAAO,SAAO,EAAW,CAAC,EAAiB,GAAqBA,EAAe,GAAG,CAAM,CAAC,EAAU,GAAcA,EAAe,EAAE,CAAM,CAAC,EAAW,GAAeA,EAAe,GAAM,CAAM,CAAC,EAAW,GAAeA,EAAe,GAAM,CAAC,MAAoB,CAAC,IAAM,EAAY,GAAG,EAAQ,GAAG,EAAc,IAAY,KAAQ,CAAC,GAAY,EAAiB,SAAS,EAAY,QAAQ,EAAc,GAAK,CAAC,eAAe,CAAC,EAAc,GAAK,CAAC,EAAc,GAAM,EAAG,EAAO,MAAM,EAAU,GAAY,EAAiB,SAAS,EAAQ,SAAQ,EAAa,IAAY,EAAU,GAAG,EAAc,OAAO,CAAC,EAAc,GAAM,EAAE,IAAM,EAAU,eAAe,CAAC,EAAoB,GAAqB,EAAY,UAAU,EAAE,EAAQ,QAAQ,EAAW,GAAG,GAAG,CAAe,EAAG,EAAO,YAAY,CAAC,UAAU,aAAa,EAAU,EAAG,CAAC,EAAiB,EAAW,EAAU,EAAQ,EAAc,EAAO,MAAM,EAAO,YAAY,EAAmB,EAAO,CAAC,CAAC,IAAM,MAA+B,EAAMC,EAAU,CAAC,SAAS,CAAC,EAAiB,UAAU,EAAE,EAAQ,OAAO,CAAc,EAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAmB,CAAC,SAAS,EAAiB,UAAU,EAAQ,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAoB,EAAM,MAAM,CAAC,MAAM,CAAC,GAAG,EAAK,MAAM,EAAU,WAAW,WAAW,SA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