{"version":3,"file":"SelectOptionsFix.BKij8w9R.mjs","names":[],"sources":["https:/framerusercontent.com/modules/1GA3T2oQS0MYSLDbUA5h/NQLAY4ZAWFCcZDSV8GWE/SelectOptionsFix.js"],"sourcesContent":["import{jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,RenderTarget,useLocaleInfo}from\"framer\";function useIsEnglish(){const info=useLocaleInfo();const code=String(info?.activeLocale?.code||\"\").toLowerCase();return code.startsWith(\"en\");}function splitOptions(value){return String(value||\"\").split(/\\||\\n/).map(s=>s.trim()).filter(s=>s!==\"\");}/**\n * Force les options d'un champ <select> d'un formulaire Framer natif,\n * sur tous les breakpoints (corrige les options figées en Tablet / Phone).\n * Invisible sur le site. Options séparées par « | ».\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function SelectOptionsFix(props){const{fieldName=\"\",options=\"\",optionsEn=\"\"}=props;const isEn=useIsEnglish();const fr=splitOptions(options);const en=splitOptions(optionsEn);const wanted=isEn&&en.length?en:fr;const wantedKey=wanted.join(\"||\");const isCanvas=RenderTarget.current()===RenderTarget.canvas;React.useEffect(()=>{if(isCanvas||!fieldName||wanted.length===0)return;if(typeof document===\"undefined\")return;const apply=()=>{const selector=`select[name=\"${fieldName.replace(/\"/g,'\\\\\"')}\"]`;document.querySelectorAll(selector).forEach(sel=>{const opts=Array.from(sel.options);const current=opts.filter(o=>!o.hidden).map(o=>o.value).join(\"||\");if(current===wantedKey)return;const prevIndex=sel.selectedIndex;// Modification en place (pas de suppression de noeuds gérés par React)\nwanted.forEach((label,i)=>{let opt=opts[i];if(!opt){opt=document.createElement(\"option\");sel.appendChild(opt);}opt.value=label;opt.textContent=label;opt.hidden=false;opt.disabled=false;});for(let i=wanted.length;i<opts.length;i++){opts[i].hidden=true;opts[i].disabled=true;}sel.selectedIndex=prevIndex>=0&&prevIndex<wanted.length?prevIndex:0;});};apply();const observer=new MutationObserver(()=>apply());observer.observe(document.body,{childList:true,subtree:true});window.addEventListener(\"resize\",apply);return()=>{observer.disconnect();window.removeEventListener(\"resize\",apply);};},[isCanvas,fieldName,wantedKey]);if(!isCanvas)return null;return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",border:\"1px dashed rgba(1,45,68,0.4)\",borderRadius:4,fontSize:10,fontFamily:\"Inter, sans-serif\",color:\"rgb(1,45,68)\",background:\"rgba(255,253,245,0.9)\",textAlign:\"center\",padding:4,boxSizing:\"border-box\"},children:[\"Options \\xab \",fieldName||\"?\",\" \\xbb (\",fr.length,\")\"]});}addPropertyControls(SelectOptionsFix,{fieldName:{type:ControlType.String,title:\"Nom du champ\",defaultValue:\"Objet (Commerces)\",description:\"Doit \\xeatre identique au \\xab Name \\xbb du Select dans le formulaire.\"},options:{type:ControlType.String,title:\"Options FR\",displayTextArea:true,defaultValue:\"Option 1 | Option 2 | Autre\",description:\"S\\xe9par\\xe9es par \\xab | \\xbb ou un retour \\xe0 la ligne.\"},optionsEn:{type:ControlType.String,title:\"Options EN\",displayTextArea:true,defaultValue:\"\",description:\"Facultatif. Utilis\\xe9es sur la version anglaise.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SelectOptionsFix\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SelectOptionsFix.map"],"mappings":"uMAAwJ,SAAS,GAAc,CAAC,IAAM,EAAK,EAAc,EAAgE,OAAnD,OAAO,GAAM,cAAc,MAAM,EAAE,CAAC,CAAC,YAAwB,CAAC,CAAC,WAAW,IAAI,CAAE,CAAC,SAAS,EAAa,EAAM,CAAC,OAAO,OAAO,GAAO,EAAE,CAAC,CAAC,MAAM,OAAO,CAAC,CAAC,IAAI,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