{"version":3,"file":"FlexibleButton.CgLyGy65.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/JKKNq0HMmZfl8y3AczeJ/dugpMIdNPB0GOxqg76kz/FlexibleButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState}from\"react\";import{addPropertyControls,ControlType,useRouter}from\"framer\";// ----- Helper: Get the route id from a path -----\nfunction getRouteId(allRoutes,path){for(const[key,value]of Object.entries(allRoutes)){if(value?.path===path){return key;}}return\"\";}export function FlexibleButton(props){const{buttonColor,textColor,hoverColor,hoverAnimation,linkDestination,rounded,label,outlined,hoverTextColor,width,height}=props;const[hovered,setHovered]=useState(false);const{navigate,routes}=useRouter();// Use the hoverTextColor if provided when hovered.\nconst currentTextColor=hovered&&hoverTextColor?hoverTextColor:textColor;// The container style is now set to \"overflow: hidden\" so that the overlay doesn't show outside.\nconst containerStyle={position:\"relative\",display:\"inline-block\",textDecoration:\"none\",cursor:\"pointer\",userSelect:\"none\",padding:\"10px 30px\",fontSize:\"16px\",borderRadius:rounded?\"10px\":\"0px\",border:outlined?`2px solid ${textColor}`:\"none\",backgroundColor:outlined?\"transparent\":buttonColor,color:currentTextColor,overflow:\"hidden\",transition:\"background-color 0.5s ease-in-out, color 0.5s ease-in-out\"};// Base style for the overlay that will animate in on hover.\nconst overlayStyleBase={position:\"absolute\",top:0,left:0,right:0,bottom:0,backgroundColor:hoverColor,borderRadius:rounded?\"10px\":\"0px\",zIndex:1,pointerEvents:\"none\",transition:\"all 0.5s ease-in-out\"};let overlayStyle={};if(hoverAnimation===\"fadeIn\"){overlayStyle={...overlayStyleBase,opacity:hovered?1:0,transform:\"none\"};}else if(hoverAnimation===\"easeFromBottom\"){overlayStyle={...overlayStyleBase,opacity:1,transform:hovered?\"translateY(0%)\":\"translateY(100%)\"};}else if(hoverAnimation===\"easeFromLeft\"){overlayStyle={...overlayStyleBase,opacity:1,transform:hovered?\"translateX(0%)\":\"translateX(-100%)\"};}// Render as an <a> element if a link is provided; otherwise, use a <div>.\nconst Element=linkDestination&&linkDestination.trim()!==\"\"?\"a\":\"div\";// If this is a link, we intercept clicks and navigate via Framer’s router.\nconst handleClick=e=>{e.preventDefault();let routeId=getRouteId(routes,linkDestination);if(routeId===\"\"){routeId=getRouteId(routes,\"/\");}navigate(routeId,\"\");};return /*#__PURE__*/_jsxs(Element,{href:Element===\"a\"?linkDestination:undefined,style:containerStyle,onMouseEnter:()=>setHovered(true),onMouseLeave:()=>setHovered(false),onClick:Element===\"a\"?handleClick:undefined,children:[/*#__PURE__*/_jsx(\"div\",{style:overlayStyle}),/*#__PURE__*/_jsx(\"span\",{style:{position:\"relative\",zIndex:2,whiteSpace:\"nowrap\"},children:label})]});}FlexibleButton.defaultProps={buttonColor:\"#007AFF\",textColor:\"#FFFFFF\",hoverColor:\"#005BBB\",hoverAnimation:\"fadeIn\",linkDestination:\"\",rounded:true,label:\"Button\",outlined:false,hoverTextColor:\"\",width:200,height:50};addPropertyControls(FlexibleButton,{buttonColor:{type:ControlType.Color,title:\"Button Color\",defaultValue:\"#007AFF\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#FFFFFF\"},hoverColor:{type:ControlType.Color,title:\"Hover Color\",defaultValue:\"#005BBB\"},hoverAnimation:{type:ControlType.Enum,title:\"Hover Animation\",options:[\"easeFromBottom\",\"easeFromLeft\",\"fadeIn\"],optionTitles:[\"Ease from Bottom\",\"Ease from Left\",\"Fade In\"],defaultValue:\"fadeIn\"},hoverTextColor:{type:ControlType.Color,title:\"Hover Text Color\",defaultValue:\"\"},linkDestination:{type:ControlType.Link,title:\"Link Destination\"},outlined:{type:ControlType.Boolean,title:\"Outlined\",defaultValue:false},rounded:{type:ControlType.Boolean,title:\"Rounded Corners\",defaultValue:true},label:{type:ControlType.String,title:\"Label\",defaultValue:\"Button\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"FlexibleButton\":{\"type\":\"reactComponent\",\"name\":\"FlexibleButton\",\"slots\":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