{"version":3,"file":"PDF_Download_Button.Dftom4_1.mjs","names":["useState","useMemo","useCallback"],"sources":["https:/framerusercontent.com/modules/8EnZsHWrHZxI05WSZhjT/j5YmevGcxl4oIvmZCShf/PDF_Download_Button.js"],"sourcesContent":["// User request: Remove truncation/ellipsis and make the label use full available width on mobile/fixed sizes, wrapping naturally and staying centered. Keep fit-content compact behavior, allow auto-height growth for multi-line labels, keep fixed-height content centered/contained, and preserve existing styling/PDF behavior.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{startTransition,useCallback,useMemo,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function PDFDownloadButton(props){const{style,label=\"Download PDF\",file=\"\",backgroundColor=\"rgb(139, 219, 205)\",textColor=\"rgb(6, 61, 51)\",cornerRadius=8,horizontalPadding=22,verticalPadding=14,showIcon=false,font}=props;const[isHovered,setIsHovered]=useState(false);const hasFile=Boolean(file);const sizing=useMemo(()=>{const styleWidth=style?.width;const styleHeight=style?.height;const hasExplicitWidth=styleWidth!==undefined&&styleWidth!==null;const hasExplicitHeight=styleHeight!==undefined&&styleHeight!==null;const isFillWidth=styleWidth===\"100%\";const isFillHeight=styleHeight===\"100%\";return{rootWidth:hasExplicitWidth?styleWidth:\"max-content\",rootHeight:hasExplicitHeight?styleHeight:\"auto\",buttonWidth:hasExplicitWidth||isFillWidth?\"100%\":\"max-content\",buttonHeight:hasExplicitHeight||isFillHeight?\"100%\":\"auto\",shouldUseMinWidth:!hasExplicitWidth,shouldUseMinHeight:!hasExplicitHeight,shouldConstrainContent:hasExplicitWidth||isFillWidth,shouldClipContent:hasExplicitHeight||isFillHeight};},[style]);const handleMouseEnter=useCallback(()=>{startTransition(()=>setIsHovered(true));},[]);const handleMouseLeave=useCallback(()=>{startTransition(()=>setIsHovered(false));},[]);const handleOpenPdf=useCallback(()=>{if(typeof window===\"undefined\"||typeof document===\"undefined\")return;if(!file)return;const openedWindow=window.open(file,\"_blank\",\"noopener,noreferrer\");if(openedWindow)return;const anchor=document.createElement(\"a\");anchor.href=file;anchor.target=\"_blank\";anchor.rel=\"noopener noreferrer\";document.body.appendChild(anchor);anchor.click();document.body.removeChild(anchor);},[file]);const icon=useMemo(()=>{if(!showIcon)return null;return /*#__PURE__*/_jsx(\"svg\",{width:\"14\",height:\"14\",viewBox:\"0 0 24 24\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",\"aria-hidden\":\"true\",style:{flexShrink:0},children:/*#__PURE__*/_jsx(\"path\",{d:\"M12 3V14M12 14L7.5 9.5M12 14L16.5 9.5M5 18.5H19\",stroke:textColor,strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})});},[showIcon,textColor]);return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",display:\"flex\",width:sizing.rootWidth,height:sizing.rootHeight,minWidth:sizing.shouldUseMinWidth?120:undefined,minHeight:sizing.shouldUseMinHeight?36:undefined,...style},children:/*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:handleOpenPdf,onMouseEnter:handleMouseEnter,onMouseLeave:handleMouseLeave,\"aria-label\":hasFile?`Open ${label||\"PDF file\"} in a new tab`:`${label||\"Open PDF\"} (upload a PDF file in properties first)`,disabled:!hasFile,style:{position:\"relative\",display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",width:sizing.buttonWidth,height:sizing.buttonHeight,minWidth:sizing.shouldUseMinWidth?120:undefined,minHeight:sizing.shouldUseMinHeight?36:undefined,maxWidth:\"100%\",border:\"none\",outline:\"none\",borderRadius:cornerRadius,backgroundColor,color:textColor,padding:`${verticalPadding}px ${horizontalPadding}px`,cursor:hasFile?\"pointer\":\"not-allowed\",opacity:hasFile?1:.7,transform:isHovered&&hasFile?\"translateY(-1px)\":\"translateY(0px)\",filter:isHovered&&hasFile?\"brightness(1.08)\":\"brightness(1)\",transition:\"transform 160ms ease, filter 160ms ease, opacity 160ms ease\",whiteSpace:sizing.shouldConstrainContent?\"normal\":\"nowrap\",overflow:sizing.shouldClipContent?\"hidden\":\"visible\",textDecoration:\"none\",WebkitTapHighlightColor:\"transparent\",...font},children:/*#__PURE__*/_jsxs(\"span\",{style:{display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",gap:8,width:sizing.shouldConstrainContent?\"100%\":\"max-content\",minWidth:0,maxWidth:\"100%\"},children:[icon,/*#__PURE__*/_jsx(\"span\",{style:{minWidth:sizing.shouldConstrainContent?0:\"max-content\",maxWidth:\"100%\",whiteSpace:sizing.shouldConstrainContent?\"normal\":\"nowrap\",overflowWrap:\"anywhere\",wordBreak:\"break-word\",textAlign:\"center\",flex:sizing.shouldConstrainContent?\"1 1 auto\":\"0 0 auto\"},children:label})]})})});}addPropertyControls(PDFDownloadButton,{label:{type:ControlType.String,title:\"Label\",defaultValue:\"Open PDF\"},file:{type:ControlType.File,title:\"PDF File\",allowedFileTypes:[\"pdf\"]},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"rgb(139, 219, 205)\"},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"rgb(6, 61, 51)\"},cornerRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:40,step:1},horizontalPadding:{type:ControlType.Number,title:\"Pad X\",defaultValue:22,min:0,max:60,step:1},verticalPadding:{type:ControlType.Number,title:\"Pad Y\",defaultValue:14,min:0,max:40,step:1},showIcon:{type:ControlType.Boolean,title:\"Icon\",defaultValue:false,enabledTitle:\"Show\",disabledTitle:\"Hide\"},font:{type:ControlType.Font,title:\"Label Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"14px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PDFDownloadButton\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-f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