{"version":3,"file":"TypeIt.Ifx36Hom.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/pTsqvSdPQFpPqMAPiUzp/3dq4S1UZ6jWGMbpraIJQ/TypeIt.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{motion}from\"framer-motion\";import{useEffect,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function TypeIt({phrases,typingSpeed,erasingSpeed,delayBetween,fontSize,fontFamily,fontWeight,color,fixedTextColor,letterSpacing,lineHeight,prefixText,suffixText,direction,spacing,verticalAlignment}){const[currentPhraseIndex,setCurrentPhraseIndex]=useState(0);const[displayedText,setDisplayedText]=useState(\"\");const[isErasing,setIsErasing]=useState(false);const adjustedTypingSpeed=500-typingSpeed;const adjustedErasingSpeed=500-erasingSpeed;useEffect(()=>{const currentPhrase=phrases[currentPhraseIndex];let timeout;if(isErasing){if(displayedText.length>0){timeout=setTimeout(()=>{setDisplayedText(prev=>prev.slice(0,-1));},adjustedErasingSpeed);}else{setIsErasing(false);setCurrentPhraseIndex(prev=>prev===phrases.length-1?0:prev+1);}}else{if(displayedText.length<currentPhrase.length){timeout=setTimeout(()=>{setDisplayedText(prev=>currentPhrase.slice(0,prev.length+1));},adjustedTypingSpeed);}else{timeout=setTimeout(()=>{setIsErasing(true);},delayBetween);}}return()=>clearTimeout(timeout);},[displayedText,isErasing,phrases,currentPhraseIndex,adjustedTypingSpeed,adjustedErasingSpeed,delayBetween]);const textAlign=verticalAlignment===\"left\"?\"flex-start\":verticalAlignment===\"right\"?\"flex-end\":\"center\";return /*#__PURE__*/_jsxs(\"div\",{style:{fontSize,fontFamily,fontWeight,color,letterSpacing,lineHeight,whiteSpace:\"nowrap\",overflow:\"visible\",display:\"flex\",flexDirection:direction===\"horizontal\"?\"row\":\"column\",alignItems:direction===\"horizontal\"?\"center\":textAlign,justifyContent:direction===\"horizontal\"?\"flex-start\":\"center\",position:\"relative\",textAlign:direction===\"vertical\"?verticalAlignment:\"left\",gap:prefixText||suffixText?spacing:0,width:\"100%\",height:\"100%\",boxSizing:\"border-box\",padding:0},children:[prefixText&&/*#__PURE__*/_jsx(\"span\",{style:{color:fixedTextColor},children:prefixText},\"prefix\"),/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"row\",alignItems:\"center\"},children:[/*#__PURE__*/_jsx(\"span\",{children:displayedText}),/*#__PURE__*/_jsx(motion.span,{animate:{opacity:[1,0]},transition:{duration:.5,repeat:Infinity},style:{borderRight:\"2px solid\",marginLeft:2,height:\"1em\"}},\"cursor\")]}),suffixText&&/*#__PURE__*/_jsx(\"span\",{style:{color:fixedTextColor},children:suffixText},\"suffix\")]});}TypeIt.defaultProps={phrases:[\"Hello, World!\",\"Welcome to Framer!\",\"Let's build something amazing!\"],typingSpeed:300,erasingSpeed:300,delayBetween:2e3,fontSize:24,fontFamily:\"Inter\",fontWeight:400,color:\"#000\",fixedTextColor:\"#888\",letterSpacing:0,lineHeight:1.5,prefixText:\"\",suffixText:\"\",direction:\"horizontal\",spacing:12,verticalAlignment:\"center\"};/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */addPropertyControls(TypeIt,{phrases:{type:ControlType.Array,title:\"Words / Phrases\",control:{type:ControlType.String},defaultValue:[\"Hello, World!\",\"Welcome to Framer!\",\"Let's build something amazing!\"]},typingSpeed:{type:ControlType.Number,title:\"Typing Speed\",defaultValue:150,min:50,max:500},erasingSpeed:{type:ControlType.Number,title:\"Erasing Speed\",defaultValue:100,min:50,max:500},delayBetween:{type:ControlType.Number,title:\"Delay Between Phrases\",defaultValue:2e3,min:500,max:5e3},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:24},fontFamily:{type:ControlType.String,title:\"Font Family\",defaultValue:\"Inter\"},fontWeight:{type:ControlType.Number,title:\"Font Weight\",defaultValue:400},color:{type:ControlType.Color,title:\"Animated Text Color\",defaultValue:\"#000\"},fixedTextColor:{type:ControlType.Color,title:\"Fixed Text Color\",defaultValue:\"#888\"},letterSpacing:{type:ControlType.Number,title:\"Letter Spacing\",defaultValue:0,min:-5,max:20,step:.1},lineHeight:{type:ControlType.Number,title:\"Line Height\",defaultValue:1.5,min:.5,max:3,step:.1},prefixText:{type:ControlType.String,title:\"Prefix Text\",defaultValue:\"\"},suffixText:{type:ControlType.String,title:\"Suffix Text\",defaultValue:\"\"},direction:{type:ControlType.Enum,title:\"Direction\",defaultValue:\"horizontal\",options:[\"horizontal\",\"vertical\"],optionTitles:[\"Horizontal\",\"Vertical\"]},spacing:{type:ControlType.Number,title:\"Spacing\",defaultValue:8,min:0,max:50,step:1},verticalAlignment:{type:ControlType.Enum,title:\"Vertical Alignment\",defaultValue:\"center\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],hidden:props=>props.direction!==\"vertical\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TypeIt\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TypeIt.map"],"mappings":"yOAAqL,SAAwB,EAAO,CAAC,UAAQ,cAAY,eAAa,eAAa,WAAS,aAAW,aAAW,QAAM,iBAAe,gBAAc,aAAW,aAAW,aAAW,YAAU,UAAQ,qBAAmB,CAAC,GAAK,CAAC,EAAmB,GAAuBA,EAAS,EAAE,CAAM,CAAC,EAAc,GAAkBA,EAAS,GAAG,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAO,EAAoB,IAAI,EAAkB,EAAqB,IAAI,EAA4wB,OAA/vB,MAAc,CAAC,IAAM,EAAc,EAAQ,GAAwB,EAAsc,OAA3b,EAAc,EAAc,OAAO,EAAG,EAAQ,eAAe,CAAC,EAAiB,GAAM,EAAK,MAAM,EAAE,GAAG,CAAC,EAAG,EAAqB,EAAO,EAAa,GAAM,CAAC,EAAsB,GAAM,IAAO,EAAQ,OAAO,EAAE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