{"version":3,"file":"CopyShare.CPKv3uQB.mjs","names":["useState","__esmMin","navigator","init_npm_react_18_3_1","window","_e","p","init_ssg_sandbox_shims","init_framer_DymZktPS","ControlType","addPropertyControls","CopyShare","props","copied","setCopied","hover","setHover","pageUrl","link","line","text","full","u","lead","leadIn","onCopy","t","onShare","button","key","hoverColor","color","label","copiedLabel","copyLabel","shareLabel","init_CopyShare","init_jsx_runtime"],"sources":["https:/framerusercontent.com/modules/OYhFPv9p5Lh6s0KjdF2l/POM009Uj1LAyeoOxmXxD/CopyShare.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Copy the line / Share: two buttons in the site's outlined blue style.\n * Copy puts the line plus this page's own address on the clipboard. Share opens\n * the device's share sheet with the line and the address as the link; without\n * one, it opens an email with both. The address is read from the page at\n * runtime (origin + path, no query), so it is right on any domain and for\n * every CMS page, and nothing is stored in the copy.\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function CopyShare(props){const{text,leadIn,copyLabel,copiedLabel,shareLabel,color,hoverColor,link}=props;const[copied,setCopied]=useState(false);const[hover,setHover]=useState(\"\");// A fixed address (e.g. \"https://richardrussell.co/coaching/me\") wins over this page's own.\nconst pageUrl=()=>link?link:typeof window!==\"undefined\"?window.location.origin+window.location.pathname:\"\";// The line without any address someone may have typed at the end\nconst line=()=>String(text||\"\").replace(/\\s*https?:\\/\\/\\S+\\s*$/,\"\");const full=()=>{const u=pageUrl();const lead=leadIn?\" \"+leadIn:\"\";return u?line()+lead+\" \"+u:line();};const onCopy=async()=>{try{await navigator.clipboard.writeText(full());}catch(e){const t=document.createElement(\"textarea\");t.value=full();document.body.appendChild(t);t.select();document.execCommand(\"copy\");document.body.removeChild(t);}setCopied(true);setTimeout(()=>setCopied(false),1600);};const onShare=async()=>{if(navigator.share){try{await navigator.share({text:line()+(leadIn?\" \"+leadIn:\"\"),url:pageUrl()});return;}catch(e){return;}}window.location.href=\"mailto:?body=\"+encodeURIComponent(full());};const button=(key,label,onClick)=>/*#__PURE__*/_jsx(\"button\",{onClick:onClick,onMouseEnter:()=>setHover(key),onMouseLeave:()=>setHover(\"\"),style:{appearance:\"none\",background:\"transparent\",border:`1px solid ${hover===key?hoverColor:color}`,color:hover===key?hoverColor:color,borderRadius:8,padding:\"11px 20px\",font:'500 14px/1 \"Inter\", \"Inter Placeholder\", sans-serif',cursor:\"pointer\",whiteSpace:\"nowrap\"},children:label},key);return /*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",gap:12,flexWrap:\"wrap\"},children:[button(\"copy\",copied?copiedLabel:copyLabel,onCopy),button(\"share\",shareLabel,onShare)]});}CopyShare.defaultProps={text:\"Richard gets a founder's leadership team onto one strategy, clear goals and a weekly rhythm that works without the founder, then coaches the leaders who step up.\",copyLabel:\"Copy the line\",copiedLabel:\"Copied\",shareLabel:\"Share\",leadIn:\"Here's the page:\",color:\"#1A64F0\",hoverColor:\"#1450C4\"};addPropertyControls(CopyShare,{text:{type:ControlType.String,title:\"Text\",displayTextArea:true},copyLabel:{type:ControlType.String,title:\"Copy label\"},copiedLabel:{type:ControlType.String,title:\"Copied label\"},shareLabel:{type:ControlType.String,title:\"Share label\"},leadIn:{type:ControlType.String,title:\"Lead-in\"},color:{type:ControlType.Color,title:\"Colour\"},hoverColor:{type:ControlType.Color,title:\"Hover colour\"},link:{type:ControlType.String,title:\"Fixed address\",placeholder:\"This page\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CopyShare\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CopyShare.map"],"mappings":"A,4LAUG,SAAwBW,EAAU,EAAM,CAAC,GAAK,CAAC,OAAK,SAAO,YA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