{"version":3,"file":"ColorCircle.Vji_v3Mk.mjs","names":["useState","color"],"sources":["https:/framerusercontent.com/modules/SKy0K8z51QYQAjiF0hJE/t6KJFiZDAgxu8L0bV3OJ/ColorCircle.js"],"sourcesContent":["// Componente cerchio colorato che copia il codice colore nella clipboard al click\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Color Circle\n *\n * @framerIntrinsicWidth 32\n * @framerIntrinsicHeight 32\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function ColorCircle(props){const{color,showTooltip}=props;const[copied,setCopied]=useState(false);const convertToHex=color=>{// If already in hex format, return as is\nif(color.startsWith(\"#\")){return color.toUpperCase();}// Create a temporary element to convert color to rgb\nif(typeof document!==\"undefined\"){const temp=document.createElement(\"div\");temp.style.color=color;document.body.appendChild(temp);const computedColor=window.getComputedStyle(temp).color;document.body.removeChild(temp);// Parse rgb/rgba\nconst match=computedColor.match(/\\d+/g);if(match){const r=parseInt(match[0]);const g=parseInt(match[1]);const b=parseInt(match[2]);return\"#\"+[r,g,b].map(x=>{const hex=x.toString(16);return hex.length===1?\"0\"+hex:hex;}).join(\"\").toUpperCase();}}return color;};const handleClick=async()=>{if(typeof window!==\"undefined\"&&navigator.clipboard){try{const hexColor=convertToHex(color);await navigator.clipboard.writeText(hexColor);startTransition(()=>setCopied(true));setTimeout(()=>{startTransition(()=>setCopied(false));},2e3);}catch(err){console.error(\"Failed to copy color:\",err);}}};return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:[/*#__PURE__*/_jsx(\"div\",{onClick:handleClick,style:{width:\"100%\",height:\"100%\",borderRadius:\"50%\",backgroundColor:color,cursor:\"pointer\",transition:\"transform 0.2s ease, box-shadow 0.2s ease\",boxShadow:\"0 2px 8px rgba(0, 0, 0, 0.1)\"},onMouseEnter:e=>{e.currentTarget.style.transform=\"scale(1.2)\";e.currentTarget.style.boxShadow=\"0 4px 12px rgba(0, 0, 0, 0.15)\";},onMouseLeave:e=>{e.currentTarget.style.transform=\"scale(1)\";e.currentTarget.style.boxShadow=\"0 2px 8px rgba(0, 0, 0, 0.1)\";},role:\"button\",tabIndex:0,\"aria-label\":`Copy color ${color}`,onKeyDown:e=>{if(e.key===\"Enter\"||e.key===\" \"){handleClick();}}}),showTooltip&&copied&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",bottom:\"-40px\",left:\"50%\",transform:\"translateX(-50%)\",backgroundColor:\"rgba(0, 0, 0, 0.8)\",color:\"#FFFFFF\",padding:\"8px 12px\",borderRadius:\"6px\",fontSize:\"14px\",fontWeight:500,whiteSpace:\"nowrap\",pointerEvents:\"none\",zIndex:2},children:\"Copied!\"})]});}addPropertyControls(ColorCircle,{color:{type:ControlType.Color,title:\"Colore\",defaultValue:\"#0099FF\"},showTooltip:{type:ControlType.Boolean,title:\"Mostra Tooltip\",defaultValue:true,enabledTitle:\"S\\xec\",disabledTitle:\"No\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ColorCircle\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"32\",\"framerIntrinsicWidth\":\"32\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ColorCircle.map"],"mappings":"6MASG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,QAAM,eAAa,EAAW,CAAC,EAAO,GAAWA,EAAS,GAAM,CAAO,EAAa,GAAO,CAC/I,GAAGC,EAAM,WAAW,IAAI,CAAE,OAAOA,EAAM,aAAa,CACpD,GAAG,OAAO,SAAW,IAAY,CAAC,IAAM,EAAK,SAAS,cAAc,MAAM,CAAC,EAAK,MAAM,MAA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