{"version":3,"file":"CopyButton3.CLLpHDNY.mjs","names":["React.useState","React.useRef","React.useEffect","_jsxs","_jsx","__esmMin","navigator","init_npm_react_18_3_1","window","_e","de","p","c","init_jsx_runtime","ce","init_ssg_sandbox_shims","init_framer_ChujFWHC","ControlType","addPropertyControls","CopyButton3","props","text","label","doneLabel","look","style","done","setDone","timer","copy","e","v","ok","ta","CSS","TICK","COPY","init_CopyButton3"],"sources":["https:/framerusercontent.com/modules/VLawTnKh64KNAPUIrEoA/DJgut6ljAuR5wYR3kijC/CopyButton3.js"],"sourcesContent":["// CopyButton3 — a 3.0 primary button (or, with Look = Icon, a small copy icon) that copies a piece of text to the clipboard.\n// It exists because copying needs JavaScript. The button looks like the 3.0 Button (Primary): 45 high, radius 10,\n// Paragraph B, Lime, Light Green on hover. After a successful copy the label reads \"Copied\" for two seconds\n// (the icon turns into a tick). The click stops here, so a link or tap handler on a parent layer cannot swallow it.\n// Look = Dark: the same button in Black with Cream text (Catarina, 8 Oct: the Try it now box on Foundations articles).\n// IF THE 3.0 BUTTON CHANGES (height, radius, type), CHANGE IT HERE TOO.\n// Self-contained: no imports from other code files.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";const CSS=`\n.vv-copy3{display:inline-flex;align-items:center;justify-content:center;gap:10px;height:45px;padding:0 20px;border:none;border-radius:10px;background:#9BD900;color:#090D02;font-family:'DM Sans',sans-serif;font-weight:700;font-size:16px;line-height:140%;letter-spacing:-0.01em;white-space:nowrap;cursor:pointer;transition:background .15s ease;box-sizing:border-box}\n.vv-copy3:hover{background:#DDFF87}\n.vv-copy3.vv-copy3d{background:#090D02;color:#F7F9F2}\n.vv-copy3.vv-copy3d:hover{background:#262B1C}\n.vv-copy3.vv-copy3d:focus-visible{outline-color:#090D02}\n.vv-copy3:focus-visible{outline:2px solid #F7F9F2;outline-offset:2px}\n.vv-copy3i{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;padding:0;margin:0;border:none;background:none;color:#F7F9F2;cursor:pointer;transition:color .15s ease}\n.vv-copy3i:hover{color:#9BD900}\n.vv-copy3i:focus-visible{outline:2px solid #F7F9F2;outline-offset:4px;border-radius:2px}\n`;const TICK=\"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z\";const COPY=\"M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n * @framerDisableUnlink\n */export default function CopyButton3(props){const{text=\"\",label=\"Copy prompt\",doneLabel=\"Copied\",look=\"Button\",style}=props;const[done,setDone]=React.useState(false);const timer=React.useRef(null);React.useEffect(()=>()=>{if(timer.current)clearTimeout(timer.current);},[]);const copy=async e=>{e.stopPropagation();// copy what the member reads: on a Portuguese page, the language engine's Portuguese for this text\nlet text=props.text||\"\";try{const v=window.__vvLang;if(v&&v.t)text=v.t(text);}catch(err){}let ok=false;try{await navigator.clipboard.writeText(text);ok=true;}catch(err){// older browsers, or a page without clipboard permission\ntry{const ta=document.createElement(\"textarea\");ta.value=text;ta.setAttribute(\"readonly\",\"\");ta.style.position=\"fixed\";ta.style.opacity=\"0\";document.body.appendChild(ta);ta.select();ok=document.execCommand(\"copy\");document.body.removeChild(ta);}catch(err2){}}if(!ok)return;setDone(true);if(timer.current)clearTimeout(timer.current);timer.current=setTimeout(()=>setDone(false),2e3);};if(look===\"Icon\"){return /*#__PURE__*/_jsxs(\"button\",{type:\"button\",className:\"vv-copy3i\",onClick:copy,\"aria-label\":done?doneLabel:label,title:done?doneLabel:label,style:style,children:[/*#__PURE__*/_jsx(\"style\",{children:CSS}),/*#__PURE__*/_jsx(\"svg\",{width:\"18\",height:\"18\",viewBox:\"0 0 256 256\",fill:\"currentColor\",\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"path\",{d:done?TICK:COPY})})]});}return /*#__PURE__*/_jsxs(\"button\",{type:\"button\",className:\"vv-copy3\"+(look===\"Dark\"?\" vv-copy3d\":\"\"),onClick:copy,style:{width:\"100%\",...style},children:[/*#__PURE__*/_jsx(\"style\",{children:CSS}),/*#__PURE__*/_jsx(\"span\",{\"aria-live\":\"polite\",children:done?doneLabel:label})]});}addPropertyControls(CopyButton3,{look:{type:ControlType.Enum,title:\"Look\",options:[\"Button\",\"Dark\",\"Icon\"],defaultValue:\"Button\"},text:{type:ControlType.String,title:\"Text to copy\",displayTextArea:true,defaultValue:\"\"},label:{type:ControlType.String,title:\"Label\",defaultValue:\"Copy prompt\"},doneLabel:{type:ControlType.String,title:\"After copying\",defaultValue:\"Copied\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CopyButton3\",\"slots\":[],\"annotations\":{\"framerDisableUnlink\":\"\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CopyButton3.map"],"mappings":"A,oNAqBG,SAAwBmB,EAAYC,EAAM,CAAC,GAAK,CAACC,OAAK,GAAGC,QAAM,cAAcC,YAAU,SAASC,OAAK,SAASC,SAAOL,EAAW,CAACM,EAAKC,GAAS3B,EAAe,EAAK,EAAQ4B,EAAM3B,EAAa,IAAI,EAAEC,UAAwB,CAAI0B,EAAM,SAAQ,aAAaA,EAAM,OAAO,CAAE,EAAE,CAAC,CAAC,EAAE,IAAMC,EAAK,KAAMC,IAAG,CAACA,EAAE,gBAAgB,EAC1T,IAAIT,EAAKD,EAAM,MAAM,GAAG,GAAG,CAAC,IAAMW,EAAEv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