{"version":3,"file":"Copy_Link_Button.BfSAI5df.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/s3MD0C2nthID1EAZB2ec/J0EUZPIhtmLcGWxjy1yb/Copy_Link_Button.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useRef,useEffect}from\"react\";import{ControlType,addPropertyControls}from\"framer\";export default function CopyPageURL(props){const{label,buttonWidth,buttonHeight,showIcon,icon,successText,timeout,buttonBackground,buttonColor,radius,fontSize}=props;const[copied,setCopied]=useState(false);const timeoutRef=useRef(null);useEffect(()=>{return()=>{if(timeoutRef.current){window.clearTimeout(timeoutRef.current);}};},[]);const getCurrentUrl=()=>{try{return window&&window.location?window.location.href:\"\";}catch{return\"\";}};const copyToClipboard=async()=>{const url=getCurrentUrl();if(!url)return;// Preferred modern API\ntry{if(navigator.clipboard&&navigator.clipboard.writeText){await navigator.clipboard.writeText(url);}else{// Fallback\nconst textarea=document.createElement(\"textarea\");textarea.value=url;textarea.style.position=\"fixed\";textarea.style.opacity=\"0\";document.body.appendChild(textarea);textarea.select();document.execCommand(\"copy\");document.body.removeChild(textarea);}setCopied(true);if(timeoutRef.current)window.clearTimeout(timeoutRef.current);timeoutRef.current=window.setTimeout(()=>setCopied(false),timeout);}catch{// ignore error silently in component context\nsetCopied(false);}};const containerStyle={display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",width:buttonWidth,height:buttonHeight,background:buttonBackground,color:buttonColor,borderRadius:radius,cursor:\"pointer\",userSelect:\"none\",fontSize,padding:\"0 12px\",boxSizing:\"border-box\"};const iconStyle={display:\"inline-block\",marginRight:label?8:0,width:Math.max(12,Math.min(20,fontSize)),height:Math.max(12,Math.min(20,fontSize)),lineHeight:0};return /*#__PURE__*/_jsx(\"div\",{style:{display:\"inline-block\"},onClick:copyToClipboard,role:\"button\",\"aria-label\":\"Copy page URL\",children:/*#__PURE__*/_jsxs(\"div\",{style:containerStyle,children:[showIcon&&/*#__PURE__*/_jsx(\"span\",{style:iconStyle,dangerouslySetInnerHTML:{__html:icon}}),/*#__PURE__*/_jsx(\"span\",{style:{whiteSpace:\"nowrap\",overflow:\"hidden\",textOverflow:\"ellipsis\"},children:copied?successText:label})]})});}CopyPageURL.defaultProps={label:\"Copy URL\",successText:\"Copied!\",timeout:1500,showIcon:true,// simple clipboard SVG icon by default\nicon:'<svg viewBox=\"0 0 24 24\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M16 1H6C4.9 1 4 1.9 4 3V17H6V3H16V1Z\"/><path d=\"M19 5H8C6.9 5 6 5.9 6 7V21C6 22.1 6.9 23 8 23H19C20.1 23 21 22.1 21 21V7C21 5.9 20.1 5 19 5ZM19 21H8V7H19V21Z\"/></svg>',buttonWidth:140,buttonHeight:40,buttonBackground:\"#1f2937\",buttonColor:\"#ffffff\",radius:8,fontSize:14};addPropertyControls(CopyPageURL,{label:{type:ControlType.String,title:\"Label\"},successText:{type:ControlType.String,title:\"Success Text\"},timeout:{type:ControlType.Number,title:\"Toast Timeout (ms)\",min:100,max:1e4,step:100},showIcon:{type:ControlType.Boolean,title:\"Show Icon\"},icon:{type:ControlType.String,title:\"SVG Icon (HTML)\"},buttonWidth:{type:ControlType.Number,title:\"Width\",min:40,max:600,step:1},buttonHeight:{type:ControlType.Number,title:\"Height\",min:24,max:200,step:1},buttonBackground:{type:ControlType.Color,title:\"Background\"},buttonColor:{type:ControlType.Color,title:\"Text Color\"},radius:{type:ControlType.Number,title:\"Radius\",min:0,max:100,step:1},fontSize:{type:ControlType.Number,title:\"Font Size\",min:8,max:36,step:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CopyPageURL\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Copy_Link_Button.map"],"mappings":"+MAA0J,SAAwB,EAAY,EAAM,CAAC,GAAK,CAA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