{"version":3,"file":"EditorialFormField.CCfPyX38.mjs","names":["React.useMemo","React.useState","React.useCallback"],"sources":["https:/framerusercontent.com/modules/2rn7qrgbB55l7srMk7Sf/DlcEqQgiqiMaiVd0GWkM/EditorialFormField.js"],"sourcesContent":["// User request: Create a Framer code component file `EditorialFormField.tsx` for use inside existing native Framer forms as individual fields, with semantic native controls (select, checkbox group, textarea), React-controlled values for normal HTML form submission, Wise Travel Community styling, Framer-editable props, and no submit handling.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function EditorialFormField(props){const{fieldType,label,name,placeholder,options,maxSelections,helperText,backgroundColor,textColor,accentColor,borderColor,labelFont,controlFont,helperFont,style}=props;const helperTextValue=React.useMemo(()=>{if(typeof helperText!==\"string\")return\"\";return helperText.trim();},[helperText]);const parsedOptions=React.useMemo(()=>{return options.split(\"\\n\").map(item=>item.trim()).filter(Boolean);},[options]);const[selectValue,setSelectValue]=React.useState(\"\");const[textareaValue,setTextareaValue]=React.useState(\"\");const[checkboxValues,setCheckboxValues]=React.useState([]);const atSelectionCap=checkboxValues.length>=maxSelections;const handleSelectChange=React.useCallback(event=>{const nextValue=event.target.value;setSelectValue(nextValue);},[]);const handleTextareaChange=React.useCallback(event=>{const nextValue=event.target.value;setTextareaValue(nextValue);},[]);const toggleCheckbox=React.useCallback(value=>{setCheckboxValues(prev=>{if(prev.includes(value))return prev.filter(item=>item!==value);if(prev.length>=maxSelections)return prev;return[...prev,value];});},[maxSelections]);const fieldId=React.useMemo(()=>`editorial-field-${name||\"field\"}`,[name]);const baseInputStyle={width:\"100%\",minHeight:46,border:`1px solid ${borderColor}`,borderRadius:2,backgroundColor,color:textColor,padding:\"12px 14px\",boxSizing:\"border-box\",outlineColor:accentColor,fontFamily:controlFont.fontFamily,fontSize:controlFont.fontSize,lineHeight:controlFont.lineHeight,letterSpacing:controlFont.letterSpacing,fontWeight:controlFont.fontWeight,fontStyle:controlFont.fontStyle,textAlign:controlFont.textAlign};return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\",minWidth:0,display:\"flex\",flexDirection:\"column\",gap:10,color:textColor,fontFamily:\"Inter, sans-serif\",...style},children:[/*#__PURE__*/_jsx(\"label\",{htmlFor:fieldType===\"checkboxGroup\"?undefined:fieldId,style:{margin:0,color:textColor,fontFamily:labelFont.fontFamily,fontSize:labelFont.fontSize,lineHeight:labelFont.lineHeight,letterSpacing:labelFont.letterSpacing,fontWeight:labelFont.fontWeight,fontStyle:labelFont.fontStyle,textAlign:labelFont.textAlign},children:label}),fieldType===\"select\"&&/*#__PURE__*/_jsxs(\"select\",{id:fieldId,name:name,value:selectValue,onChange:handleSelectChange,\"aria-label\":label,style:baseInputStyle,children:[/*#__PURE__*/_jsx(\"option\",{value:\"\",disabled:true,children:placeholder}),parsedOptions.map((option,index)=>/*#__PURE__*/_jsx(\"option\",{value:option,children:option},`${option}-${index}`))]}),fieldType===\"textarea\"&&/*#__PURE__*/_jsx(\"textarea\",{id:fieldId,name:name,value:textareaValue,onChange:handleTextareaChange,placeholder:placeholder,\"aria-label\":label,rows:5,style:{...baseInputStyle,resize:\"vertical\",minHeight:140}}),fieldType===\"checkboxGroup\"&&/*#__PURE__*/_jsxs(\"fieldset\",{style:{margin:0,padding:0,border:\"none\",display:\"flex\",flexDirection:\"column\",gap:12},children:[/*#__PURE__*/_jsx(\"legend\",{style:{position:\"absolute\",width:1,height:1,padding:0,margin:-1,overflow:\"hidden\",clip:\"rect(0, 0, 0, 0)\",whiteSpace:\"nowrap\",border:0},children:label}),parsedOptions.map((option,index)=>{const checked=checkboxValues.includes(option);const disabled=!checked&&atSelectionCap;const checkboxId=`${fieldId}-option-${index}`;return /*#__PURE__*/_jsxs(\"label\",{htmlFor:checkboxId,style:{display:\"flex\",alignItems:\"center\",gap:10,cursor:disabled?\"not-allowed\":\"pointer\",opacity:disabled?.55:1,color:textColor,fontFamily:controlFont.fontFamily,fontSize:controlFont.fontSize,lineHeight:controlFont.lineHeight,letterSpacing:controlFont.letterSpacing,fontWeight:controlFont.fontWeight,fontStyle:controlFont.fontStyle},children:[/*#__PURE__*/_jsx(\"input\",{id:checkboxId,type:\"checkbox\",name:name,value:option,checked:checked,disabled:disabled,onChange:()=>toggleCheckbox(option),style:{accentColor,width:16,height:16,margin:0,flexShrink:0}}),/*#__PURE__*/_jsx(\"span\",{children:option})]},checkboxId);})]}),helperTextValue?/*#__PURE__*/_jsxs(\"p\",{style:{margin:0,color:fieldType===\"checkboxGroup\"&&atSelectionCap?accentColor:textColor,opacity:fieldType===\"checkboxGroup\"&&atSelectionCap?1:.8,fontFamily:helperFont.fontFamily,fontSize:helperFont.fontSize,lineHeight:helperFont.lineHeight,letterSpacing:helperFont.letterSpacing,fontWeight:helperFont.fontWeight,fontStyle:helperFont.fontStyle,textAlign:helperFont.textAlign},children:[helperTextValue,fieldType===\"checkboxGroup\"?` (${checkboxValues.length}/${maxSelections})`:\"\"]}):null]});}addPropertyControls(EditorialFormField,{fieldType:{type:ControlType.Enum,title:\"Field Type\",defaultValue:\"select\",options:[\"select\",\"checkboxGroup\",\"textarea\"],optionTitles:[\"Select\",\"Checkbox Group\",\"Textarea\"]},label:{type:ControlType.String,title:\"Label\",defaultValue:\"Travel Preference\"},name:{type:ControlType.String,title:\"Name\",defaultValue:\"travelPreference\"},placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Choose an option\"},options:{type:ControlType.String,title:\"Options\",defaultValue:\"Adventure\\nCulture\\nWellness\",displayTextArea:true},maxSelections:{type:ControlType.Number,title:\"Max Select\",defaultValue:3,min:1,max:12,step:1,hidden:props=>props.fieldType!==\"checkboxGroup\"},helperText:{type:ControlType.String,title:\"Helper\",defaultValue:\"\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#F7F5F2\"},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#171717\"},accentColor:{type:ControlType.Color,title:\"Accent\",defaultValue:\"#5A1E2D\"},borderColor:{type:ControlType.Color,title:\"Border\",defaultValue:\"#C7C7C7\"},labelFont:{type:ControlType.Font,title:\"Label Font\",defaultFontType:\"sans-serif\",controls:\"extended\",defaultValue:{fontSize:\"14px\",variant:\"Medium\",lineHeight:\"1.3em\",letterSpacing:\"0em\"}},controlFont:{type:ControlType.Font,title:\"Control Font\",defaultFontType:\"sans-serif\",controls:\"extended\",defaultValue:{fontSize:\"15px\",variant:\"Regular\",lineHeight:\"1.35em\",letterSpacing:\"0em\"}},helperFont:{type:ControlType.Font,title:\"Helper Font\",defaultFontType:\"sans-serif\",controls:\"extended\",defaultValue:{fontSize:\"13px\",variant:\"Regular\",lineHeight:\"1.35em\",letterSpacing:\"0em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"EditorialFormField\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./EditorialFormField.map"],"mappings":"qLAIG,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAAC,YAAU,QAAM,OAAK,cAAY,UAAQ,gBAAc,aAAW,kBAAgB,YAAU,cAAY,cAAY,YAAU,cAAY,aAAW,SAAO,EAAY,EAAgBA,MAAsB,OAAO,GAAa,SAAyB,EAAW,KAAK,EAA1B,GAA8B,CAAC,CAAU,CAAC,EAAQ,EAAcA,MAA0B,EAAQ,MAAM;CAAI,CAAC,CAAC,IAAI,GAAM,EAAK,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO,EAAI,CAAC,CAAO,CAAC,EAAO,CAAC,EAAY,GAAgBC,EAAe,EAAE,EAAO,CAAC,EAAc,GAAkBA,EAAe,EAAE,EAAO,CAAC,EAAe,GAAmBA,EAAe,C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