{"version":3,"file":"DownloadButton.CB7oBiCk.mjs","names":["useState","_Fragment","__esmMin","init_npm_react_18_3_1","_e","init_jsx_runtime","c","p","ce","init_framer_motion_DhsWWWsN","motion","init_framer_B1b760uK","addPropertyControls","ControlType","Download","blobUrl","setBlobUrl","props","borderRadius","isMixedRadius","topLeftRadius","topRightRadius","bottomRightRadius","bottomLeftRadius","radius","padding","isMixedPadding","topLeftPadding","topRightPadding","bottomRightPadding","bottomLeftPadding","stylePadding","handleClick","blob","style","containerStyle","tint","onHoverStyle","fileName","showIcon","icon","iconSize","showLabel","l","font","title","init_DownloadButton"],"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":"A,gPAGG,SAAwBc,EAAS,EAAM,CAAC,GAAK,CAACC,EAAQC,GAAYhB,EAAS,IAAI,EAAO,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,IAAIiB,EAAYC,EAAaC,EAAc,GAAGC,EAAc,KAAKC,EAAe,KAAKC,EAAkB,KAAKC,EAAiB,IAAI,GAAGC,EAAO,IAAUC,EAAQC,EAAe,GAAGC,EAAe,KAAKC,EAAgB,KAAKC,EAAmB,KAAKC,EAAkB,IAAI,GAAGC,EAAa,IAAUC,EAAY,SAAS,CAAwC,IAAMC,EAAK,MAAM,MAAnC,MAAMhB,EAAM,IAAI,EAAA,CAA4B,KAAK,EAAQF,EAAQ,IAAI,gBAAgBkB,CAAI,EAAEjB,EAAWD,CAAO,CAAE,EAAqC,OAAnCP,MAAc,CAACwB,EAAY,CAAE,EAAE,CAAC,CAAC,EAAsB,gBAAKtB,EAAO,IAAI,CAAC,MAAM,CAAC,GAAGwB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