{"version":3,"file":"ButtonInputGroup.BJ9XC_sg.mjs","names":["useState","useRef","useMemo","useCallback","__esmMin","init_ssg_sandbox_shims","te","ne","_e","pe","p","c","init_jsx_runtime","ce","init_npm_react_18_3_1","de","window","init_framer_Bf4_tcb2","addPropertyControls","ControlType","ButtonGroup","props","selectedValues","setSelectedValues","rootRef","associatedFormId","setAssociatedFormId","resolvedOptions","optionsJson","options","parsed","item","handleButtonClick","multiSelect","prev","value","v","onValueChange","root","nearestForm","formId","containerStyle","layout","columns","gapV","gapH","horizontalAlign","verticalAlign","style","formValue","hasSelection","resolvedFieldName","fieldName","name","submittedValues","label","required","isSelected","option","buttonPadding","buttonRadius","selectedBorderColor","buttonBorderColor","selectedBackground","buttonBackground","selectedTextColor","buttonFont","index","event","init_ButtonInputGroup"],"sources":["https:/framerusercontent.com/modules/grGdrspwPZt1GlFepHUf/eIclI7fzwPHvfNrSoovX/ButtonInputGroup.js"],"sourcesContent":["// User request: Ensure ButtonGroup submits selected values into its nearest enclosing native HTML form (email + Google Sheets) using Field Name as key and selected option value(s) as successful form control value(s), without manual wiring and without changing visuals/controls/behavior.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useCallback,useMemo,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Button Group\n * \n * A form field component that displays a group of selectable buttons.\n * \n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function ButtonGroup(props){const{options,optionsJson,multiSelect,required,layout,buttonFont,buttonRadius,buttonPadding,buttonBorderColor,buttonBackground,selectedBackground,selectedTextColor,selectedBorderColor,fieldName,name,label,style,onValueChange}=props;const[selectedValues,setSelectedValues]=useState([]);const rootRef=useRef(null);const[associatedFormId,setAssociatedFormId]=useState(\"\");const resolvedOptions=useMemo(()=>{if(!optionsJson||optionsJson.trim()===\"\")return options;try{const parsed=JSON.parse(optionsJson);const isValidArray=Array.isArray(parsed)&&parsed.every(item=>item&&typeof item===\"object\"&&typeof item.label===\"string\"&&typeof item.value===\"string\");return isValidArray?parsed:options;}catch(_error){return options;}},[optionsJson,options]);const handleButtonClick=useCallback(value=>{startTransition(()=>{if(multiSelect){setSelectedValues(prev=>prev.includes(value)?prev.filter(v=>v!==value):[...prev,value]);}else{setSelectedValues(prev=>prev.includes(value)&&prev.length===1?[]:[value]);}});},[multiSelect]);useEffect(()=>{if(onValueChange){onValueChange(multiSelect?selectedValues:selectedValues[0]||\"\");}},[selectedValues,multiSelect,onValueChange]);useEffect(()=>{if(typeof window===\"undefined\")return;const root=rootRef.current;if(!root)return;const nearestForm=root.closest(\"form\");if(!nearestForm){startTransition(()=>setAssociatedFormId(\"\"));return;}let formId=nearestForm.getAttribute(\"id\")||\"\";if(!formId){formId=`framer-form-${Math.random().toString(36).slice(2,10)}`;nearestForm.setAttribute(\"id\",formId);}startTransition(()=>setAssociatedFormId(formId));},[]);const containerStyle=useMemo(()=>{const{columns,horizontalAlign,verticalAlign,gapH,gapV,height}=layout;return{display:\"grid\",gridTemplateColumns:`repeat(${columns}, 1fr)`,gap:`${gapV}px ${gapH}px`,width:\"100%\",justifyItems:horizontalAlign,alignItems:verticalAlign,...style};},[layout,style]);const formValue=multiSelect?selectedValues.join(\",\"):selectedValues[0]||\"\";const hasSelection=selectedValues.length>0;const resolvedFieldName=fieldName||name||\"buttonGroup\";const submittedValues=multiSelect?selectedValues:selectedValues.slice(0,1);return /*#__PURE__*/_jsxs(\"div\",{ref:rootRef,style:{width:\"100%\",position:\"relative\"},children:[label&&/*#__PURE__*/_jsxs(\"label\",{style:{display:\"block\",marginBottom:\"8px\",color:\"#8A8A8A\",fontSize:\"13px\",fontWeight:500},children:[label,required&&/*#__PURE__*/_jsx(\"span\",{style:{color:\"#FF4A4A\"},children:\" *\"})]}),/*#__PURE__*/_jsx(\"div\",{style:containerStyle,children:resolvedOptions.map((option,index)=>{const isSelected=selectedValues.includes(option.value);return /*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:()=>handleButtonClick(option.value),style:{padding:`${buttonPadding}px`,borderRadius:`${buttonRadius}px`,border:`1px solid ${isSelected?selectedBorderColor:buttonBorderColor}`,background:isSelected?selectedBackground:buttonBackground,color:isSelected?selectedTextColor:\"#999999\",cursor:\"pointer\",transition:\"all 0.2s ease\",minHeight:\"36px\",minWidth:\"36px\",outline:\"none\",fontFamily:\"Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif\",fontSize:\"14px\",fontWeight:400,width:layout.height===\"fill\"?\"100%\":\"auto\",...buttonFont,\":focus\":{borderColor:\"#0099FF\"}},\"aria-pressed\":isSelected,children:option.label},index);})}),submittedValues.map((value,index)=>/*#__PURE__*/_jsx(\"input\",{type:\"hidden\",name:resolvedFieldName,value:value,form:associatedFormId||undefined,\"data-framer-name\":resolvedFieldName,\"data-framer-form-input-type\":\"button-group\"},`${resolvedFieldName}-${value}-${index}`)),/*#__PURE__*/_jsx(\"input\",{type:\"text\",value:formValue,required:required,form:associatedFormId||undefined,onChange:()=>{},onInvalid:event=>{if(required&&!hasSelection){event.currentTarget.setCustomValidity(\"Please select an option.\");}else{event.currentTarget.setCustomValidity(\"\");}},onInput:event=>{event.currentTarget.setCustomValidity(\"\");},tabIndex:-1,\"aria-hidden\":\"true\",style:{position:\"absolute\",width:\"1px\",height:\"1px\",opacity:0,pointerEvents:\"none\",border:0,padding:0,margin:0}})]});}addPropertyControls(ButtonGroup,{fieldName:{type:ControlType.String,title:\"Field Name\",defaultValue:\"buttonGroup\"},options:{type:ControlType.Array,title:\"Options\",control:{type:ControlType.Object,controls:{label:{type:ControlType.String,title:\"Label\",defaultValue:\"Option\"},value:{type:ControlType.String,title:\"Value\",defaultValue:\"\"}}},defaultValue:[{label:\"Option 1\",value:\"option1\"},{label:\"Option 2\",value:\"option2\"},{label:\"Option 3\",value:\"option3\"}]},optionsJson:{type:ControlType.String,title:\"Options JSON\",defaultValue:\"\",displayTextArea:true},multiSelect:{type:ControlType.Boolean,title:\"Multi-select\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"},required:{type:ControlType.Boolean,title:\"Required\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"},layout:{type:ControlType.Object,title:\"Layout\",controls:{columns:{type:ControlType.Number,title:\"Columns\",defaultValue:3,min:1,max:12,displayStepper:true},height:{type:ControlType.Enum,title:\"Height\",options:[\"fit\",\"fill\"],optionTitles:[\"Fit\",\"Fill\"],defaultValue:\"fit\",displaySegmentedControl:true},horizontalAlign:{type:ControlType.Enum,title:\"Align\",options:[\"start\",\"center\",\"end\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"start\",displaySegmentedControl:true},verticalAlign:{type:ControlType.Enum,title:\"Align\",options:[\"top\",\"center\",\"bottom\"],optionTitles:[\"Top\",\"Center\",\"Bottom\"],defaultValue:\"top\",displaySegmentedControl:true},gapH:{type:ControlType.Number,title:\"Gap H\",defaultValue:10,min:0,max:100,step:1},gapV:{type:ControlType.Number,title:\"Gap V\",defaultValue:10,min:0,max:100,step:1}}},buttonFont:{type:ControlType.Font,title:\"Button Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"14px\",variant:\"Regular\",lineHeight:\"1.2em\"}},buttonRadius:{type:ControlType.Number,title:\"Button Radius\",defaultValue:10,min:0,max:20,step:1,displayStepper:true},buttonPadding:{type:ControlType.Number,title:\"Button Padding\",defaultValue:10,min:0,max:30,step:1,displayStepper:true},buttonBorderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"rgba(136, 136, 136, 0.1)\"},buttonBackground:{type:ControlType.Color,title:\"Button Background\",defaultValue:\"rgba(187, 187, 187, 0.15)\"},selectedBackground:{type:ControlType.Color,title:\"Selected Background\",defaultValue:\"#0055FF\"},selectedTextColor:{type:ControlType.Color,title:\"Selected Text Color\",defaultValue:\"#FFFFFF\"},selectedBorderColor:{type:ControlType.Color,title:\"Selected Border\",defaultValue:\"#0099FF\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ButtonGroup\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ButtonInputGroup.map"],"mappings":"A,kOAQG,SAAwBoB,EAAY,EAAM,CAAC,GAAK,CAAC,UAAQ,cAAY,cAAY,WAAS,SAAO,aAAW,eAAa,gBAAc,oBAAkB,mBAAiB,qBAAmB,oBAAkB,sBAAoB,YAAU,OAAK,QAAM,QAAM,iBAAeC,EAAW,CAACC,EAAeC,GAAmBvB,EAAS,CAAC,CAAC,EAAQwB,EAAQvB,EAAO,IAAI,EAAO,CAACwB,EAAiBC,GAAqB1B,EAAS,EAAE,EAAQ2B,EAAgBzB,MAAY,CAAC,GAAG,CAAC0B,GAAaA,EAAY,KAAK,IAAI,GAAG,OAAOC,EAAQ,GAAG,CAAC,IAAMC,EAAO,KAAK,MAAMF,CAAW,EAAyJ,OAApI,MAAM,QAAQE,CAAM,GAAGA,EAAO,MAAM,GAAMC,GAAM,OAAOA,GAAO,UAAU,OAAOA,EAAK,OAAQ,UAAU,OAAOA,EAAK,OAAQ,QAAQ,EAAsBD,EAAOD,CAAQ,MAAc,CAAC,OAAOA,CAAQ,CAAC,EAAE,CAACD,EAAYC,CAAO,CAAC,EAAQG,EAAkB7B,EAAY,GAAO,CAACG,MAAoB,CAAiBiB,EAAbU,EAA+B,GAAMC,EAAK,SAASC,CAAK,EAAED,EAAK,OAAO,GAAGE,IAAID,CAAK,EAAE,CAAC,GAAGD,EAAKC,CAAK,EAA2B,GAAMD,EAAK,SAASC,CAAK,GAAGD,EAAK,SAAS,EAAE,CAAC,EAAE,CAACC,CAAK,CAAC,CAAG,CAAC,CAAE,EAAE,CAACF,CAAW,CAAC,EAAEpB,MAAc,CA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