{"version":3,"file":"SelectField.BALCmg14.mjs","names":["SHARED_VISIBILITY_GROUP","useState","useRef","useMemo","__esmMin","init_npm_react_18_3_1","pe","ce","init_jsx_runtime","c","p","_e","de","addPropertyControls","ControlType","useLocaleCode","init_framer_DKWANagr","getTpvOptions","init_tpvBuckets","FieldShell","init_formStores","useRenderKey","resolveBorderColor","INPUT_LIKE_STYLES_GROUP","useTouched","init_useFieldController","useFieldController","init_buildValidationConfig","buildValidationConfig","VISIBILITY_GROUP$1","requiredWhenVisible","BASE_VALIDATION_GROUP","init_requiredWhenVisible","FIELD_BASE_GROUP","init_groups","resolveInputStyles","init_FieldShell","init_resolveBorderColor","SELECT_BEHAVIOR_CONTROLS","STYLES_GROUP","VISIBILITY_GROUP","init_controls","SelectField","props","isFocused","setIsFocused","iconWidth","setIconWidth","renderKey","setTouched","selectRef","iconRef","lastRenderKeyRef","lastEffectRenderKeyRef","setValue","prev","apiName","observer","entry","entries","countryCode","normalizedOptions","options","o","styles","border","isTouched","errorBorderColor","focusBorderColor","borderColor","hasIcon","icon","leftPad","paddingH","wrapperStyle","selectStyle","value","textColor","placeholderColor","paddingV","height","lineHeight","error","required","visible","next","handleChange","validateSoon","markTouched","validateNow","handleBlur","handleFocus","placeholder","opt","init_SelectField","init_resolveInputStyles"],"sources":["https:/framerusercontent.com/modules/jGDRwUN8C3dSx4an2Rnk/0pcmsTrIaZPj0qLOK9H3/controls.js","https:/framerusercontent.com/modules/EAqQWXlNB7I0PDrJI272/H3btn4SQBIpebaIijvCg/SelectField.js"],"sourcesContent":["import{ControlType}from\"framer\";import{FIELD_BASE_GROUP,BASE_VALIDATION_GROUP,INPUT_LIKE_STYLES_GROUP,VISIBILITY_GROUP as SHARED_VISIBILITY_GROUP}from\"https://framerusercontent.com/modules/C8tNKt5QFlvgRghgBcI7/QSBiltfheNvniAd76oGI/groups.js\";// Behavior-only (base + select-specific bits)\nexport const SELECT_BEHAVIOR_CONTROLS={...FIELD_BASE_GROUP,placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Select an option\"},options:{type:ControlType.Array,title:\"Options\",propertyControl:{type:ControlType.Object,controls:{title:{type:ControlType.String,title:\"Title\",defaultValue:\"Option Label\"},value:{type:ControlType.String,title:\"Value\",defaultValue:\"option_value\"}}},defaultValue:[{title:\"First option\",value:\"1\"},{title:\"Second option\",value:\"2\"},{title:\"Third option\",value:\"3\"}]},// shared validation (regex/min/max stay conditional via BASE_VALIDATION_GROUP)\n...BASE_VALIDATION_GROUP};// One “Styles” object with nested sections from shared groups\nexport const STYLES_GROUP={styles:{type:ControlType.Object,title:\"Styles\",controls:{...INPUT_LIKE_STYLES_GROUP}}};// Visibility (shared)\nexport const VISIBILITY_GROUP=SHARED_VISIBILITY_GROUP;\nexport const __FramerMetadata__ = {\"exports\":{\"VISIBILITY_GROUP\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"STYLES_GROUP\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"SELECT_BEHAVIOR_CONTROLS\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useMemo,useState,useRef,useEffect}from\"react\";import{addPropertyControls,ControlType,useLocaleCode}from\"framer\";import{FieldShell}from\"https://framerusercontent.com/modules/Y7BsCDAZ62PW8UCuAxAR/eYfP4PWTX5NJfei4V1k9/FieldShell.js\";import{resolveBorderColor}from\"https://framerusercontent.com/modules/SuWmgiqEfziwld4tZjk0/vb8Ppfe3v4uGW3SEUjKK/resolveBorderColor.js\";import{resolveInputStyles}from\"https://framerusercontent.com/modules/TTk3k6z1DBNnw11HPDoi/UW2qJn2g2OkOcIXT204S/resolveInputStyles.js\";import{buildValidationConfig}from\"https://framerusercontent.com/modules/ZAzAf2l3YtTE023XEAPY/6IKs8kEebel4WFLLKexC/buildValidationConfig.js\";import{requiredWhenVisible}from\"https://framerusercontent.com/modules/e3bwJJzcbGbYL2t6KZy3/kO1TIg95YTyfRIpPfLWl/requiredWhenVisible.js\";import{useFieldController}from\"https://framerusercontent.com/modules/De6fH1u2sz6OPdwkg379/P1JO08TEYW0zT6qGI6ke/useFieldController.js\";import{useRenderKey,useTouched}from\"https://framerusercontent.com/modules/Ax3pgpFugmVtkLyjK0aB/aDpsy8V26LRvJ6yNDXja/formStores.js\";import{SELECT_BEHAVIOR_CONTROLS,STYLES_GROUP,VISIBILITY_GROUP}from\"https://framerusercontent.com/modules/jGDRwUN8C3dSx4an2Rnk/0pcmsTrIaZPj0qLOK9H3/controls.js\";import{getTpvOptions}from\"https://framerusercontent.com/modules/WSbRwPXG1NmB70ZmGYf5/fzP2NJXQ1KdDG7NbMJi4/tpvBuckets.js\";export function SelectField(props){const{// base\nlabel,apiName,required=false,errorRequired,errorInvalid,errorTooYoung,validationRule=\"none\",minLength,maxLength,regex,regexFlags,visibility,styles={},// select-specific\noptions=[],placeholder=\"Select an option\",// optional icon\nicon}=props;const{value,setValue,error,isTouched,visible,validateNow,validateSoon,markTouched,handleFocus,handleBlur,handleChange}=useFieldController({apiName,initialValue:\"\",visibility,validation:buildValidationConfig({required,errorRequired,errorInvalid,errorTooYoung,validationRule,minLength,maxLength,regex,regexFlags})});const[isFocused,setIsFocused]=useState(false);const[iconWidth,setIconWidth]=useState(0);const renderKey=useRenderKey()[0];const[,setTouched]=useTouched();const selectRef=useRef(null);const iconRef=useRef(null);const lastRenderKeyRef=useRef(renderKey);const lastEffectRenderKeyRef=useRef(renderKey);// Reset field controller state when render key changes (synchronous)\nif(lastRenderKeyRef.current!==renderKey){lastRenderKeyRef.current=renderKey;setValue(\"\")// Reset field controller state immediately\n;setTouched(prev=>({...prev,[apiName]:false}))// Clear touched state\n;}// Reset DOM select value when render key changes\nuseEffect(()=>{if(lastEffectRenderKeyRef.current!==renderKey){lastEffectRenderKeyRef.current=renderKey;if(selectRef.current){selectRef.current.value=\"\";}}},[renderKey]);useEffect(()=>{if(!iconRef.current)return;const observer=new ResizeObserver(entries=>{for(const entry of entries){setIconWidth(entry.contentRect.width);}});observer.observe(iconRef.current);return()=>observer.disconnect();},[iconRef.current]);const countryCode=useLocaleCode().split(\"-\")[1]??\"GB\";const normalizedOptions=useMemo(()=>(apiName===\"lead_expected_monthly_tpv\"?getTpvOptions(countryCode,options??[]):options??[]).map(o=>({title:o.title,value:String(o.value)})),[options,apiName,countryCode]);const{fontSize,fontWeight,letterSpacing,lineHeight,textAlign,textColor,placeholderColor,backgroundColor,borderColor,focusBorderColor,errorBorderColor,borderRadius,borderWidth,paddingV,paddingH,height,labelStyle,labelSpacing,errorStyle}=resolveInputStyles(styles);const border=resolveBorderColor({showError:isTouched,error,isFocused,errorColor:errorBorderColor,focusColor:focusBorderColor,baseColor:borderColor});const ICON_GAP=8;const hasIcon=Boolean(icon);const leftPad=hasIcon&&iconWidth>0?paddingH+iconWidth+ICON_GAP:paddingH;const wrapperStyle={position:\"relative\",width:\"100%\",display:\"flex\",alignItems:\"center\"};const selectStyle={width:\"100%\",display:\"block\",boxSizing:\"border-box\",color:value?textColor:placeholderColor,backgroundColor,borderColor:border,borderWidth,borderStyle:\"solid\",borderRadius,paddingTop:paddingV,paddingBottom:paddingV,paddingRight:paddingH,paddingLeft:leftPad,height:height?`${height}px`:undefined,outline:\"none\",fontSize,fontWeight,fontFamily:\"Figtree, sans-serif\",letterSpacing,lineHeight:`${lineHeight}px`,textAlign,transition:\"border-color 120ms ease, color 120ms ease\",appearance:\"none\"};const iconStyle={position:\"absolute\",left:paddingH,top:\"50%\",transform:\"translateY(-50%)\",display:hasIcon?\"flex\":\"none\",alignItems:\"center\",justifyContent:\"center\",pointerEvents:\"none\"};const onChange=e=>{const next=e.target.value;setValue(next);handleChange(next);validateSoon(next);};const onBlur=()=>{markTouched();validateNow(selectRef.current?.value??\"\");handleBlur();setIsFocused(false);};const onFocus=()=>{handleFocus();setIsFocused(true);};return /*#__PURE__*/_jsx(FieldShell,{visible:visible,label:label,labelStyle:labelStyle,labelSpacing:labelSpacing,error:isTouched&&error?error:null,errorStyle:errorStyle,children:/*#__PURE__*/_jsxs(\"div\",{style:wrapperStyle,children:[icon?/*#__PURE__*/_jsx(\"div\",{ref:iconRef,style:iconStyle,children:icon}):null,/*#__PURE__*/_jsxs(\"select\",{ref:selectRef,name:apiName,required:requiredWhenVisible(required,visible),style:selectStyle,defaultValue:value??\"\",onChange:onChange,onBlur:onBlur,onFocus:onFocus,children:[/*#__PURE__*/_jsx(\"option\",{value:\"\",disabled:true,hidden:true,children:placeholder}),normalizedOptions.map(opt=>/*#__PURE__*/_jsx(\"option\",{value:opt.value,children:opt.title},opt.value))]}),/*#__PURE__*/_jsx(\"svg\",{viewBox:\"0 0 20 20\",width:\"16\",height:\"16\",fill:\"none\",stroke:textColor,strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",style:{position:\"absolute\",pointerEvents:\"none\",right:paddingH,top:\"50%\",transform:\"translateY(-50%)\"},children:/*#__PURE__*/_jsx(\"polyline\",{points:\"6 8 10 12 14 8\"})})]})});}addPropertyControls(SelectField,{...SELECT_BEHAVIOR_CONTROLS,...STYLES_GROUP,...VISIBILITY_GROUP,icon:{type:ControlType.ComponentInstance,title:\"Icon\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"SelectField\":{\"type\":\"reactComponent\",\"name\":\"SelectField\",\"slots\":[\"icon\"],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"A,yeACa,EAAyB,CAAC,GAAGiC,EAAiB,YAAY,CAAC,KAAKnB,EAAY,OAAO,MAAM,cAAc,aAAa,kBAAkB,EAAE,QAAQ,CAAC,KAAKA,EAAY,MAAM,MAAM,UAAU,gBAAgB,CAAC,KAAKA,EAAY,OAAO,SAAS,CAAC,MAAM,CAAC,KAAKA,EAAY,OAAO,MAAM,QAAQ,aAAa,cAAc,EAAE,MAAM,CAAC,KAAKA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