{"version":3,"file":"MultiCheckboxSelect.BOegGxfe.mjs","names":["useState","useRef","useMemo","useCallback"],"sources":["https:/framerusercontent.com/modules/vAlZCV6v0S19AWPijHZd/IRpLMAbej8UxvFTXYSQ4/MultiCheckboxSelect.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useCallback,useEffect,useMemo,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function MultiCheckboxSelect(props){const{fieldName,placeholder,required,options,fontFamily=\"DM Sans\",accentColor,borderColor,textColor,placeholderColor,backgroundColor,dropdownBackground,radius,fontSize,fieldHeight,maxDropdownHeight,style}=props;const[open,setOpen]=useState(false);const[selectedValues,setSelectedValues]=useState([]);const rootRef=useRef(null);const selectedText=useMemo(()=>selectedValues.join(\", \"),[selectedValues]);const toggleDropdown=useCallback(()=>{startTransition(()=>setOpen(prev=>!prev));},[]);const toggleValue=useCallback(value=>{startTransition(()=>{setSelectedValues(prev=>prev.includes(value)?prev.filter(item=>item!==value):[...prev,value]);});},[]);useEffect(()=>{if(typeof window===\"undefined\"||typeof document===\"undefined\")return;const handlePointerDown=event=>{const target=event.target;if(rootRef.current&&!rootRef.current.contains(target)){startTransition(()=>setOpen(false));}};const handleEscape=event=>{if(event.key===\"Escape\"){startTransition(()=>setOpen(false));}};document.addEventListener(\"mousedown\",handlePointerDown);document.addEventListener(\"keydown\",handleEscape);return()=>{document.removeEventListener(\"mousedown\",handlePointerDown);document.removeEventListener(\"keydown\",handleEscape);};},[]);return /*#__PURE__*/_jsxs(\"div\",{ref:rootRef,style:{position:\"relative\",width:\"100%\",...style},children:[/*#__PURE__*/_jsxs(\"button\",{type:\"button\",onClick:toggleDropdown,\"aria-expanded\":open,\"aria-haspopup\":\"listbox\",\"aria-required\":required,style:{width:\"100%\",height:fieldHeight,minHeight:fieldHeight,border:`1px solid ${borderColor}`,borderRadius:radius,background:backgroundColor,color:selectedValues.length>0?textColor:placeholderColor,fontSize,fontFamily,lineHeight:1.2,textAlign:\"left\",padding:\"0 14px\",display:\"flex\",alignItems:\"center\",justifyContent:\"space-between\",gap:10,cursor:\"pointer\",outlineColor:accentColor},children:[/*#__PURE__*/_jsx(\"span\",{style:{whiteSpace:\"nowrap\",overflow:\"hidden\",textOverflow:\"ellipsis\"},children:selectedValues.length>0?selectedText:placeholder}),/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":true,style:{color:textColor,flex:\"0 0 auto\",fontSize:fontSize-1,fontFamily:\"inherit\"},children:open?\"▲\":\"▼\"})]}),open&&/*#__PURE__*/_jsx(\"div\",{role:\"listbox\",\"aria-multiselectable\":\"true\",style:{position:\"absolute\",top:fieldHeight+6,left:0,right:0,zIndex:20,border:`1px solid ${borderColor}`,borderRadius:radius,background:dropdownBackground,boxShadow:\"0 8px 24px rgba(0,0,0,0.08)\",maxHeight:maxDropdownHeight,overflowY:\"auto\",padding:6,fontFamily},children:options.map((option,index)=>{const checked=selectedValues.includes(option);return /*#__PURE__*/_jsxs(\"label\",{style:{display:\"flex\",alignItems:\"center\",gap:10,padding:\"8px 10px\",borderRadius:Math.max(4,radius-2),cursor:\"pointer\",color:textColor,fontSize,fontFamily,userSelect:\"none\"},children:[/*#__PURE__*/_jsx(\"input\",{type:\"checkbox\",checked:checked,onChange:()=>toggleValue(option),name:`${fieldName}__ui`,value:option,style:{accentColor,width:14,height:14,margin:0,cursor:\"pointer\",flex:\"0 0 auto\"}}),/*#__PURE__*/_jsx(\"span\",{style:{fontFamily:\"inherit\"},children:option})]},`${option}-${index}`);})}),selectedValues.map(value=>/*#__PURE__*/_jsx(\"input\",{type:\"hidden\",name:fieldName,value:value},value)),/*#__PURE__*/_jsx(\"input\",{value:selectedValues.join(\",\"),readOnly:true,required:required,tabIndex:-1,\"aria-hidden\":\"true\",style:{position:\"absolute\",width:1,height:1,opacity:0,pointerEvents:\"none\"}})]});}addPropertyControls(MultiCheckboxSelect,{fieldName:{type:ControlType.String,title:\"Field Name\",defaultValue:\"insuranceTypes\"},placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Select insurance type(s)\"},required:{type:ControlType.Boolean,title:\"Required\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"},options:{type:ControlType.Array,title:\"Options\",control:{type:ControlType.String},defaultValue:[\"Home Insurance\",\"Auto Insurance\",\"Umbrella Insurance\",\"Landlord Insurance\",\"Vacation Home Insurance\",\"Renter Insurance\",\"Motorcycle Insurance\",\"RV Insurance\",\"Boat Insurance\",\"BOP Insurance\",\"Commercial Auto\",\"General Liability\",\"Workers Comp\",\"Commercial Property\",\"Professional Liability\",\"HOA Homeowners Assoc.\",\"Term Life\",\"Whole Life\",\"Final Expense\",\"Legacy Giving\"]},fontFamily:{type:ControlType.String,title:\"Font Family\",defaultValue:\"DM Sans\",placeholder:\"DM Sans\"},accentColor:{type:ControlType.Color,title:\"Accent\",defaultValue:\"#CC0000\"},borderColor:{type:ControlType.Color,title:\"Border\",defaultValue:\"#EEEEEE\"},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#000000\"},placeholderColor:{type:ControlType.Color,title:\"Placeholder\",defaultValue:\"#CCCCCC\"},backgroundColor:{type:ControlType.Color,title:\"Field BG\",defaultValue:\"#FFFFFF\"},dropdownBackground:{type:ControlType.Color,title:\"Dropdown BG\",defaultValue:\"#FFFFFF\"},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:6,min:0,max:24,step:1},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:13,min:10,max:24,step:1},fieldHeight:{type:ControlType.Number,title:\"Field Height\",defaultValue:45,min:32,max:80,step:1},maxDropdownHeight:{type:ControlType.Number,title:\"Max List H\",defaultValue:260,min:120,max:600,step:10}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"MultiCheckboxSelect\",\"slots\":[],\"annotations\":{\"framerSupportedLayo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