{"version":3,"file":"BlogSubscribeForm.Cmh0fYpr.mjs","names":["React.useId","React.useState","__esmMin","init_npm_react_18_3_1","_e","p","c","init_jsx_runtime","ie","addPropertyControls","init_framer_BisrWwwE","ControlType","BlogSubscribeForm","props","fieldId","email","setEmail","website","setWebsite","status","setStatus","message","setMessage","onSubmit","event","endpoint","errorMessage","response","data","successMessage","err","compact","variant","rootStyle","background","text","bodyFont","style","MailIcon","headingFont","heading","body","muted","emailLabel","buttonBackground","buttonText","buttonLabel","color","init_BlogSubscribeForm"],"sources":["https:/framerusercontent.com/modules/4f5I1lFbIpGmWjIIu621/IEtUDAFPSvI7ubIwRXVE/BlogSubscribeForm.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function BlogSubscribeForm(props){const{endpoint,variant,heading,body,buttonLabel,successMessage,errorMessage,emailLabel,placeholder,headingFont,bodyFont,background,text,muted,buttonBackground,buttonText,style}=props;const fieldId=React.useId();const[email,setEmail]=React.useState(\"\");const[website,setWebsite]=React.useState(\"\");const[status,setStatus]=React.useState(\"idle\");const[message,setMessage]=React.useState(\"\");async function onSubmit(event){event.preventDefault();if(status===\"loading\")return;setStatus(\"loading\");setMessage(\"\");try{if(!endpoint)throw new Error(errorMessage);const response=await fetch(endpoint,{method:\"POST\",headers:{\"content-type\":\"application/json\"},body:JSON.stringify({email,website})});const data=await response.json().catch(()=>({}));if(!response.ok||!data?.ok){throw new Error(data?.error||errorMessage);}setStatus(\"success\");setMessage(successMessage);setEmail(\"\");}catch(err){setStatus(\"error\");setMessage(err instanceof Error&&err.message?err.message:errorMessage);}}const compact=variant===\"compact\";const rootStyle={display:\"flex\",flexDirection:\"column\",alignItems:\"stretch\",gap:compact?16:16,width:\"100%\",boxSizing:\"border-box\",background:compact?background:\"transparent\",padding:compact?\"32px 24px\":0,color:text,fontFamily:bodyFont,...style};return /*#__PURE__*/_jsxs(\"form\",{onSubmit:onSubmit,style:rootStyle,noValidate:true,children:[compact?/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\",gap:8},children:[/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"center\",gap:10},children:[/*#__PURE__*/_jsx(MailIcon,{color:text}),/*#__PURE__*/_jsx(\"h2\",{style:{margin:0,fontFamily:headingFont,fontSize:28,fontWeight:400,lineHeight:1.3,color:text},children:heading})]}),body?/*#__PURE__*/_jsx(\"p\",{style:{margin:0,fontFamily:bodyFont,fontSize:16,lineHeight:1.5,color:muted},children:body}):null]}):null,status!==\"success\"?/*#__PURE__*/_jsx(\"label\",{htmlFor:fieldId,style:{fontFamily:bodyFont,fontSize:13,lineHeight:1.4,color:muted},children:emailLabel}):null,/*#__PURE__*/_jsx(\"div\",{\"aria-hidden\":\"true\",style:{position:\"absolute\",left:-9999,top:\"auto\",width:1,height:1,overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"input\",{tabIndex:-1,autoComplete:\"off\",name:\"website\",value:website,onChange:e=>setWebsite(e.target.value)})}),status===\"success\"?/*#__PURE__*/_jsx(\"p\",{role:\"status\",style:{margin:0,width:\"100%\",fontFamily:bodyFont,fontSize:16,lineHeight:1.5,color:text,textAlign:compact?\"left\":\"center\"},children:message}):/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexWrap:\"wrap\",gap:12,width:\"100%\",alignItems:\"stretch\"},children:[/*#__PURE__*/_jsx(\"input\",{id:fieldId,name:\"email\",type:\"email\",autoComplete:\"email\",required:true,placeholder:placeholder,value:email,onChange:e=>setEmail(e.target.value),disabled:status===\"loading\",style:{flex:\"1 1 220px\",minWidth:0,boxSizing:\"border-box\",background:\"transparent\",color:text,border:`1px solid ${muted}`,borderRadius:4,padding:\"14px 16px\",fontFamily:bodyFont,fontSize:16,lineHeight:1.4,outline:\"none\"}}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:status===\"loading\",style:{flex:\"0 0 auto\",background:buttonBackground,color:buttonText,border:0,borderRadius:4,padding:\"16px 24px\",fontFamily:bodyFont,fontSize:14,fontWeight:600,letterSpacing:\"0.06em\",textTransform:\"uppercase\",cursor:status===\"loading\"?\"wait\":\"pointer\"},children:status===\"loading\"?\"Subscribing\":buttonLabel})]}),status===\"error\"&&message?/*#__PURE__*/_jsx(\"p\",{role:\"alert\",style:{margin:0,fontFamily:bodyFont,fontSize:14,lineHeight:1.5,color:text},children:message}):null]});}function MailIcon({color}){return /*#__PURE__*/_jsxs(\"svg\",{xmlns:\"http://www.w3.org/2000/svg\",width:\"20\",height:\"20\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:color,strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",\"aria-hidden\":\"true\",children:[/*#__PURE__*/_jsx(\"rect\",{width:\"20\",height:\"16\",x:\"2\",y:\"4\",rx:\"2\"}),/*#__PURE__*/_jsx(\"path\",{d:\"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7\"})]});}BlogSubscribeForm.defaultProps={endpoint:\"\",variant:\"fields\",heading:\"Subscribe to our blog\",body:\"Get new articles when we publish.\",buttonLabel:\"Subscribe\",successMessage:\"You're subscribed. We'll email you when we publish a new post.\",errorMessage:\"Something went wrong. Please try again.\",emailLabel:\"Email\",placeholder:\"Your email\",headingFont:\"'Instrument Serif', serif\",bodyFont:\"Inter, sans-serif\",background:\"rgb(0, 0, 0)\",text:\"rgb(255, 255, 255)\",muted:\"rgb(204, 204, 204)\",buttonBackground:\"rgb(255, 255, 255)\",buttonText:\"rgb(17, 17, 17)\"};addPropertyControls(BlogSubscribeForm,{endpoint:{type:ControlType.String,title:\"Endpoint\"},variant:{type:ControlType.Enum,title:\"Variant\",options:[\"fields\",\"compact\"],optionTitles:[\"Fields only\",\"Compact card\"],defaultValue:\"fields\"},heading:{type:ControlType.String,title:\"Heading\",hidden:p=>p.variant!==\"compact\"},body:{type:ControlType.String,title:\"Body\",hidden:p=>p.variant!==\"compact\"},buttonLabel:{type:ControlType.String,title:\"Button\"},successMessage:{type:ControlType.String,title:\"Success\"},errorMessage:{type:ControlType.String,title:\"Error\"},emailLabel:{type:ControlType.String,title:\"Email label\"},placeholder:{type:ControlType.String,title:\"Placeholder\"},headingFont:{type:ControlType.String,title:\"Heading font\"},bodyFont:{type:ControlType.String,title:\"Body font\"},background:{type:ControlType.Color,title:\"Card\",hidden:p=>p.variant!==\"compact\"},text:{type:ControlType.Color,title:\"Text\"},muted:{type:ControlType.Color,title:\"Muted\"},buttonBackground:{type:ControlType.Color,title:\"Button\"},buttonText:{type:ControlType.Color,title:\"Button text\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BlogSubscribeForm\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./BlogSubscribeForm.map"],"mappings":"A,wLAGG,SAAwBY,EAAkB,EAAM,CAAC,GAAK,CAAC,WAAS,UAAQ,UAAQ,OAAK,cAAY,iBAAe,eAAa,aAAW,cAAY,cAAY,WAAS,aAAW,OAAK,QAAM,mBAAiB,aAAW,SAAOC,EAAYC,EAAQd,EAAY,EAAO,CAACe,EAAMC,GAAUf,EAAe,EAAE,EAAO,CAACgB,EAAQC,GAAYjB,EAAe,EAAE,EAAO,CAACkB,EAAOC,GAAWnB,EAAe,MAAM,EAAO,CAACoB,EAAQC,GAAYrB,EAAe,EAAE,EAAE,eAAesB,EAAS,EAAM,CAAwB,GAAvBC,EAAM,eAAe,EAAKL,IAAS,UAAiB,GAAU,SAAS,EAAEG,EAAW,EAAE,EAAE,GAAG,CAAC,GAAG,CAACG,EAAS,MAAU,MAAMC,CAAY,EAAE,IAAMC,EAAS,MAAM,MAAMF,EAAS,CAAC,O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