{"version":3,"file":"Email_validator.DB9fess4.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/rn0jFvAMM0MMocswi7Pw/F4AUbBj6FCe9plbO7ww8/Email_validator.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";// Regex to match common free email providers\nconst freeEmailRegex=/@(gmail|yahoo|outlook|hotmail|aol|icloud|Zoho)\\.com$/i;export function withWorkEmailValidation(Component){return props=>{const{value=\"\",onChange,style,...rest}=props;const[error,setError]=useState(null);const handleChange=event=>{const newValue=event.target.value;const isFreeEmail=freeEmailRegex.test(newValue);// Update error state based on the email validation\nif(isFreeEmail){setError(\"Please use your work email address\");}else{setError(null);}// Trigger onChange if the email is not from a free provider\nif(onChange){onChange({...event,target:{...event.target,value:newValue}});}};return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\"},children:[/*#__PURE__*/_jsx(Component,{...rest,value:value,onChange:handleChange,style:{...style,borderColor:error?\"red\":\"black\",width:\"100%\"}}),error&&/*#__PURE__*/_jsx(\"div\",{style:{color:\"white\",marginTop:\"4px\",fontSize:\"12px\"},children:error})]});};}// Adding property controls for customization\naddPropertyControls(withWorkEmailValidation,{value:{type:ControlType.String,title:\"Email\",placeholder:\"Enter your work email\"},placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Enter your work email\"},errorColor:{type:ControlType.Color,title:\"Error Color\",defaultValue:\"#ff0000\"},validColor:{type:ControlType.Color,title:\"Valid Border Color\",defaultValue:\"#000000\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"withWorkEmailValidation\":{\"type\":\"reactHoc\",\"name\":\"withWorkEmailValidation\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Email_validator.map"],"mappings":"yQAC6E,SAAgB,EAAwB,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,QAAM,GAAG,WAAS,QAAM,GAAG,GAAM,EAAW,CAAC,EAAM,GAAUA,EAAS,KAAK,CAAO,EAAa,GAAO,CAAC,IAAM,EAAS,EAAM,OAAO,MAAwB,EAAe,KAAK,EAAS,CAC7T,EAAS,qCAAqC,CAAO,EAAS,KAAK,CAChF,GAAU,EAAS,CAAC,GAAG,EAAM,OAAO,CAAC,GAAG,EAAM,OAAO,MAAM,EAAS,CAAC,CAAC,EAAI,OAAoB,EAAM,MAAM,CAAC,MAAM,CAAC,MAAM,OAAO,CAAC,SAAS,CAAc,EAAK,EAAU,CAAC,GAAG,EAAW,QAAM,SAAS,EAAa,MAAM,CAAC,GAAG,EAAM,YAAY,EAAM,MAAM,QAAQ,MAAM,OAAO,CAAC,CAAC,CAAC,GAAoB,EAAK,MAAM,CAAC,MAAM,CAAC,MAAM,QAAQ,UAAU,MAAM,SAAS,OAAO,CAAC,SAAS,EAAM,CAAC,CAAC,CAAC,CAAC,qBAHpU,IAA4B,IAAoD,CACnI,EAAe,wDAGrB,EAAoB,EAAwB,CAAC,MAAM,CAAC,KAAK,EAAY,OAAO,MAAM,QAAQ,YAAY,wBAAwB,CAAC,YAAY,CAAC,KAAK,EAAY,OAAO,MAAM,cAAc,aAAa,wBAAwB,CAAC,WAAW,CAAC,KAAK,EAAY,MAAM,MAAM,cAAc,aAAa,UAAU,CAAC,WAAW,CAAC,KAAK,EAAY,MAAM,MAAM,qBAAqB,aAAa,UAAU,CAAC,CAAC"}