{"version":3,"file":"CopyEmail.CEXuLj34.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/shrY5IXJZ5anbuYEVXeO/kixsEVSguLSZJ6Vf8Yyr/CopyEmail.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType,RenderTarget,useIsStaticRenderer}from\"framer\";// Plan & Section — a large email address that copies itself on click.\n// The click never opens the mail app when the copy works; if the clipboard is blocked,\n// it falls back to the mailto: link.\n/**\n * @framerSupportedLayoutWidth any-prefer-auto\n * @framerSupportedLayoutHeight auto\n */export default function CopyEmail(props){const{email,copiedText,hint,color,hoverColor,hintColor,dotColor,align,size,tracking,family,weight,hintFamily,style}=props;const px=Number(size)||96;const isStatic=useIsStaticRenderer();const live=!isStatic&&RenderTarget.current()!==RenderTarget.canvas;const[copied,setCopied]=useState(false);const timer=useRef();useEffect(()=>()=>clearTimeout(timer.current),[]);const fam=(name,fallback)=>name?`\"${String(name).replace(/\"/g,\"\")}\", ${fallback}`:fallback;const mailto=`mailto:${email}`;const onClick=e=>{if(!live)return;// Decide synchronously: the browser follows the href before any await resolves.\ne.preventDefault();const done=()=>{setCopied(true);clearTimeout(timer.current);timer.current=setTimeout(()=>setCopied(false),2e3);};const fallback=()=>{window.location.href=mailto;};try{if(!navigator.clipboard?.writeText)return fallback();navigator.clipboard.writeText(email).then(done,fallback);}catch{fallback();}};const cls=\"ps-ce\";return /*#__PURE__*/_jsxs(\"div\",{style:{...style,display:\"flex\",flexDirection:\"column\",alignItems:align===\"center\"?\"center\":\"flex-start\",gap:4,containerType:\"inline-size\",width:\"100%\"},children:[/*#__PURE__*/_jsx(\"a\",{href:mailto,onClick:onClick,className:cls,\"aria-label\":`${email}, click to copy`,style:{color,textDecorationLine:\"underline\",textDecorationColor:\"transparent\",textDecorationThickness:2,textUnderlineOffset:8,cursor:\"pointer\",overflowWrap:\"anywhere\",textAlign:align,fontFamily:fam(family,\"Inter, sans-serif\"),fontWeight:Number(weight)||500,lineHeight:\"1em\",fontSize:`min(${px}px, 8.6cqw)`,letterSpacing:`${tracking??-.05}em`,borderRadius:4,display:\"inline-block\",padding:\"8px 0\",minHeight:44,boxSizing:\"border-box\"},children:email}),hint?/*#__PURE__*/_jsxs(\"span\",{\"aria-live\":\"polite\",style:{display:\"inline-grid\",color:hintColor,fontFamily:fam(hintFamily,\"ui-monospace, monospace\"),fontSize:12,fontWeight:500,letterSpacing:\"0.08em\",lineHeight:\"16px\",textTransform:\"uppercase\",whiteSpace:\"nowrap\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{gridArea:\"1 / 1\",visibility:copied?\"hidden\":\"visible\"},children:hint}),/*#__PURE__*/_jsxs(\"span\",{style:{gridArea:\"1 / 1\",visibility:copied?\"visible\":\"hidden\",display:\"inline-flex\",alignItems:\"center\",gap:8},children:[/*#__PURE__*/_jsx(\"span\",{style:{width:8,height:8,borderRadius:99,background:dotColor,flexShrink:0}}),copiedText]})]}):null,live?/*#__PURE__*/_jsx(\"style\",{children:`.ps-ce{transition:color .16s cubic-bezier(.2,0,0,1),text-decoration-color .16s cubic-bezier(.2,0,0,1)}.ps-ce:hover{color:${hoverColor} !important;text-decoration-color:${color} !important}.ps-ce:focus-visible{outline:2px solid ${hoverColor};outline-offset:6px}`}):null]});}CopyEmail.displayName=\"Copy Email\";CopyEmail.defaultProps={email:\"studio@example.com\",copiedText:\"Copied to clipboard\",dotColor:\"#3E8E5A\",hint:\"Click to copy\",color:\"#1B1C1E\",hoverColor:\"#2F4AA0\",hintColor:\"#6C6B67\",align:\"left\",size:96,tracking:-.045,family:\"Switzer\",weight:500,hintFamily:\"IBM Plex Mono\"};addPropertyControls(CopyEmail,{email:{type:ControlType.String,title:\"Email\"},copiedText:{type:ControlType.String,title:\"Copied\"},hint:{type:ControlType.String,title:\"Hint\"},align:{type:ControlType.Enum,title:\"Align\",options:[\"left\",\"center\"],optionTitles:[\"Left\",\"Center\"],displaySegmentedControl:true},color:{type:ControlType.Color,title:\"Color\"},hoverColor:{type:ControlType.Color,title:\"Hover\"},hintColor:{type:ControlType.Color,title:\"Hint Color\"},dotColor:{type:ControlType.Color,title:\"Copied Dot\"},size:{type:ControlType.Number,title:\"Size\",min:16,max:240,step:1,unit:\"px\",description:\"Shrinks on narrow screens so the address always fits.\"},tracking:{type:ControlType.Number,title:\"Tracking\",min:-.1,max:.2,step:.005,unit:\"em\"},family:{type:ControlType.String,title:\"Font Family\",description:\"Name of a font your site already uses, e.g. in a text style.\"},weight:{type:ControlType.Number,title:\"Font Weight\",min:100,max:900,step:100},hintFamily:{type:ControlType.String,title:\"Hint Family\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CopyEmail\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any-prefer-auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CopyEmail.map"],"mappings":"mOAMG,SAAwB,EAAU,EAAM,CAAC,GAAK,CAAC,QAAM,aAAW,OAAK,QAAM,aAAW,YAAU,WAAS,QAAM,OAAK,WAAS,SAAO,SAAO,aAAW,SAAO,EAAY,EAAG,OAAO,CAAI,GAAG,GAA8C,EAAK,CAAjC,EAAyC,GAAG,EAAa,QAAQ,IAAI,EAAa,OAAY,CAAC,EAAO,GAAWA,EAAS,EAAK,EAAQ,EAAMC,EAAO,EAAE,UAAkB,aAAa,EAAM,OAAO,EAAE,CAAC,CAAC,EAAE,IAAM,GAAK,EAAK,IAAW,EAAK,IAAI,OAAO,CAAI,CAAC,CAAC,QAAQ,KAAK,EAAE,EAAE,KAAK,IAAW,EAAe,EAAO,UAAU,IAAc,EAAQ,GAAG,CAAC,GAAG,CAAC,EAAK,OAC5iB,EAAE,eAAe,EAAE,IAAM,MAAS,CAAC,EAAU,EAAI,EAAE,aAAa,EAAM,OAAO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