{"version":3,"file":"TypewriterInput.EyS8us_d.mjs","names":["useState","startTransition"],"sources":["https:/framerusercontent.com/modules/pOl3VytMKOjviZkeUudk/lhJvVzc7B32bQXOjs4vE/TypewriterInput.js"],"sourcesContent":["// Input form with typewriter effect in the placeholder text\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function TypewriterInput(props){const{placeholderTexts,typeSpeed,deleteSpeed,pauseDuration,backgroundColor,textColor,borderColor,focusBorderColor,borderRadius,padding,font,height,style}=props;const[currentPlaceholder,setCurrentPlaceholder]=useState(\"\");const[currentIndex,setCurrentIndex]=useState(0);const[isDeleting,setIsDeleting]=useState(false);const[isFocused,setIsFocused]=useState(false);const[inputValue,setInputValue]=useState(\"\");useEffect(()=>{if(typeof window===\"undefined\"){startTransition(()=>setCurrentPlaceholder(placeholderTexts[0]||\"\"));return;}const currentText=placeholderTexts[currentIndex]||\"\";const timeout=setTimeout(()=>{if(!isDeleting){if(currentPlaceholder.length<currentText.length){startTransition(()=>{setCurrentPlaceholder(currentText.slice(0,currentPlaceholder.length+1));});}else{setTimeout(()=>{startTransition(()=>setIsDeleting(true));},pauseDuration);}}else{if(currentPlaceholder.length>0){startTransition(()=>{setCurrentPlaceholder(currentPlaceholder.slice(0,-1));});}else{startTransition(()=>{setIsDeleting(false);setCurrentIndex((currentIndex+1)%placeholderTexts.length);});}}},isDeleting?deleteSpeed:typeSpeed);return()=>clearTimeout(timeout);},[currentPlaceholder,currentIndex,isDeleting,placeholderTexts,typeSpeed,deleteSpeed,pauseDuration]);return /*#__PURE__*/_jsx(\"div\",{style:{...style,position:\"relative\",width:\"100%\"},children:/*#__PURE__*/_jsx(\"input\",{type:\"text\",value:inputValue,onChange:e=>startTransition(()=>setInputValue(e.target.value)),onFocus:()=>startTransition(()=>setIsFocused(true)),onBlur:()=>startTransition(()=>setIsFocused(false)),placeholder:currentPlaceholder,style:{width:\"100%\",height:`${height}px`,backgroundColor,color:textColor,border:`${isFocused?2:1.14}px solid ${isFocused?focusBorderColor:borderColor}`,borderRadius,padding,outline:\"none\",transition:\"border-color 0.2s ease\",...font}})});}addPropertyControls(TypewriterInput,{placeholderTexts:{type:ControlType.Array,title:\"Placeholder Texts\",control:{type:ControlType.String},defaultValue:[\"Enter your email...\",\"Type your message...\",\"Search anything...\"]},typeSpeed:{type:ControlType.Number,title:\"Type Speed\",defaultValue:100,min:50,max:500,step:10,unit:\"ms\"},deleteSpeed:{type:ControlType.Number,title:\"Delete Speed\",defaultValue:50,min:0,max:250,step:10,unit:\"ms\"},pauseDuration:{type:ControlType.Number,title:\"Pause Duration\",defaultValue:2e3,min:500,max:5e3,step:100,unit:\"ms\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#EEEEEE\"},focusBorderColor:{type:ControlType.Color,title:\"Focus Border\",defaultValue:\"#000000\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:36.6,min:0,max:32,step:1,unit:\"px\"},height:{type:ControlType.Number,title:\"Height\",defaultValue:71,min:20,max:200,step:1,unit:\"px\"},padding:{type:ControlType.String,title:\"Padding\",defaultValue:\"22px 18px 22px 18px\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TypewriterInput\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__Framer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