{"version":3,"file":"Copy.DLXJHPX9.mjs","names":["React"],"sources":["https:/framerusercontent.com/modules/qDcN0c4xKbUkQ0RMkY0i/NvDthbDy6ZhVfuxOcQZJ/Copy.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import React from\"react\";import{addPropertyControls,ControlType}from\"framer\";// ✅ Inject keyframes ONCE outside the component — never blocks main thread on re-render\nconst STYLE_ID=\"copy-btn-styles\";if(typeof document!==\"undefined\"&&!document.getElementById(STYLE_ID)){const style=document.createElement(\"style\");style.id=STYLE_ID;style.textContent=`\n        @keyframes copyFadeIn {\n            from { opacity: 0; transform: translateY(-50%) translateX(-5px); }\n            to   { opacity: 1; transform: translateY(-50%) translateX(0); }\n        }\n    `;document.head.appendChild(style);}// ✅ Static style objects defined outside component — no recreation on each render\nconst styles={wrapper:{position:\"relative\",display:\"inline-block\"},button:{cursor:\"pointer\",border:\"none\",background:\"none\",padding:\"4px\",display:\"flex\",alignItems:\"center\",transition:\"opacity 0.2s\"},icon:{width:\"20px\",height:\"20px\"},tooltip:{position:\"absolute\",left:\"100%\",top:\"50%\",transform:\"translateY(-50%)\",marginLeft:\"10px\",background:\"#333\",color:\"white\",padding:\"4px 8px\",borderRadius:\"4px\",fontSize:\"12px\",whiteSpace:\"nowrap\",animation:\"copyFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1)\"}};// ✅ Transition string as a constant — not recreated each render\nconst TRANSITION=\"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)\";const OPACITY_TRANSITION=\"opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1)\";export default function CopyButton({textToCopy=\"\",iconColor=\"#000000\",customIcon=null}){const[copied,setCopied]=React.useState(false);const timerRef=React.useRef(null);// ✅ useCallback prevents function recreation on every render\nconst handleCopy=React.useCallback(()=>{navigator.clipboard.writeText(textToCopy).then(()=>{setCopied(true);// ✅ Clear previous timer before setting a new one\nclearTimeout(timerRef.current);timerRef.current=setTimeout(()=>setCopied(false),2e3);}).catch(err=>console.error(\"Failed to copy:\",err));},[textToCopy]);// ✅ Cleanup timer on unmount — prevents setState on unmounted component\nReact.useEffect(()=>{return()=>clearTimeout(timerRef.current);},[]);return /*#__PURE__*/_jsxs(\"div\",{style:styles.wrapper,children:[/*#__PURE__*/_jsx(\"button\",{onClick:handleCopy,style:styles.button,title:\"Copy to clipboard\",children:customIcon?/*#__PURE__*/_jsx(\"img\",{src:customIcon,alt:\"Copy icon\",style:styles.icon}):/*#__PURE__*/_jsxs(\"svg\",{width:\"20\",height:\"20\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:iconColor,strokeWidth:\"1.6\",strokeLinecap:\"round\",strokeLinejoin:\"round\",style:{overflow:\"visible\"},children:[/*#__PURE__*/_jsx(\"path\",{d:\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\",style:{transition:OPACITY_TRANSITION,opacity:copied?0:1}}),/*#__PURE__*/_jsx(\"rect\",{x:copied?\"6\":\"9\",y:copied?\"6\":\"9\",width:\"13\",height:\"13\",rx:\"2\",ry:\"2\",style:{transition:TRANSITION}}),/*#__PURE__*/_jsx(\"polyline\",{points:\"9 12.5 11.5 15 16 10.5\",style:{transition:TRANSITION,opacity:copied?1:0,transform:copied?\"scale(1)\":\"scale(0.5)\",transformOrigin:\"center\"}})]})}),copied&&/*#__PURE__*/_jsx(\"span\",{style:styles.tooltip,children:\"Copied!\"})]});}addPropertyControls(CopyButton,{textToCopy:{type:ControlType.String,title:\"Text to Copy\",defaultValue:\"\"},iconColor:{type:ControlType.Color,title:\"Icon Color\",defaultValue:\"#000000\"},customIcon:{type:ControlType.Image,title:\"Custom Icon\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CopyButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Copy.map"],"mappings":"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