{"version":3,"file":"Button.CdQMUJtW.mjs","names":["useState","startTransition"],"sources":["https:/framerusercontent.com/modules/IdFi7nkgJgbQnqZKKVE5/WggzcUI1ezK4OV8NNIre/Button.js"],"sourcesContent":["// Button component with file upload, customizable styling, and filename display\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function Button(props){const{text,pdfFile=\"\",customFilename,font,icon,iconPosition,buttonFill,textColor,borderRadius,padding,gap,hoverFill,hoverTextColor}=props;const[isHovered,setIsHovered]=useState(false);// Extract original filename for download attribute\nconst getOriginalFilename=url=>{// If custom filename is provided, use it\nif(customFilename&&customFilename.trim()){// Ensure it has .pdf extension\nreturn customFilename.endsWith(\".pdf\")?customFilename:`${customFilename}.pdf`;}if(!url)return\"document.pdf\";try{const urlObj=new URL(url);const pathname=urlObj.pathname;const filename=pathname.split(\"/\").pop()||\"document.pdf\";// If filename doesn't have extension, add .pdf\nreturn filename.includes(\".\")?filename:`${filename}.pdf`;}catch{return\"document.pdf\";}};const handleClick=()=>{if(pdfFile&&typeof window!==\"undefined\"){const filename=getOriginalFilename(pdfFile);// Fetch the file as a blob to ensure custom filename works\nfetch(pdfFile).then(response=>response.blob()).then(blob=>{const url=window.URL.createObjectURL(blob);const link=document.createElement(\"a\");link.href=url;link.download=filename;document.body.appendChild(link);link.click();document.body.removeChild(link);// Clean up the object URL\nwindow.URL.revokeObjectURL(url);}).catch(error=>{console.error(\"Download failed:\",error);// Fallback to direct download\nconst link=document.createElement(\"a\");link.href=pdfFile;link.download=filename;link.target=\"_blank\";document.body.appendChild(link);link.click();document.body.removeChild(link);});}};const iconSvgs={download:/*#__PURE__*/_jsxs(\"svg\",{width:\"16\",height:\"16\",viewBox:\"0 0 16 16\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",children:[/*#__PURE__*/_jsx(\"path\",{d:\"M14 10V12.6667C14 13.0203 13.8595 13.3594 13.6095 13.6095C13.3594 13.8595 13.0203 14 12.6667 14H3.33333C2.97971 14 2.64057 13.8595 2.39052 13.6095C2.14048 13.3594 2 13.0203 2 12.6667V10\",stroke:\"currentColor\",strokeWidth:\"1.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M4.66669 6.66669L8.00002 10L11.3334 6.66669\",stroke:\"currentColor\",strokeWidth:\"1.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M8 10V2\",stroke:\"currentColor\",strokeWidth:\"1.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})]}),arrow:/*#__PURE__*/_jsxs(\"svg\",{width:\"16\",height:\"16\",viewBox:\"0 0 16 16\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",children:[/*#__PURE__*/_jsx(\"path\",{d:\"M3.33331 8H12.6666\",stroke:\"currentColor\",strokeWidth:\"1.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M8 3.33331L12.6667 7.99998L8 12.6666\",stroke:\"currentColor\",strokeWidth:\"1.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})]}),file:/*#__PURE__*/_jsxs(\"svg\",{width:\"16\",height:\"16\",viewBox:\"0 0 16 16\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",children:[/*#__PURE__*/_jsx(\"path\",{d:\"M9.33331 1.33331H3.99998C3.64636 1.33331 3.30722 1.47379 3.05717 1.72384C2.80712 1.97389 2.66665 2.31302 2.66665 2.66665V13.3333C2.66665 13.6869 2.80712 14.0261 3.05717 14.2761C3.30722 14.5262 3.64636 14.6666 3.99998 14.6666H12C12.3536 14.6666 12.6927 14.5262 12.9428 14.2761C13.1928 14.0261 13.3333 13.6869 13.3333 13.3333V5.33331L9.33331 1.33331Z\",stroke:\"currentColor\",strokeWidth:\"1.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M9.33331 1.33331V5.33331H13.3333\",stroke:\"currentColor\",strokeWidth:\"1.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})]}),external:/*#__PURE__*/_jsxs(\"svg\",{width:\"16\",height:\"16\",viewBox:\"0 0 16 16\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",children:[/*#__PURE__*/_jsx(\"path\",{d:\"M12 8.66669V12.6667C12 13.0203 11.8595 13.3594 11.6095 13.6095C11.3594 13.8595 11.0203 14 10.6667 14H3.33333C2.97971 14 2.64057 13.8595 2.39052 13.6095C2.14048 13.3594 2 13.0203 2 12.6667V5.33335C2 4.97973 2.14048 4.64059 2.39052 4.39054C2.64057 4.14049 2.97971 4.00002 3.33333 4.00002H7.33333\",stroke:\"currentColor\",strokeWidth:\"1.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M10 2H14V6\",stroke:\"currentColor\",strokeWidth:\"1.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M6.66669 9.33331L14 2\",stroke:\"currentColor\",strokeWidth:\"1.5\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})]}),none:null};const filename=getOriginalFilename(pdfFile);return /*#__PURE__*/_jsxs(\"button\",{onClick:handleClick,onMouseEnter:()=>startTransition(()=>setIsHovered(true)),onMouseLeave:()=>startTransition(()=>setIsHovered(false)),style:{display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",gap:`${gap}px`,backgroundColor:isHovered?hoverFill:buttonFill,color:isHovered?hoverTextColor:textColor,borderRadius:`${borderRadius}px`,padding:padding,border:\"none\",cursor:\"pointer\",transition:\"all 0.2s ease\",...font,whiteSpace:\"nowrap\",flexDirection:iconPosition===\"right\"?\"row\":\"row\"},children:[iconPosition===\"left\"&&icon!==\"none\"&&iconSvgs[icon],/*#__PURE__*/_jsx(\"span\",{children:text}),iconPosition===\"right\"&&icon!==\"none\"&&iconSvgs[icon]]});}addPropertyControls(Button,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Download PDF\"},pdfFile:{type:ControlType.File,title:\"PDF File\",allowedFileTypes:[\"pdf\"]},customFilename:{type:ControlType.String,title:\"Filename\",defaultValue:\"\",placeholder:\"e.g., my-document.pdf\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"14px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}},icon:{type:ControlType.Enum,title:\"Icon\",options:[\"none\",\"download\",\"arrow\",\"file\",\"external\"],optionTitles:[\"None\",\"Download\",\"Arrow\",\"File\",\"External\"],defaultValue:\"download\",displaySegmentedControl:false},iconPosition:{type:ControlType.Enum,title:\"Icon Position\",options:[\"left\",\"right\"],optionTitles:[\"Left\",\"Right\"],defaultValue:\"left\",displaySegmentedControl:true,hidden:({icon})=>icon===\"none\"},buttonFill:{type:ControlType.Color,title:\"Fill\",defaultValue:\"#000000\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#FFFFFF\"},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:8,min:0,max:32,step:1,unit:\"px\"},hoverFill:{type:ControlType.Color,title:\"Hover Fill\",defaultValue:\"#333333\"},hoverTextColor:{type:ControlType.Color,title:\"Hover Text\",defaultValue:\"#FFFFFF\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Button\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}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