{"version":3,"file":"EmailInput.8ZHJsEgO.mjs","names":["useState","useCallback"],"sources":["https:/framerusercontent.com/modules/LwibiQitRFPnSmrThsW7/3DzvSPvp4O2ByfZc8sXW/EmailInput.js"],"sourcesContent":["// Email input component with validation that prevents invalid email formats from being submitted\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useCallback,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Email Input with Validation\n * \n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function EmailInput(props){const{placeholder=\"max@gmail.com\",backgroundColor=\"#BBBBBB\",textColor=\"#303030\",placeholderColor=\"#999999\",borderRadius=10,padding=12,font,borderColor=\"#888888\",borderWidth=1,name=\"email\",required=true,errorMessage=\"Bitte geben Sie eine g\\xfcltige E-Mail-Adresse ein\",onValidEmail,onInvalidEmail,style}=props;const[email,setEmail]=useState(\"\");const[error,setError]=useState(\"\");const validateEmail=useCallback(value=>{// Comprehensive email validation regex\nconst emailRegex=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$/;if(!emailRegex.test(value)){return false;}// Additional check for common TLD typos\nconst domain=value.split(\"@\")[1];if(!domain)return false;const tld=domain.split(\".\").pop()?.toLowerCase();// List of invalid/typo TLDs to reject\nconst invalidTLDs=[\"cim\",\"con\",\"cpm\",\"comm\",\"nett\",\"orgg\",\"edu1\",\"gov1\"];if(tld&&invalidTLDs.includes(tld)){return false;}return true;},[]);const handleChange=useCallback(e=>{const value=e.target.value;startTransition(()=>{setEmail(value);setError(\"\");});},[]);const handleBlur=useCallback(()=>{if(email.trim()===\"\"){startTransition(()=>setError(\"\"));return;}const isValid=validateEmail(email);if(!isValid){startTransition(()=>setError(errorMessage));if(onInvalidEmail){onInvalidEmail(email);}}else{startTransition(()=>setError(\"\"));if(onValidEmail){onValidEmail(email);}}},[email,validateEmail,errorMessage,onValidEmail,onInvalidEmail]);const handleKeyDown=useCallback(e=>{if(e.key===\"Enter\"){handleBlur();}},[handleBlur]);return /*#__PURE__*/_jsxs(\"div\",{style:{...style,position:\"relative\",width:\"100%\",height:\"100%\",display:\"flex\",flexDirection:\"column\",gap:4},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                .email-input::placeholder {\n                    color: ${placeholderColor};\n                    opacity: 1;\n                }\n                .email-input:focus {\n                    border: ${borderWidth}px solid ${error?\"#FF5588\":\"#0099FF\"} !important;\n                }\n            `}),/*#__PURE__*/_jsx(\"input\",{type:\"email\",name:name,required:required,value:email,onChange:handleChange,onBlur:handleBlur,onKeyDown:handleKeyDown,placeholder:placeholder,className:\"email-input\",style:{width:\"100%\",height:\"100%\",backgroundColor,color:textColor,borderRadius,padding,border:error?`${borderWidth}px solid #FF5588`:`${borderWidth}px solid ${borderColor}`,outline:\"none\",boxSizing:\"border-box\",...font}}),error&&/*#__PURE__*/_jsx(\"span\",{style:{position:\"absolute\",bottom:-20,left:0,fontSize:12,color:\"#FF5588\",fontWeight:500},children:error})]});}addPropertyControls(EmailInput,{name:{type:ControlType.String,title:\"Name\",defaultValue:\"email\"},placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"max@gmail.com\"},required:{type:ControlType.Boolean,title:\"Required\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},errorMessage:{type:ControlType.String,title:\"Error Message\",defaultValue:\"Bitte geben Sie eine g\\xfcltige E-Mail-Adresse ein\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#BBBBBB\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#303030\"},placeholderColor:{type:ControlType.Color,title:\"Placeholder Color\",defaultValue:\"#999999\"},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#888888\"},borderWidth:{type:ControlType.Number,title:\"Border Width\",defaultValue:1,min:0,max:10,step:1},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:10,min:0,max:50,step:1},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:12,min:0,max:50,step:1},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"16px\",variant:\"Light\",letterSpacing:\"0em\",lineHeight:\"1.2em\"}},onValidEmail:{type:ControlType.EventHandler},onInvalidEmail:{type:ControlType.EventHandler}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"EmailInput\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./EmailInput.map"],"mappings":"+LAMG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,cAAY,gBAAgB,kBAAgB,UAAU,YAAU,UAAU,mBAAiB,UAAU,eAAa,GAAG,UAAQ,GAAG,OAAK,cAAY,UAAU,cAAY,EAAE,OAAK,QAAQ,WAAS,GAAK,eAAa,kDAAqD,eAAa,iBAAe,SAAO,EAAW,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAO,EAAcC,EAAY,GAAO,CAC3Y,GAAG,CAAtD,mDAAkE,KAAK,EAAM,CAAE,MAAO,GACvG,IAAM,EAAO,EAAM,MAAM,IAAI,CAAC,GAAG,GAAG,CAAC,EAAO,MAAO,GAAM,IAAM,EAAI,EAAO,MAAM,IAAI,CAAC,KAAK,EAAE,aAAa,CACiB,MAAjD,EAAG,GAA1D,CAAC,MAAM,MAAM,MAAM,OAAO,OAAO,OAAO,OAAO,OAAO,CAAqB,SAAS,EAAI,GAA8B,EAAE,CAAC,CAAO,EAAaA,EAAY,GAAG,CAAC,IAAM,EAAM,EAAE,OAAO,MAAM,MAAoB,CAAC,EAAS,EAAM,CAAC,EAAS,GAAG,EAAG,EAAG,EAAE,CAAC,CAAO,EAAWA,MAAgB,CAAC,GAAG,E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