{"version":3,"file":"Download.Dk7NIK2S.mjs","names":["IconType","SrcType"],"sources":["https:/framerusercontent.com/modules/kBkaj3LmBqcSU2IkUsBC/kvFSr6fSU7VcYZyNyfaK/Download.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{motion}from\"framer-motion\";var IconType;(function(IconType){IconType[\"Default\"]=\"Default\";IconType[\"Custom\"]=\"Custom\";})(IconType||(IconType={}));var SrcType;(function(SrcType){SrcType[\"Upload\"]=\"Upload\";SrcType[\"URL\"]=\"URL\";})(SrcType||(SrcType={}));// Check for the Search Index Meta Tag\n// Currently the only way to differenciate between Preview & Publish\nconst metaTagSelector='meta[name=\"framer-search-index\"]';// We can hopefully remove this check when new Preview ships\nfunction isPublishedSiteOrSSG(){if(typeof document===\"undefined\")return true;const metaTag=document.querySelector(metaTagSelector);return!!metaTag;}/**\n *\n * DOWNLOAD\n * By Hunter\n *\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 100\n *\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */ export default function Download(props){const{styleOptions,hoverOptions,iconOptions}=props;const{backgroundColor,color,borderRadius,padding,paddingPerSide,paddingTop,paddingRight,paddingBottom,paddingLeft,gap}=styleOptions;const isInPublishedSiteOrSSG=isPublishedSiteOrSSG();let downloadURL=undefined;if(isInPublishedSiteOrSSG){if(props.srcType===SrcType.URL)downloadURL=props.srcURL;if(props.srcType===SrcType.Upload)downloadURL=props.srcFile;}const paddingValue=paddingPerSide?`${paddingTop}px ${paddingRight}px ${paddingBottom}px ${paddingLeft}px`:`${padding}px`;const getIcon=()=>{var ref,ref1;if(!iconOptions)return;const iconStyle={order:iconOptions.alignment===\"start\"?0:2,flexShrink:0};return iconOptions.type===IconType.Custom&&!!((ref=iconOptions.image)===null||ref===void 0?void 0:ref.src)?/*#__PURE__*/ _jsx(\"img\",{style:iconStyle,alt:((ref1=iconOptions.image)===null||ref1===void 0?void 0:ref1.alt)&&iconOptions.image.alt.length>0?iconOptions.image.alt:\"download icon\",src:iconOptions.image.src,width:iconOptions.size,height:iconOptions.size}):/*#__PURE__*/ _jsx(\"svg\",{style:iconStyle,xmlns:\"http://www.w3.org/2000/svg\",width:iconOptions.size,height:iconOptions.size,fill:iconOptions.color,viewBox:\"0 0 256 256\",children:/*#__PURE__*/ _jsx(\"path\",{d:\"M228 152v56a20 20 0 0 1-20 20H48a20 20 0 0 1-20-20v-56a12 12 0 0 1 24 0v52h152v-52a12 12 0 0 1 24 0Zm-108.49 8.49a12 12 0 0 0 17 0l40-40a12 12 0 0 0-17-17L140 123V40a12 12 0 0 0-24 0v83l-19.51-19.49a12 12 0 0 0-17 17Z\"})});};const getCursor=()=>{if(props.srcType===SrcType.URL&&props.srcURL)return\"pointer\";if(props.srcType===SrcType.Upload&&props.srcFile)return\"pointer\";return\"auto\";};const buttonTitle=isInPublishedSiteOrSSG?\"Download File\":\"Publish to Download\";return /*#__PURE__*/ _jsxs(motion.a,{target:\"_blank\",href:downloadURL,download:true,title:buttonTitle,style:{gap,fontSize:16,lineHeight:1,fontFamily:\"Inter\",fontWeight:500,width:\"max-content\",...props.style,...buttonStyles,...props.fontControl,padding:paddingValue,color:color,backgroundColor:backgroundColor,borderRadius:borderRadius,userSelect:\"none\",placeContent:flexAlignSwitch(props.fontControl),whiteSpace:\"nowrap\",cursor:getCursor()},whileHover:hoverOptions,transition:hoverOptions===null||hoverOptions===void 0?void 0:hoverOptions.transition,children:[getIcon(),props.text]});};Download.displayName=\"Download\";addPropertyControls(Download,{text:{title:\"Text\",type:ControlType.String,defaultValue:\"Download\"},srcType:{type:ControlType.Enum,displaySegmentedControl:true,title:\"Source\",options:[SrcType.Upload,SrcType.URL]},srcURL:{type:ControlType.String,title:\" \",placeholder:\"../example.pdf\",hidden:props=>props.srcType===SrcType.Upload},srcFile:{type:ControlType.File,title:\" \",allowedFileTypes:[],hidden:props=>props.srcType===SrcType.URL},fontControl:{// @ts-ignore - Internal\ntype:ControlType.Font,title:\"Font\",controls:\"extended\"},iconOptions:{type:ControlType.Object,optional:true,title:\"Icon\",buttonTitle:\"Size, Color\",controls:{type:{title:\"Type\",type:ControlType.Enum,options:Object.values(IconType),optionTitles:Object.values(IconType),displaySegmentedControl:true},color:{title:\"Color\",type:ControlType.Color,defaultValue:\"#FFF\",hidden:props=>props.type===IconType.Custom},image:{title:\"File\",type:ControlType.ResponsiveImage,allowedFileTypes:[\"jpg\",\"png\",\"svg\"],hidden:props=>props.type===IconType.Default},size:{type:ControlType.Number,displayStepper:true,min:5,defaultValue:16,max:250},alignment:{title:\"Align\",type:ControlType.Enum,displaySegmentedControl:true,options:[\"start\",\"end\"],optionTitles:[\"Start\",\"End\"]}}},styleOptions:{type:ControlType.Object,title:\"Styles\",buttonTitle:\"Button, Font\",controls:{backgroundColor:{type:ControlType.Color,title:\"Fill\",defaultValue:\"#111\"},color:{type:ControlType.Color,defaultValue:\"#FFF\"},borderRadius:{type:ControlType.Number,title:\"Radius\",displayStepper:true,defaultValue:50},padding:{title:\"Padding\",type:ControlType.FusedNumber,toggleKey:\"paddingPerSide\",toggleTitles:[\"Padding\",\"Padding per side\"],defaultValue:10,valueKeys:[\"paddingTop\",\"paddingRight\",\"paddingBottom\",\"paddingLeft\",],valueLabels:[\"T\",\"R\",\"B\",\"L\"],min:0},gap:{title:\"Gap\",type:ControlType.Number,displayStepper:true,defaultValue:5}}},hoverOptions:{type:ControlType.Object,title:\"Hover\",buttonTitle:\"Effect\",optional:true,controls:{scale:{type:ControlType.Number,title:\"Scale\",min:0,max:10,displayStepper:true,step:.01,defaultValue:1.1},backgroundColor:{type:ControlType.Color,title:\"Fill\",defaultValue:\"#333\",optional:true},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#FFF\",optional:true},transition:{type:ControlType.Transition,title:\"Transition\",defaultValue:{type:\"spring\",stiffness:400,damping:30}}}}});const buttonStyles={display:\"flex\",placeItems:\"center\",placeContent:\"center\",textDecoration:\"none\"};/* Match flex content alignment with text align */ const flexAlignSwitch=fontControlStyles=>{if(!(fontControlStyles===null||fontControlStyles===void 0?void 0:fontControlStyles.textAlign)){return\"left\";}if(fontControlStyles.textAlign===\"left\"){return\"flex-start\";}if(fontControlStyles.textAlign===\"right\"){return\"flex-end\";}return\"center\";};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Download\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"100\",\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"*\",\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\",\"framerIntrinsicWidth\":\"200\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Download.map"],"mappings":"wTAGA,SAAS,GAAsB,CAAC,UAAU,SAAW,IAAY,OAAO,EAAK,IAAM,EAAQ,SAAS,cAAc,EAAgB,CAAC,QAAQ,CAAS,CAYhJ,SAAwB,EAAS,EAAM,CAAC,GAAK,CAAC,eAAa,eAAa,cAAY,CAAC,EAAW,CAAC,kBAAgB,QAAM,eAAa,UAAQ,iBAAe,aAAW,eAAa,gBAAc,cAAY,MAAI,CAAC,EAAmB,EAAuB,GAAsB,CAAK,EAAsB,AAAG,IAA2B,EAAM,UAAU,EAAQ,MAAI,EAAY,EAAM,QAAU,EAAM,UAAU,EAAQ,SAAO,EAAY,EAAM,cAAe,EAAa,KAAkB,EAAW,KAAK,EAAa,KAAK,EAAc,KAAK,EAAY,OAAO,EAAQ,IAAU,EAAQ,IAAI,CAAC,IAAI,EAAI,EAAK,IAAI,EAAY,OAAO,IAAM,EAAU,CAAC,MAAM,EAAY,YAAY,QAAQ,EAAE,EAAE,WAAW,CAAE,EAAC,OAAO,EAAY,OAAO,EAAS,SAAY,EAAI,EAAY,QAAuC,IAAmB,EAAK,MAAM,CAAC,MAAM,EAAU,KAAM,EAAK,EAAY,QAAyC,KAAM,EA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