{"version":3,"file":"TagInput.D2_XiYRc.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/QSNKggqrGuTGRe9QbsBD/KlZiiIcfwYgfTmpO6Aak/TagInput.js"],"sourcesContent":["// TagInput (Pill Tag) component for Framer Desktop\n// Features: 3 pill tags, ognuno editabile, colori personalizzabili, shadow opzionale, responsive wrapping, accessibilità, props per testo/colore, senza maxTags, senza CMS\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useRef,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * TagInput\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function TagInput(props){const{tag1,tag2,tag3,tag1Background,tag2Background,tag3Background,tag1TextColor,tag2TextColor,tag3TextColor,showTags=true,showTag1=true,showTag2=true,showTag3=true,style,onTagChange}=props;const[tags,setTags]=useState([{label:tag1,backgroundColor:tag1Background,textColor:tag1TextColor,show:showTag1},{label:tag2,backgroundColor:tag2Background,textColor:tag2TextColor,show:showTag2},{label:tag3,backgroundColor:tag3Background,textColor:tag3TextColor,show:showTag3}]);const[editIndex,setEditIndex]=useState(-1);const[editValue,setEditValue]=useState(\"\");const inputRef=useRef(null);useEffect(()=>{setTags([{label:tag1,backgroundColor:tag1Background,textColor:tag1TextColor,show:showTag1},{label:tag2,backgroundColor:tag2Background,textColor:tag2TextColor,show:showTag2},{label:tag3,backgroundColor:tag3Background,textColor:tag3TextColor,show:showTag3}]);},[tag1,tag2,tag3,tag1Background,tag2Background,tag3Background,tag1TextColor,tag2TextColor,tag3TextColor,showTag1,showTag2,showTag3]);useEffect(()=>{if(typeof onTagChange===\"function\")onTagChange(tags);// eslint-disable-next-line\n},[JSON.stringify(tags)]);useEffect(()=>{if(editIndex!==-1&&inputRef.current){inputRef.current.focus();}},[editIndex]);function handleEdit(idx){setEditIndex(idx);setEditValue(tags[idx].label);}function handleEditChange(e){setEditValue(e.target.value);}function handleEditSubmit(idx){if(!editValue.trim())return;const newTags=tags.slice();newTags[idx].label=editValue.trim();startTransition(()=>{setTags(newTags);setEditIndex(-1);setEditValue(\"\");});}function handleEditKeyDown(e,idx){if(e.key===\"Enter\"){handleEditSubmit(idx);}else if(e.key===\"Escape\"){setEditIndex(-1);setEditValue(\"\");}}if(!showTags)return null;return /*#__PURE__*/_jsx(\"div\",{style:{...style,width:style?.width||\"100%\",minHeight:48,display:\"flex\",flexWrap:\"wrap\",gap:12,alignItems:\"center\",background:\"transparent\",padding:0,boxSizing:\"border-box\"},role:\"list\",\"aria-label\":\"Tag list\",children:tags.map((tag,idx)=>{if(!tag.show)return null;const isEditing=editIndex===idx;return /*#__PURE__*/_jsx(\"div\",{tabIndex:0,\"aria-label\":tag.label,role:\"listitem\",style:{display:\"flex\",alignItems:\"center\",background:tag.backgroundColor||\"#fff\",color:tag.textColor||\"#222\",borderRadius:999,padding:\"8px 20px\",fontSize:16,fontWeight:500,boxShadow:\"0 2px 12px rgba(0,0,0,0.10)\",minWidth:48,maxWidth:240,whiteSpace:\"nowrap\",overflow:\"hidden\",textOverflow:\"ellipsis\",margin:0,transition:\"box-shadow 0.2s\",userSelect:\"none\",outline:isEditing?\"2px solid #1976d2\":\"none\"},onDoubleClick:()=>handleEdit(idx),onKeyDown:e=>{if(e.key===\"Enter\")handleEdit(idx);},children:tag.label},idx);})});}addPropertyControls(TagInput,{tag1:{type:ControlType.String,title:\"Tag 1\",defaultValue:\"Ultimi posti disponibili\",setVariable:true},tag1Background:{type:ControlType.Color,title:\"Tag 1 BG\",defaultValue:\"#fff\"},tag1TextColor:{type:ControlType.Color,title:\"Tag 1 Text\",defaultValue:\"#1a237e\"},tag2:{type:ControlType.String,title:\"Tag 2\",defaultValue:\"Aperti a tutti\",setVariable:true},tag2Background:{type:ControlType.Color,title:\"Tag 2 BG\",defaultValue:\"#e3f2fd\"},tag2TextColor:{type:ControlType.Color,title:\"Tag 2 Text\",defaultValue:\"#1565c0\"},tag3:{type:ControlType.String,title:\"Tag 3\",defaultValue:\"Gratuito\",setVariable:true},tag3Background:{type:ControlType.Color,title:\"Tag 3 BG\",defaultValue:\"#c8e6c9\"},tag3TextColor:{type:ControlType.Color,title:\"Tag 3 Text\",defaultValue:\"#256029\"},showTags:{type:ControlType.Boolean,title:\"Mostra Tutti i Tag\",defaultValue:true,enabledTitle:\"Mostra\",disabledTitle:\"Nascondi\"},showTag1:{type:ControlType.Boolean,title:\"Mostra Tag 1\",defaultValue:true,enabledTitle:\"Mostra\",disabledTitle:\"Nascondi\"},showTag2:{type:ControlType.Boolean,title:\"Mostra Tag 2\",defaultValue:true,enabledTitle:\"Mostra\",disabledTitle:\"Nascondi\"},showTag3:{type:ControlType.Boolean,title:\"Mostra Tag 3\",defaultValue:true,enabledTitle:\"Mostra\",disabledTitle:\"Nascondi\"},onTagChange:{type:ControlType.EventHandler,title:\"On Tag Change\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TagInput\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TagInput.map"],"mappings":"yLAOG,SAAwB,EAAS,EAAM,CAAC,GAAK,CAAC,OAAK,OAAK,OAAK,iBAAe,iBAAe,iBAAe,gBAAc,gBAAc,gBAAc,WAAS,GAAK,WAAS,GAAK,WAAS,GAAK,WAAS,GAAK,QAAM,eAAa,EAAW,CAAC,EAAK,GAASA,EAAS,CAAC,CAAC,MAAM,EAAK,gBAAgB,EAAe,UAAU,EAAc,KAAK,CAAQ,EAAE,CAAC,MAAM,EAAK,gBAAgB,EAAe,UAAU,EAAc,KAAK,CAAQ,EAAE,CAAC,MAAM,EAAK,gBAAgB,EAAe,UAAU,EAAc,KAAK,CAAQ,CAAC,CAAC,EAAO,CAAC,EAAU,GAAcA,EAAS,EAAE,EAAO,CAAC,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