{"version":3,"file":"DownloadButton.C8MgKYPE.mjs","names":["useState","useMemo","useCallback"],"sources":["https:/framerusercontent.com/modules/nYuWdQ9POzOsnSkBTqBR/R0tOdFHkh4ou9jKyT3Xg/DownloadButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{startTransition,useCallback,useMemo,useState}from\"react\";/**\n * Download Button\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function DownloadButton(props){const{label,fileUrl=\"https://framerusercontent.com/assets/8w3IUatLX9a5JVJ6XPCVuHi94.mp3\",filename,variant,background,textColor,borderColor,hoverBackground,hoverTextColor,hoverBorderColor,pressedBackground,pressedTextColor,pressedBorderColor,borderWidth,radius,padding,font,disabled,style}=props;const isStatic=useIsStaticRenderer();const[hovered,setHovered]=useState(false);const[pressed,setPressed]=useState(false);const visual=useMemo(()=>{const isOutline=variant===\"outline\";const baseBg=isOutline?\"transparent\":background;const baseText=isOutline?borderColor:textColor;const baseBorder=borderColor;const hBg=isOutline?\"transparent\":hoverBackground;const hText=isOutline?hoverBorderColor:hoverTextColor;const hBorder=hoverBorderColor;const pBg=isOutline?\"transparent\":pressedBackground;const pText=isOutline?pressedBorderColor:pressedTextColor;const pBorder=pressedBorderColor;if(disabled){return{background:isOutline?\"transparent\":background,color:isOutline?borderColor:textColor,borderColor,opacity:.5};}if(pressed){return{background:pBg,color:pText,borderColor:pBorder,opacity:1};}if(hovered){return{background:hBg,color:hText,borderColor:hBorder,opacity:1};}return{background:baseBg,color:baseText,borderColor:baseBorder,opacity:1};},[variant,background,textColor,borderColor,hoverBackground,hoverTextColor,hoverBorderColor,pressedBackground,pressedTextColor,pressedBorderColor,hovered,pressed,disabled]);const doDownload=useCallback(()=>{if(disabled)return;if(typeof window===\"undefined\"||typeof document===\"undefined\")return;if(!fileUrl)return;const fallback=()=>{try{const a=document.createElement(\"a\");a.href=fileUrl;a.rel=\"noopener noreferrer\";a.target=\"_blank\";a.download=filename||\"\";document.body.appendChild(a);a.click();a.remove();}catch(e){try{window.open(fileUrl,\"_blank\",\"noopener,noreferrer\");}catch{// no-op\n}}};(async()=>{try{const res=await fetch(fileUrl,{credentials:\"omit\",cache:\"no-store\"});if(!res.ok){fallback();return;}const blob=await res.blob();const blobUrl=URL.createObjectURL(blob);const a=document.createElement(\"a\");a.href=blobUrl;a.rel=\"noopener noreferrer\";a.download=filename||\"download\";document.body.appendChild(a);a.click();a.remove();// Let the click start before revoking\nwindow.setTimeout(()=>URL.revokeObjectURL(blobUrl),1e3);}catch{fallback();}})();},[disabled,fileUrl,filename]);const baseStyle={position:\"relative\",display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",gap:8,width:\"100%\",height:\"100%\",padding,borderRadius:radius,borderStyle:\"solid\",borderWidth,background:visual.background,color:visual.color,borderColor:visual.borderColor,opacity:visual.opacity,transition:\"all 0.6s ease\",cursor:disabled?\"not-allowed\":\"pointer\",userSelect:\"none\",outline:\"none\",WebkitTapHighlightColor:\"transparent\",...font,...style};return /*#__PURE__*/_jsxs(\"button\",{type:\"button\",style:baseStyle,onClick:doDownload,onMouseEnter:isStatic||disabled?undefined:()=>{startTransition(()=>setHovered(true));},onMouseLeave:isStatic||disabled?undefined:()=>{startTransition(()=>{setHovered(false);setPressed(false);});},onMouseDown:isStatic||disabled?undefined:()=>{startTransition(()=>setPressed(true));},onMouseUp:isStatic||disabled?undefined:()=>{startTransition(()=>setPressed(false));},onKeyDown:e=>{if(disabled)return;if(e.key===\"Enter\"||e.key===\" \"){e.preventDefault();doDownload();}},\"aria-label\":label,\"aria-disabled\":disabled,disabled:disabled,children:[/*#__PURE__*/_jsx(\"span\",{style:{width:\"max-content\",minWidth:\"max-content\"},children:label}),/*#__PURE__*/_jsx(\"svg\",{xmlns:\"http://www.w3.org/2000/svg\",width:\"15\",height:\"15\",fill:\"none\",\"aria-hidden\":\"true\",focusable:\"false\",children:/*#__PURE__*/_jsxs(\"g\",{children:[/*#__PURE__*/_jsx(\"path\",{d:\"M 0 14.4 L 0 0 L 14.4 0 L 14.4 14.4 Z\",fill:\"transparent\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M 2.4 10.2 L 2.4 11.4 C 2.4 11.719 2.527 12.024 2.752 12.249 C 2.977 12.474 3.282 12.6 3.6 12.6 L 10.8 12.6 C 11.119 12.6 11.424 12.474 11.649 12.249 C 11.874 12.024 12 11.719 12 11.4 L 12 10.2\",fill:\"transparent\",strokeWidth:\"0.9\",stroke:\"rgb(32,30,33)\",strokeLinecap:\"round\",strokeLinejoin:\"round\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M 4.199 6.601 L 7.199 9.601 L 10.199 6.601\",fill:\"transparent\",strokeWidth:\"0.9\",stroke:\"rgb(32,30,33)\",strokeLinecap:\"round\",strokeLinejoin:\"round\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M 7.199 2.4 L 7.199 9.6\",fill:\"transparent\",strokeWidth:\"0.9\",stroke:\"rgb(32,30,33)\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})]})})]});}addPropertyControls(DownloadButton,{label:{type:ControlType.String,title:\"Label\",defaultValue:\"T\\xe9l\\xe9charger\"},fileUrl:{type:ControlType.File,title:\"Fichier\",allowedFileTypes:[\"jpg\",\"jpeg\",\"png\",\"gif\",\"webp\",\"svg\",\"mp4\",\"webm\",\"mov\",\"mp3\",\"wav\",\"ogg\",\"pdf\",\"doc\",\"docx\",\"txt\"]},filename:{type:ControlType.String,title:\"Nom\",defaultValue:\"download\",placeholder:\"ex: brochure.pdf\"},variant:{type:ControlType.Enum,title:\"Style\",options:[\"solid\",\"outline\"],optionTitles:[\"Solid\",\"Outline\"],defaultValue:\"solid\",displaySegmentedControl:true},disabled:{type:ControlType.Boolean,title:\"Disabled\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"#000000\",hidden:({variant})=>variant===\"outline\"},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#FFFFFF\",hidden:({variant})=>variant===\"outline\"},borderColor:{type:ControlType.Color,title:\"Border\",defaultValue:\"#000000\"},hoverBackground:{type:ControlType.Color,title:\"Hover Bg\",defaultValue:\"#111111\",hidden:({variant})=>variant===\"outline\"},hoverTextColor:{type:ControlType.Color,title:\"Hover Text\",defaultValue:\"#FFFFFF\",hidden:({variant})=>variant===\"outline\"},hoverBorderColor:{type:ControlType.Color,title:\"Hover Border\",defaultValue:\"#111111\"},pressedBackground:{type:ControlType.Color,title:\"Pressed Bg\",defaultValue:\"#222222\",hidden:({variant})=>variant===\"outline\"},pressedTextColor:{type:ControlType.Color,title:\"Pressed Text\",defaultValue:\"#FFFFFF\",hidden:({variant})=>variant===\"outline\"},pressedBorderColor:{type:ControlType.Color,title:\"Pressed Border\",defaultValue:\"#222222\"},borderWidth:{type:ControlType.Number,title:\"Border W\",defaultValue:1,min:0,max:10,step:1,unit:\"px\"},radius:{type:ControlType.BorderRadius,title:\"Radius\",defaultValue:\"12px\"},padding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"12px 16px\"},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\":\"DownloadButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DownloadButton.map"],"mappings":"4NAKG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,QAAM,UAAQ,qEAAqE,WAAS,UAAQ,aAAW,YAAU,cAAY,kBAAgB,iBAAe,mBAAiB,oBAAkB,mBAAiB,qBAAmB,cAAY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