{"version":3,"file":"ShareButton.CSv_3EEY.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/3AQHwpIEemG34JVuccCB/TWtEV1nIiif2LX2n4aIb/ShareButton.js"],"sourcesContent":["// Share Button that shares the current webpage link\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useState,startTransition}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * Share Button\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function ShareButton(props){const{children,label,backgroundColor,textColor,font,borderRadius,padding,copiedDuration,style}=props;const[copied,setCopied]=useState(false);function setCopiedState(){startTransition(()=>setCopied(true));if(typeof window===\"undefined\")return;window.setTimeout(()=>{startTransition(()=>setCopied(false));},copiedDuration);}function handleShare(){if(typeof window===\"undefined\"||typeof navigator===\"undefined\")return;const url=window.location.href;if(typeof navigator.share===\"function\"){navigator.share({url}).catch(()=>{// User cancelled native share sheet or browser blocked it.\n});return;}if(navigator.clipboard?.writeText){navigator.clipboard.writeText(url).then(setCopiedState).catch(()=>{});return;}if(typeof document===\"undefined\")return;const input=document.createElement(\"input\");input.value=url;input.style.position=\"fixed\";input.style.left=\"-9999px\";input.style.top=\"-9999px\";document.body.appendChild(input);input.focus();input.select();try{document.execCommand(\"copy\");setCopiedState();}catch{// Ignore fallback failure.\n}document.body.removeChild(input);}if(RenderTarget.current()===RenderTarget.thumbnail)return null;const content=children?children:/*#__PURE__*/_jsx(\"div\",{style:{display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",width:\"100%\",height:\"100%\",background:backgroundColor,color:textColor,borderRadius,padding,boxSizing:\"border-box\",userSelect:\"none\",...font},children:copied?\"Copied\":label});return /*#__PURE__*/_jsx(\"div\",{role:\"button\",tabIndex:0,\"aria-label\":copied?\"Link copied\":\"Share this page\",onClick:handleShare,onKeyDown:event=>{if(event.key===\"Enter\"||event.key===\" \"){event.preventDefault();handleShare();}},style:{...style,width:\"100%\",height:\"100%\",display:\"contents\",cursor:\"pointer\"},children:content});}addPropertyControls(ShareButton,{children:{type:ControlType.Slot,title:\"Element\",maxCount:1},label:{type:ControlType.String,title:\"Label\",defaultValue:\"Share\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#000000\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"14px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:48,step:1},padding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"10px 14px\"},copiedDuration:{type:ControlType.Number,title:\"Copied Time\",defaultValue:1200,min:300,max:5e3,step:100,unit:\"ms\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ShareButton\",\"slots\":[\"children\"],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ShareButton.map"],"mappings":"yMAMG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,WAAS,QAAM,kBAAgB,YAAU,OAAK,eAAa,UAAQ,iBAAe,SAAO,EAAW,CAAC,EAAO,GAAWA,EAAS,EAAK,EAAE,SAAS,GAAgB,CAAC,MAAoB,EAAU,EAAI,CAAC,EAAY,IAAS,QAAmB,EAAO,eAAe,CAAC,MAAoB,EAAU,EAAK,CAAC,CAAE,EAAE,CAAc,CAAE,CAAC,SAAS,GAAa,CAAC,GAAU,IAAS,QAAoB,IAAY,OAAY,OAAO,IAAM,EAAI,EAAO,SAAS,KAAK,GAAG,OAAO,EAAU,OAAQ,WAAW,CAAC,EAAU,MAAM,CAAC,KAAG,CAAC,CAAC,CAAC,UAAU,CACrjB,CAAC,EAAE,MAAO,C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