{"version":3,"file":"ShareButton.DaFi2plJ.mjs","names":["useState","startTransition"],"sources":["https:/framerusercontent.com/modules/VkKJky2EIy5uH6SM83hU/Lk8pDB2P5PDDthEcRzJh/ShareButton.js"],"sourcesContent":["// Share button component that opens native share options\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,startTransition}from\"react\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function ShareButton(props){const{label,url,shareCurrentUrl=false,title,text,backgroundColor,textColor,hoverBackgroundColor,hoverTextColor,borderRadius,padding,font,showIcon,iconPosition}=props;const[isHovered,setIsHovered]=useState(false);const[showFallback,setShowFallback]=useState(false);const handleShare=async()=>{if(typeof window===\"undefined\")return;const urlToShare=shareCurrentUrl?window.location.href:url;const shareData={title:title,text:text,url:urlToShare};if(navigator.share){try{await navigator.share(shareData);}catch(err){if(err.name!==\"AbortError\"){console.error(\"Error sharing:\",err);startTransition(()=>setShowFallback(true));setTimeout(()=>startTransition(()=>setShowFallback(false)),2e3);}}}else{if(navigator.clipboard){try{await navigator.clipboard.writeText(urlToShare);startTransition(()=>setShowFallback(true));setTimeout(()=>startTransition(()=>setShowFallback(false)),2e3);}catch(err){console.error(\"Failed to copy:\",err);}}}};const currentBg=isHovered?hoverBackgroundColor:backgroundColor;const currentText=isHovered?hoverTextColor:textColor;const shareIcon=/*#__PURE__*/_jsxs(\"svg\",{width:\"16\",height:\"16\",viewBox:\"0 0 16 16\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",style:{flexShrink:0},children:[/*#__PURE__*/_jsx(\"path\",{d:\"M12 5.33333C13.1046 5.33333 14 4.43791 14 3.33333C14 2.22876 13.1046 1.33333 12 1.33333C10.8954 1.33333 10 2.22876 10 3.33333C10 4.43791 10.8954 5.33333 12 5.33333Z\",stroke:currentText,strokeWidth:\"1.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M4 10C5.10457 10 6 9.10457 6 8C6 6.89543 5.10457 6 4 6C2.89543 6 2 6.89543 2 8C2 9.10457 2.89543 10 4 10Z\",stroke:currentText,strokeWidth:\"1.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M12 14.6667C13.1046 14.6667 14 13.7712 14 12.6667C14 11.5621 13.1046 10.6667 12 10.6667C10.8954 10.6667 10 11.5621 10 12.6667C10 13.7712 10.8954 14.6667 12 14.6667Z\",stroke:currentText,strokeWidth:\"1.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M5.72656 9.00667L10.2799 11.66\",stroke:currentText,strokeWidth:\"1.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M10.2732 4.34L5.72656 6.99333\",stroke:currentText,strokeWidth:\"1.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})]});return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",display:\"inline-block\"},children:[/*#__PURE__*/_jsxs(\"button\",{onClick:handleShare,onMouseEnter:()=>startTransition(()=>setIsHovered(true)),onMouseLeave:()=>startTransition(()=>setIsHovered(false)),style:{...font,backgroundColor:currentBg,color:currentText,border:\"none\",borderRadius:`${borderRadius}px`,padding:`${padding}px ${padding*1.5}px`,cursor:\"pointer\",display:\"flex\",alignItems:\"center\",gap:\"8px\",transition:\"all 0.2s ease\",flexDirection:iconPosition===\"right\"?\"row-reverse\":\"row\",whiteSpace:\"nowrap\"},children:[showIcon&&shareIcon,/*#__PURE__*/_jsx(\"span\",{children:label})]}),showFallback&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:\"calc(100% + 8px)\",left:\"50%\",transform:\"translateX(-50%)\",backgroundColor:\"#333\",color:\"#fff\",padding:\"8px 12px\",borderRadius:\"4px\",fontSize:\"12px\",whiteSpace:\"nowrap\",zIndex:1e3},children:\"Link copied to clipboard!\"})]});}addPropertyControls(ShareButton,{shareCurrentUrl:{type:ControlType.Boolean,title:\"Link\",enabledTitle:\"Current\",disabledTitle:\"Custom\",defaultValue:false},label:{type:ControlType.String,title:\"Label\",defaultValue:\"Share\"},url:{type:ControlType.String,title:\"URL\",defaultValue:\"https://framer.com\",hidden:({shareCurrentUrl})=>shareCurrentUrl},title:{type:ControlType.String,title:\"Share Title\",defaultValue:\"Check this out!\"},text:{type:ControlType.String,title:\"Share Text\",defaultValue:\"I wanted to share this with you\",displayTextArea:true},showIcon:{type:ControlType.Boolean,title:\"Show Icon\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},iconPosition:{type:ControlType.Enum,title:\"Icon Position\",options:[\"left\",\"right\"],optionTitles:[\"Left\",\"Right\"],defaultValue:\"left\",displaySegmentedControl:true,hidden:({showIcon})=>!showIcon},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#0099FF\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#FFFFFF\"},hoverBackgroundColor:{type:ControlType.Color,title:\"Hover Background\",defaultValue:\"#0066FF\"},hoverTextColor:{type:ControlType.Color,title:\"Hover Text\",defaultValue:\"#FFFFFF\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:6,min:0,max:50,step:1,unit:\"px\"},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:8,min:4,max:32,step:1,unit:\"px\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{variant:\"Semibold\",fontSize:\"13px\",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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