{"version":3,"file":"OmbrineForm.ByFMORLE.mjs","names":["useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/KKlggnxcmJFGf2pB5bs6/sETJB43my3pJWhnUkwEJ/OmbrineForm.js"],"sourcesContent":["// Ombrine forms — the newsletter line in the footer and the fitting form on\n// Stores. Submissions are POSTed as form data to \"Send to\" (Formspree, Basin,\n// Mailchimp, Make, Zapier…). Leave it empty while designing: the form then\n// just shows its thank-you state.\nimport{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{T,ff}from\"https://framerusercontent.com/modules/oUXMVQOxy4sbV3MK6xzP/3AdG0mnQaYrfHYxQcHhZ/OmbrineStore.js\";const plain={appearance:\"none\",background:\"none\",border:\"none\",padding:0,margin:0,font:\"inherit\",color:\"inherit\",cursor:\"pointer\"};/**\n * Ombrine form\n *\n * @framerIntrinsicWidth 520\n * @framerIntrinsicHeight 52\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function OmbrineForm(props){const{kind=\"newsletter\",action=\"\",onDark=false,placeholder=\"Your email\",submit=\"Subscribe  →\",sending=\"Sending…\",thanks=\"Thank you — the next letter is yours.\",error=\"Something went wrong. Please try again.\",fields=DEFAULT_FIELDS,style}=props;const[state,setState]=useState(\"idle\");const[preset,setPreset]=useState({});const ink=onDark?\"#EEE7DC\":T.ink;const soft=onDark?\"#A39A8E\":T.inkSoft;const line=onDark?\"rgba(238,231,220,0.35)\":T.outline;// \"Book a fitting\" links can pre-select a house: /stores?house=Paris#contact\nuseEffect(()=>{if(kind!==\"fitting\"||typeof window===\"undefined\")return;const read=()=>{const p=new URLSearchParams(window.location.search);const h=p.get(\"house\");if(h)setPreset(s=>({...s,house:h,about:s.about||\"\"}));};read();const on=e=>{const h=e.detail;if(h)setPreset(s=>({...s,house:h}));};window.addEventListener(\"ombrine:house\",on);return()=>window.removeEventListener(\"ombrine:house\",on);},[kind]);const onSubmit=async e=>{e.preventDefault();const data=new FormData(e.currentTarget);setState(\"sending\");if(!action){setTimeout(()=>setState(\"done\"),600);return;}try{const res=await fetch(action,{method:\"POST\",body:data,headers:{Accept:\"application/json\"}});setState(res.ok?\"done\":\"error\");}catch(err){setState(\"error\");}};if(kind===\"newsletter\"){return /*#__PURE__*/_jsx(\"form\",{onSubmit:onSubmit,style:{...style,width:\"100%\",display:\"flex\",alignItems:\"center\",gap:16,height:52,borderBottom:`1px solid ${line}`,fontFamily:ff.sans()},children:state===\"done\"?/*#__PURE__*/_jsx(\"span\",{style:{fontSize:15,color:ink},children:thanks}):/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"input\",{name:\"email\",type:\"email\",required:true,placeholder:placeholder,\"aria-label\":placeholder,style:{flex:1,minWidth:0,height:44,border:\"none\",outline:\"none\",background:\"transparent\",color:ink,fontFamily:\"inherit\",fontSize:15,padding:0}}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",style:{...plain,color:ink,fontSize:14,fontWeight:500,letterSpacing:\"0.004em\",whiteSpace:\"pre\",minHeight:44,opacity:state===\"sending\"?.6:1},children:state===\"sending\"?sending:state===\"error\"?error:submit})]})});}const label={fontSize:12,letterSpacing:\"0.006em\",color:soft,marginBottom:10,display:\"block\"};const box={width:\"100%\",boxSizing:\"border-box\",height:48,border:\"none\",borderBottom:`1px solid ${line}`,background:\"transparent\",color:ink,fontFamily:\"inherit\",fontSize:15,outline:\"none\",padding:0,borderRadius:0};return /*#__PURE__*/_jsxs(\"form\",{onSubmit:onSubmit,style:{...style,width:\"100%\",display:\"flex\",flexWrap:\"wrap\",gap:\"32px 24px\",fontFamily:ff.sans(),color:ink},children:[fields.map(f=>{const key=(f.name||f.label).toLowerCase();const width=f.half?\"calc(50% - 12px)\":\"100%\";return /*#__PURE__*/_jsxs(\"label\",{style:{width,minWidth:220,flexGrow:1},children:[/*#__PURE__*/_jsx(\"span\",{style:label,children:f.label}),f.type===\"select\"?/*#__PURE__*/_jsx(\"select\",{name:key,defaultValue:preset[key]||undefined,style:{...box,cursor:\"pointer\"},children:(f.options||\"\").split(\",\").map(o=>o.trim()).filter(Boolean).map(o=>/*#__PURE__*/_jsx(\"option\",{value:o,children:o},o))},preset[key]||\"x\"):f.type===\"textarea\"?/*#__PURE__*/_jsx(\"textarea\",{name:key,placeholder:f.placeholder,rows:4,style:{...box,height:120,resize:\"vertical\",paddingTop:12}}):/*#__PURE__*/_jsx(\"input\",{name:key,type:f.type,required:f.type===\"email\",placeholder:f.placeholder,style:box})]},key);}),/*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",display:\"flex\",alignItems:\"center\",gap:20},children:[/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:state===\"sending\"||state===\"done\",style:{...plain,height:52,padding:\"0 32px\",background:state===\"done\"?T.oxblood:T.ink,color:state===\"done\"?\"#EEE7DC\":T.onInk,fontSize:14,fontWeight:500,letterSpacing:\"0.004em\",borderRadius:2},children:state===\"sending\"?sending:state===\"done\"?\"✓\":submit}),(state===\"done\"||state===\"error\")&&/*#__PURE__*/_jsx(\"span\",{style:{fontSize:14,color:state===\"error\"?T.oxblood:soft},children:state===\"done\"?thanks:error})]})]});}const DEFAULT_FIELDS=[{name:\"name\",label:\"Name\",type:\"text\",options:\"\",placeholder:\"Camille Laurent\",half:true},{name:\"email\",label:\"Email\",type:\"email\",options:\"\",placeholder:\"camille@email.com\",half:true},{name:\"about\",label:\"About\",type:\"select\",options:\"A fitting, An order, Alterations, Something else\",placeholder:\"\",half:true},{name:\"house\",label:\"House\",type:\"select\",options:\"Paris, Milan, Dubai, Shanghai\",placeholder:\"\",half:true},{name:\"message\",label:\"Message\",type:\"textarea\",options:\"\",placeholder:\"I would like to try the wrap coat in 38 and 40 on a Saturday morning.\",half:false}];addPropertyControls(OmbrineForm,{kind:{type:ControlType.Enum,title:\"Kind\",options:[\"newsletter\",\"fitting\"],optionTitles:[\"Newsletter line\",\"Fitting form\"],defaultValue:\"newsletter\",displaySegmentedControl:true},action:{type:ControlType.String,title:\"Send to\",defaultValue:\"\",placeholder:\"https://formspree.io/f/…\",description:\"Endpoint that receives a POST with the fields. Empty = demo mode (shows the thank-you state).\"},onDark:{type:ControlType.Boolean,title:\"On dark band\",defaultValue:false,description:\"Bone text for the Nuit footer.\"},placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Your email\",hidden:p=>p.kind!==\"newsletter\"},submit:{type:ControlType.String,title:\"Submit\",defaultValue:\"Subscribe  →\"},sending:{type:ControlType.String,title:\"Sending\",defaultValue:\"Sending…\"},thanks:{type:ControlType.String,title:\"Thanks\",defaultValue:\"Thank you — the next letter is yours.\"},error:{type:ControlType.String,title:\"Error\",defaultValue:\"Something went wrong. Please try again.\"},fields:{type:ControlType.Array,title:\"Fields\",hidden:p=>p.kind!==\"fitting\",control:{type:ControlType.Object,controls:{name:{type:ControlType.String,title:\"Key\",defaultValue:\"field\",description:\"Sent as the field name. Use “house” for the store select.\"},label:{type:ControlType.String,title:\"Label\",defaultValue:\"Field\"},type:{type:ControlType.Enum,title:\"Type\",options:[\"text\",\"email\",\"select\",\"textarea\"],defaultValue:\"text\"},options:{type:ControlType.String,title:\"Options\",defaultValue:\"\",description:\"Comma-separated, for selects.\"},placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"\"},half:{type:ControlType.Boolean,title:\"Half width\",defaultValue:true}}},defaultValue:DEFAULT_FIELDS}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"OmbrineForm\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"520\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"52\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"2QAWG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,OAAK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