{"version":3,"file":"DownloadButton.3IIeVBbN.mjs","names":["useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/tzGWH5vcjIpSrgfeVUFs/y5M1bxtwZ7Fb2w11R6oI/DownloadButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";const onHoverStyle={scale:1.05,cursor:\"pointer\"};const spring={type:\"spring\",stiffness:300,damping:30};/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function Download(props){const[blobUrl,setBlobUrl]=useState(null);const{fileName,tint,style,file,radius,topLeftRadius,topRightRadius,bottomRightRadius,bottomLeftRadius,isMixedRadius=false,stylePadding,topLeftPadding,topRightPadding,bottomRightPadding,bottomLeftPadding,isMixedPadding=false,font,icon,title,showLabel=true,showIcon=true,iconSize=30}=props;const borderRadius=isMixedRadius?`${topLeftRadius}px ${topRightRadius}px ${bottomRightRadius}px ${bottomLeftRadius}px`:`${radius}px`;const padding=isMixedPadding?`${topLeftPadding}px ${topRightPadding}px ${bottomRightPadding}px ${bottomLeftPadding}px`:`${stylePadding}px`;const handleClick=async()=>{const response=await fetch(props.file);const blob=await response.blob();const blobUrl=URL.createObjectURL(blob);setBlobUrl(blobUrl);};useEffect(()=>{handleClick();},[]);return /*#__PURE__*/_jsx(motion.div,{style:{...style,...containerStyle},children:/*#__PURE__*/_jsx(motion.div,{style:{borderRadius,padding,backgroundColor:tint,overflow:\"visible\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},whileHover:onHoverStyle,transition:{type:\"spring\",stiffness:500,damping:30},children:/*#__PURE__*/_jsxs(\"a\",{href:blobUrl,\"aria-label\":`Download ${fileName}`,style:{textDecoration:\"none\",display:\"flex\",alignItems:\"center\"},download:fileName,children:[showIcon&&icon&&/*#__PURE__*/_jsx(\"img\",{src:icon,alt:\"icon\",style:{width:iconSize,height:iconSize}}),showLabel&&/*#__PURE__*/_jsxs(_Fragment,{children:[showIcon&&/*#__PURE__*/_jsx(\"div\",{style:{width:8}}),\" \",/*#__PURE__*/_jsx(\"span\",{style:{color:font.color,fontSize:font.size,fontWeight:font.weight,fontFamily:`'${font.fontFace}'`,whiteSpace:\"nowrap\"},children:title})]})]})})});}addPropertyControls(Download,{// Reorder the controls as requested\nshowLabel:{type:ControlType.Boolean,title:\"Show Label\",defaultValue:true},title:{title:\"Label\",type:ControlType.String,defaultValue:\"Download!\"},showIcon:{type:ControlType.Boolean,title:\"Show Icon\",defaultValue:true},icon:{type:ControlType.Image,title:\"Icon\"},iconSize:{type:ControlType.Number,title:\"Icon Size\",defaultValue:24,min:10,max:100},file:{title:\"File\",type:ControlType.File,allowedFileTypes:[]},fileName:{type:ControlType.String,defaultValue:\"File\"},tint:{title:\"Background Color\",type:ControlType.Color,defaultValue:\"#242424\"},font:{type:ControlType.Object,controls:{fontFace:{type:ControlType.String,defaultValue:\"Inter\"},size:{type:ControlType.Number,defaultValue:18},color:{type:ControlType.Color,defaultValue:\"#fff\"},weight:{type:ControlType.Enum,defaultValue:\"bold\",options:[\"normal\",\"bold\"]}}},radius:{type:ControlType.FusedNumber,title:\"Radius\",defaultValue:8,toggleKey:\"isMixedRadius\",toggleTitles:[\"All\",\"Individual\"],valueKeys:[\"topLeftRadius\",\"topRightRadius\",\"bottomRightRadius\",\"bottomLeftRadius\"],valueLabels:[\"T\",\"R\",\"B\",\"L\"],min:0},stylePadding:{type:ControlType.FusedNumber,title:\"Padding\",defaultValue:16,toggleKey:\"isMixedPadding\",toggleTitles:[\"All\",\"Individual\"],valueKeys:[\"topLeftPadding\",\"topRightPadding\",\"bottomRightPadding\",\"bottomLeftPadding\"],valueLabels:[\"T\",\"R\",\"B\",\"L\"],min:0}});const containerStyle={display:\"flex\",justifyContent:\"center\",alignItems:\"center\",overflow:\"visible\"};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Download\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DownloadButton.map"],"mappings":"gPAGG,SAAwB,EAAS,EAAM,CAAC,GAAK,CAAC,EAAQ,GAAYA,EAAS,KAAK,CAAM,CAAC,WAAS,OAAK,QAAM,OAAK,SAAO,gBAAc,iBAAe,oBAAkB,mBAAiB,gBAAc,GAAM,eAAa,iBAAe,kBAAgB,qBAAmB,oBAAkB,iBAAe,GAAM,OAAK,OAAK,QAAM,YAAU,GAAK,WAAS,GAAK,WAAS,IAAI,EAAY,EAAa,EAAc,GAAG,EAAc,KAAK,EAAe,KAAK,EAAkB,KAAK,EAAiB,IAAI,GAAG,EAAO,IAAU,EAAQ,EAAe,GAAG,EAAe,KAAK,EAAgB,KAAK,EAAmB,KAAK,EAAkB,IAAI,GAAG,EAAa,IAAU,EAAY,SAAS,CAAwC,IAAM,EAAK,MAAnC,MAAM,MAAM,EAAM,KAAK,EAA2B,MAAM,CAAyC,EAA1B,IAAI,gBAAgB,EAAK,CAAoB,EAAsC,OAAnC,MAAc,CAAC,GAAa,EAAG,EAAE,CAAC,CAAqB,EAAK,EAAO,IAAI,CAAC,MAAM,CAAC,GAAG,EAAM,GAAG,EAAe,CAAC,SAAsB,EAAK,EAAO,IAAI,CAAC,MAAM,CAAC,eAAa,UAAQ,gBAAgB,EAAK,SAAS,UAAU,QAAQ,OAAO,WAAW,SAAS,eAAe,SAAS,CAAC,WAAW,EAAa,WAAW,CAAC,KAAK,SAAS,UAAU,IAAI,QAAQ,GAAG,CAAC,SAAsB,EAAM,IAAI,CAAC,KAAK,EAAQ,aAAa,YAAY,IAAW,MAAM,CAAC,eAAe,OAAO,QAAQ,OAAO,WAAW,SAAS,CAAC,SAAS,EAAS,SAAS,CAAC,GAAU,GAAmB,EAAK,MAAM,CAAC,IAAI,EA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