{"version":3,"file":"CopyButton3.C5jPXf1b.mjs","names":["React.useState","React.useRef","__esmMin","navigator","init_npm_react_18_3_1","window","_e","de","p","c","init_jsx_runtime","ce","init_ssg_sandbox_shims","init_framer_Bf4_tcb2","ControlType","addPropertyControls","CopyButton3","props","done","setDone","timer","copy","e","text","v","ok","ta","look","doneLabel","label","CSS","TICK","COPY","style","init_CopyButton3"],"sources":["https:/framerusercontent.com/modules/VLawTnKh64KNAPUIrEoA/T7pQBIi0ZNAHWFhxbgQL/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:#0E1300;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:#DAF694}\n.vv-copy3.vv-copy3d{background:#0E1300;color:#F7F9F2}\n.vv-copy3.vv-copy3d:hover{background:#262B1C}\n.vv-copy3.vv-copy3d:focus-visible{outline-color:#0E1300}\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\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CopyButton3.map"],"mappings":"A,oNAqBG,SAAwBgB,EAAY,EAAM,CAAC,GAAK,CAAC,OAAK,GAAG,QAAM,cAAc,YAAU,SAAS,OAAK,SAAS,SAAOC,EAAW,CAACC,EAAKC,GAASnB,EAAe,EAAK,EAAQoB,EAAMnB,EAAa,IAAI,EAAEU,UAAwB,CAAIS,EAAM,SAAQ,aAAaA,EAAM,OAAO,CAAE,EAAE,CAAC,CAAC,EAAE,IAAMC,EAAK,KAAM,IAAG,CAACC,EAAE,gBAAgB,EAC1T,IAAIC,EAAKN,EAAM,MAAM,GAAG,GAAG,CAAC,IAAMO,EAAEnB,EAAO,SAAYmB,GAAG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