{"version":3,"file":"BusinessMail.C44cd6vw.mjs","names":["React.useState","React.useRef"],"sources":["https:/framerusercontent.com/modules/hhkBrZf29XXci89PgokX/igD9aOp5x3WsxIX5tgbo/BusinessMail.js"],"sourcesContent":["// File: BusinessEmailInput.tsx\n// Framer Code Component — Business-only email validator\n// Prevents form submission if domain is gmail.com or yahoo.com\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";const weightMap={Regular:400,Medium:500,Semibold:600,Bold:700};// Only block these two per the request\nconst BLOCKED_FREE_DOMAINS=new Set([\"gmail.com\",\"yahoo.com\",\"outlook.com\",\"hotmail.com\"]);function isBusinessEmail(value){const email=value.trim().toLowerCase();// Basic email shape\nconst shapeOK=/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email);if(!shapeOK)return{ok:false,reason:\"Enter a valid email address.\"};const domain=email.split(\"@\")[1]||\"\";if(BLOCKED_FREE_DOMAINS.has(domain)){return{ok:false,reason:\"Use your business email.\"};}return{ok:true,reason:\"\"};}export default function BusinessEmailInput(props){const{width,height,fontSize,fontWeight,fontFamily,textColor,cornerRadius,placeholder,required,name}=props;const[value,setValue]=React.useState(\"\");const[error,setError]=React.useState(null);const inputRef=React.useRef(null);const formRef=React.useRef(null);// Attach to closest parent <form> and intercept submit\nReact.useEffect(()=>{if(!inputRef.current)return;const form=inputRef.current.closest(\"form\");if(!form)return;formRef.current=form;const onSubmit=e=>{const{ok,reason}=isBusinessEmail(inputRef.current?.value||\"\");if(!ok){e.preventDefault();e.stopPropagation();setError(reason);inputRef.current?.focus();}else{setError(null);}};form.addEventListener(\"submit\",onSubmit);return()=>form.removeEventListener(\"submit\",onSubmit);},[]);// Live validate on blur (keeps typing smooth)\nconst handleBlur=()=>{const{ok,reason}=isBusinessEmail(value);setError(ok?null:reason);};// Visuals to match the provided reference image\nconst borderColor=\"#CFD6E4\"// light cool gray\n;const placeholderColor=\"#A7B1C2\"// softer gray for placeholder\n;const paddingX=16;const inputHeight=Math.max(40,height)// minimum comfortable tap target\n;return /*#__PURE__*/_jsxs(\"div\",{style:{width,height},children:[/*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\"},children:[/*#__PURE__*/_jsx(\"input\",{ref:inputRef,type:\"email\",name:name,required:required,value:value,onChange:e=>setValue(e.target.value),onBlur:handleBlur,\"aria-invalid\":!!error,\"aria-describedby\":error?`${name}-error`:undefined,placeholder:placeholder,style:{width:\"100%\",height:inputHeight,outline:\"none\",border:`1px solid ${error?\"#D92D20\":borderColor}`,borderRadius:cornerRadius,//padding: 5,\npaddingLeft:paddingX,paddingRight:paddingX,paddingTop:13,paddingBottom:13,fontSize,fontWeight:weightMap[fontWeight],fontFamily,color:textColor,background:\"#FFFFFF\",boxSizing:\"border-box\"}}),/*#__PURE__*/_jsx(\"style\",{children:`\n          input::placeholder { color: ${placeholderColor}; opacity: 1; }\n        `})]}),error&&/*#__PURE__*/_jsx(\"div\",{id:`${name}-error`,style:{marginTop:6,fontSize:Math.max(11,fontSize-3),color:\"#D92D20\",lineHeight:1.2,fontFamily},children:error})]});}BusinessEmailInput.defaultProps={width:640,height:80,fontSize:18,fontWeight:\"Regular\",fontFamily:\"Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif\",textColor:\"#4B5563\",cornerRadius:12,placeholder:\"john@example.com\",required:true,name:\"email\"};addPropertyControls(BusinessEmailInput,{// Size controls (explicit as requested)\nwidth:{type:ControlType.Number,title:\"Width\",min:120,max:1600,displayStepper:true},height:{type:ControlType.Number,title:\"Height\",min:36,max:160,displayStepper:true},// Typography & color\nfontSize:{type:ControlType.Number,title:\"Font Size\",min:10,max:48,displayStepper:true},fontWeight:{type:ControlType.Enum,title:\"Weight\",options:[\"Regular\",\"Medium\",\"Semibold\",\"Bold\"]},fontFamily:{type:ControlType.String,title:\"Font Family\"},textColor:{type:ControlType.Color,title:\"Text Color\"},// Shape\ncornerRadius:{type:ControlType.Number,title:\"Radius\",min:0,max:32,displayStepper:true},// Field behavior\nplaceholder:{type:ControlType.String,title:\"Placeholder\"},name:{type:ControlType.String,title:\"Name\"},required:{type:ControlType.Boolean,title:\"Required\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BusinessEmailInput\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./BusinessMail.map"],"mappings":"yRAI0F,SAAS,EAAgB,EAAM,CAAC,IAAM,EAAM,EAAM,MAAM,CAAC,aAAa,CACzG,GAAG,CAA5C,6BAA6B,KAAK,EAAM,CAAa,MAAM,CAAC,GAAG,GAAM,OAAO,+BAA+B,CAAC,IAAM,EAAO,EAAM,MAAM,IAAI,CAAC,IAAI,GAA4F,OAAtF,EAAqB,IAAI,EAAO,CAAQ,CAAC,GAAG,GAAM,OAAO,2BAA2B,CAAQ,CAAC,GAAG,GAAK,OAAO,GAAG,CAAE,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAAC,QAAM,SAAO,WAAS,aAAW,aAAW,YAAU,eAAa,cAAY,WAAS,QAAM,EAAW,CAAC,EAAM,GAAUA,EAAe,GAAG,CAAM,CAAC,EAAM,GAAUA,EAAe,KAAK,CAAO,EAASC,EAAa,KAAK,CAAO,EAAQA,EAAa,KAAK,CACrkB,MAAoB,CAAC,GAAG,CAAC,EAAS,QAAQ,OAAO,IAAM,EAAK,EAAS,QAAQ,QAAQ,OAAO,CAAC,GAAG,CAAC,EAAK,OAAO,EAAQ,QAAQ,EAAK,IAAM,EAAS,GAAG,CAAC,GAAK,CAAC,KAAG,UAAQ,EAAgB,EAAS,SAAS,OAAO,GAAG,CAAK,EAA4F,EAAS,KAAK,EAAtG,EAAE,gBAAgB,CAAC,EAAE,iBAAiB,CAAC,EAAS,EAAO,CAAC,EAAS,SAAS,OAAO,GAAkE,OAAzC,EAAK,iBAAiB,SAAS,EAAS,KAAW,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