{"version":3,"file":"GradientButton.B9M8x1iQ.mjs","names":["useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/6MMyOCOyjAMGJXSOuF0k/O4FDMZ0o5zlc6nFD0HqH/GradientButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useState,startTransition}from\"react\";/** Helper to normalize ControlType.Link into href + target */function resolveLink(link){if(!link)return{};if(typeof link===\"string\"){return{href:link};}// common shapes: { href, target }, { url, openInNewTab }\nconst href=link.href??link.url??\"\";const target=link.target??(link.openInNewTab?\"_blank\":undefined);const rel=target===\"_blank\"?\"noopener noreferrer\":undefined;return{href,target,rel};}// ——— Hunter-Pattern: Published/SSG-Erkennung ———\nconst metaTagSelector='meta[name=\"framer-search-index\"]';function isPublishedSiteOrSSG(){if(typeof document===\"undefined\")return true;const metaTag=document.querySelector(metaTagSelector);return!!metaTag;}export default function GradientButton(props){const{label,backgroundColor,borderGradient,textColor,shadow,font,borderSize,icon,iconPosition,showIcon,borderRadius,enableAnimation,useButtonTag,enableHover,link,style,// NEU:\nsrcType=\"Upload\",srcURL,srcFile,downloadFileName}=props;const[gradientPos,setGradientPos]=useState(0);const[isHovered,setIsHovered]=useState(false);useEffect(()=>{if(!enableAnimation)return;let frame;let running=true;function animate(){if(!running)return;startTransition(()=>setGradientPos(pos=>(pos+1)%200));frame=requestAnimationFrame(animate);}animate();return()=>{running=false;cancelAnimationFrame(frame);};},[enableAnimation]);// Inject keyframes for gradient animation\nuseEffect(()=>{if(typeof window===\"undefined\")return;const styleId=\"gradient-keyframes-style\";if(!document.getElementById(styleId)){const styleEl=document.createElement(\"style\");styleEl.id=styleId;styleEl.innerHTML=`@keyframes gradient {`+`0% { background-position: 0% 50%, 0 0; }`+`50% { background-position: 100% 50%, 0 0; }`+`100% { background-position: 0% 50%, 0 0; }}`;document.head.appendChild(styleEl);}},[]);const commonStyle={...style,width:\"100%\",maxWidth:320,height:style?.height??\"100%\",minHeight:0,padding:\"15px 40px\",borderRadius:borderRadius?`${borderRadius}px`:\"50em\",border:`${borderSize}px solid transparent`,boxShadow:enableHover&&isHovered?\"0px 8px 36px 0px rgba(0,0,0,0.4)\":shadow,display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",fontSize:16,color:textColor,background:`linear-gradient(${backgroundColor}, ${backgroundColor}) padding-box, ${borderGradient} border-box`,backgroundOrigin:\"padding-box, border-box\",backgroundClip:\"padding-box, border-box\",backgroundSize:\"200% 200%\",transition:\"background-position 0.2s, box-shadow 0.2s, filter 0.2s\",backgroundPosition:`${gradientPos}% 50%, 0 0`,cursor:\"pointer\",filter:enableHover&&isHovered?\"brightness(1.08)\":\"none\",...font,animation:enableAnimation?\"gradient 2s ease infinite\":\"none\",textDecoration:\"none\"};const content=/*#__PURE__*/_jsxs(_Fragment,{children:[icon&&showIcon&&iconPosition===\"left\"&&/*#__PURE__*/_jsx(\"span\",{style:{display:\"inline-flex\",marginRight:10},children:icon}),/*#__PURE__*/_jsx(\"span\",{style:{width:\"max-content\",minWidth:\"max-content\"},children:label}),icon&&showIcon&&iconPosition===\"right\"&&/*#__PURE__*/_jsx(\"span\",{style:{display:\"inline-flex\",marginLeft:10},children:icon})]});const eventHandlers={onMouseEnter:()=>setIsHovered(true),onMouseLeave:()=>setIsHovered(false),onFocus:()=>setIsHovered(true),onBlur:()=>setIsHovered(false)};const{href:linkHref,target,rel}=resolveLink(link);// ——— Hunter-Pattern: Nur im Publish/SSG die CMS-URL verwenden ———\nconst published=isPublishedSiteOrSSG();let downloadHref=undefined;if(published){if(srcType===\"URL\"&&srcURL)downloadHref=srcURL;if(srcType===\"Upload\"&&srcFile)downloadHref=srcFile;}// Priorität: downloadHref (CMS File/URL) -> normales linkProp -> Button/Div\nif(downloadHref){return /*#__PURE__*/_jsx(\"a\",{href:downloadHref,// Download-Attribut setzt gewünschten Namen (falls Browser/Server zulassen)\ndownload:downloadFileName||undefined,\"aria-label\":label,style:commonStyle,...eventHandlers,onKeyDown:e=>{if(e.key===\" \"){e.preventDefault();e.currentTarget.click();}},onClick:e=>{e.stopPropagation();},children:content});}if(linkHref){return /*#__PURE__*/_jsx(\"a\",{href:linkHref,target:target,rel:rel,\"aria-label\":label,style:commonStyle,...eventHandlers,onKeyDown:e=>{if(e.key===\" \"){e.preventDefault();e.currentTarget.click();}},onClick:e=>e.stopPropagation(),children:content});}if(useButtonTag){return /*#__PURE__*/_jsx(\"button\",{\"aria-label\":label,style:commonStyle,type:\"button\",...eventHandlers,children:content});}return /*#__PURE__*/_jsx(\"div\",{style:commonStyle,role:\"button\",tabIndex:0,\"aria-label\":label,...eventHandlers,onKeyDown:e=>{if(e.key===\" \")e.preventDefault();},children:content});}addPropertyControls(GradientButton,{label:{type:ControlType.String,title:\"Label\",defaultValue:\"Button\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#1F1C35\"},borderGradient:{type:ControlType.String,title:\"Border Gradient\",defaultValue:\"linear-gradient(90deg, #57FFFF 1.39%, #E777FF 33.23%, #FFD89E 66.1%, #59F3FF 100%)\",placeholder:\"CSS gradient...\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#fff\"},shadow:{type:ControlType.String,title:\"Box Shadow\",defaultValue:\"0px 4px 30px 0px rgba(0, 0, 0, 0.3)\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"16px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}},borderSize:{type:ControlType.Number,title:\"Border Size\",defaultValue:2,min:0,max:10,step:1,unit:\"px\"},icon:{type:ControlType.ComponentInstance,title:\"Icon\"},showIcon:{type:ControlType.Boolean,title:\"Show Icon\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},iconPosition:{type:ControlType.Enum,title:\"Icon Position\",options:[\"left\",\"right\"],optionTitles:[\"Left\",\"Right\"],defaultValue:\"left\",hidden:({showIcon})=>!showIcon},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:50,min:0,max:100,step:1,unit:\"px\"},enableAnimation:{type:ControlType.Boolean,title:\"Animation\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},useButtonTag:{type:ControlType.Boolean,title:\"Use Button Tag\",defaultValue:true,enabledTitle:\"Button\",disabledTitle:\"Div\"},enableHover:{type:ControlType.Boolean,title:\"Hover Effect\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},link:{type:ControlType.Link,title:\"Link\"},// ——— NEU: exakt wie im Hunter-Pattern ———\nsrcType:{type:ControlType.Enum,displaySegmentedControl:true,title:\"Source\",options:[\"Upload\",\"URL\"],optionTitles:[\"Upload\",\"URL\"]},srcURL:{type:ControlType.String,title:\" \",placeholder:\"https://…/file.pdf\",hidden:props=>props.srcType===\"Upload\"},srcFile:{type:ControlType.File,title:\" \",allowedFileTypes:[],hidden:props=>props.srcType===\"URL\"},// Optionaler Downloadname\ndownloadFileName:{type:ControlType.String,title:\"Download Name\",placeholder:\"z.B. broschuere.pdf\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"GradientButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GradientButton.map"],"mappings":"uUAAuP,SAAS,EAAY,EAAK,CAAC,GAAG,CAAC,EAAK,MAAM,EAAE,CAAC,GAAG,OAAO,GAAO,SAAU,MAAM,CAAC,KAAK,EAAK,CAChV,IAAM,EAAK,EAAK,MAAM,EAAK,KAAK,GAAS,EAAO,EAAK,SAAS,EAAK,aAAa,SAAS,IAAA,IAAuE,MAAM,CAAC,OAAK,SAAO,IAArE,IAAS,SAAS,sBAAsB,IAAA,GAAiC,CAC9H,SAAS,GAAsB,CAAoG,OAAhG,OAAO,SAAW,IAAmB,GAAiE,CAAC,CAA/C,SAAS,cAAc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