{"version":3,"file":"ShareButton.CB7Pyuxe.mjs","names":["useState","useRef","startTransition"],"sources":["https:/framerusercontent.com/modules/A22A5HwfYFoB2ZpcaMt4/jkVVf9K4PETJ4v7W2V56/ShareButton.js"],"sourcesContent":["// Button that transforms into a share button and opens native sharing functionality\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useState,startTransition,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function ShareButton(props){const{label,shareLabel,shareTitle,shareText,shareUrl,backgroundColor,textColor,hoverColor,activeColor,borderRadius,font,padding,border,gap,style}=props;const[isHovered,setIsHovered]=useState(false);const[isActive,setIsActive]=useState(false);const[isShared,setIsShared]=useState(false);const buttonRef=useRef(null);const handleShare=async()=>{if(typeof window===\"undefined\"||typeof navigator===\"undefined\")return;startTransition(()=>setIsShared(true));// Check if Web Share API is supported\nif(navigator.share){try{await navigator.share({title:shareTitle,text:shareText,url:shareUrl});}catch(err){// User cancelled or error occurred\nconsole.log(\"Share cancelled or failed:\",err);}}else{// Fallback: copy to clipboard\ntry{const textToCopy=`${shareTitle}\n${shareText}\n${shareUrl}`;await navigator.clipboard.writeText(textToCopy);alert(\"Link copied to clipboard!\");}catch(err){console.log(\"Failed to copy:\",err);}}// Reset after a delay\nsetTimeout(()=>{startTransition(()=>setIsShared(false));},2e3);};const currentBg=isActive?activeColor:isHovered?hoverColor:backgroundColor;return /*#__PURE__*/_jsx(\"button\",{ref:buttonRef,style:{...style,position:\"relative\",width:\"max-content\",background:currentBg,color:textColor,borderRadius,padding,cursor:\"pointer\",transition:\"all 0.2s ease\",gap,...border,...font},onClick:handleShare,onMouseEnter:()=>startTransition(()=>setIsHovered(true)),onMouseLeave:()=>{startTransition(()=>setIsHovered(false));startTransition(()=>setIsActive(false));},onMouseDown:()=>startTransition(()=>setIsActive(true)),onMouseUp:()=>startTransition(()=>setIsActive(false)),\"aria-label\":isShared?shareLabel:label,children:isShared?shareLabel:label});}addPropertyControls(ShareButton,{label:{type:ControlType.String,title:\"Label\",defaultValue:\"Share\"},shareLabel:{type:ControlType.String,title:\"Share Label\",defaultValue:\"Shared!\"},shareTitle:{type:ControlType.String,title:\"Share Title\",defaultValue:\"Check this out!\"},shareText:{type:ControlType.String,title:\"Share Text\",defaultValue:\"I wanted to share this with you.\",displayTextArea:true},shareUrl:{type:ControlType.String,title:\"Share URL\",defaultValue:\"https://framer.com\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#000000\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#FFFFFF\"},hoverColor:{type:ControlType.Color,title:\"Hover Color\",defaultValue:\"#333333\"},activeColor:{type:ControlType.Color,title:\"Active Color\",defaultValue:\"#555555\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:50,step:1,unit:\"px\"},padding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"12px 24px\"},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:0,min:0,max:32,step:1,unit:\"px\"},border:{type:ControlType.Border,title:\"Border\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"14px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ShareButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ShareButton.map"],"mappings":"6MAIG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,QAAM,aAAW,aAAW,YAAU,WAAS,kBAAgB,YAAU,aAAW,cAAY,eAAa,OAAK,UAAQ,SAAO,MAAI,SAAO,EAAW,CAAC,EAAU,GAAcA,EAAS,EAAK,EAA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