{"version":3,"file":"GSAPDirectionAwareButton.1eVtVABE.mjs","names":["React.useRef","React.useCallback"],"sources":["https:/framerusercontent.com/modules/njDR2mbZUoGiKa6RTxhp/UAL9lKthRRrk7uQr7kSP/GSAPDirectionAwareButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";const defaultProps={label:\"Explore Prototype\",link:\"\",widthMode:\"hug\",buttonHeight:58,paddingX:34,radius:999,borderWidth:1.5,borderColor:\"rgba(255, 255, 255, 0.86)\",backgroundColor:\"rgba(0, 0, 0, 0)\",hoverColor:\"rgb(255, 251, 226)\",textColor:\"rgba(255, 255, 255, 0.94)\",hoverTextColor:\"rgb(12, 12, 12)\",fontSize:18,fontWeight:600,animate:true,duration:.42};/**\n * GSAP Direction Aware Button\n *\n * A rounded outline button with a hover fill that enters and exits from\n * the pointer direction, inspired by GSAP-style direction-aware buttons.\n *\n * @framerIntrinsicWidth 220\n * @framerIntrinsicHeight 58\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight fixed\n */export default function GSAPDirectionAwareButton(props){const{label,link,widthMode,buttonHeight,paddingX,radius,borderWidth,borderColor,backgroundColor,hoverColor,textColor,hoverTextColor,fontSize,fontWeight,animate,duration,style}={...defaultProps,...props};const rootRef=React.useRef(null);const fillRef=React.useRef(null);const textRef=React.useRef(null);const gsapRef=React.useRef(null);React.useEffect(()=>{let cancelled=false;async function setup(){if(!animate)return;// @ts-ignore - Framer supports remote runtime imports even when TS cannot resolve URL types.\nconst{gsap}=await import(\"https://esm.sh/gsap@3.12.5\");if(cancelled)return;gsapRef.current=gsap;if(fillRef.current)gsap.set(fillRef.current,{scale:0});}setup();return()=>{cancelled=true;};},[animate]);const positionFill=React.useCallback(event=>{const root=rootRef.current;const fill=fillRef.current;if(!root||!fill)return;const rect=root.getBoundingClientRect();fill.style.left=`${event.clientX-rect.left}px`;fill.style.top=`${event.clientY-rect.top}px`;},[]);const handleEnter=React.useCallback(event=>{positionFill(event);const gsap=gsapRef.current;const fill=fillRef.current;const text=textRef.current;if(!fill||!text)return;if(animate&&gsap){gsap.killTweensOf([fill,text]);gsap.to(fill,{scale:1,duration,ease:\"power3.out\",overwrite:true});gsap.to(text,{color:hoverTextColor,duration:Math.min(duration,.24),ease:\"power2.out\",overwrite:true});}else{fill.style.transform=\"translate(-50%, -50%) scale(1)\";text.style.color=hoverTextColor;}},[animate,duration,hoverTextColor,positionFill]);const handleLeave=React.useCallback(event=>{positionFill(event);const gsap=gsapRef.current;const fill=fillRef.current;const text=textRef.current;if(!fill||!text)return;if(animate&&gsap){gsap.killTweensOf([fill,text]);gsap.to(fill,{scale:0,duration:duration*.8,ease:\"power3.inOut\",overwrite:true});gsap.to(text,{color:textColor,duration:Math.min(duration,.22),ease:\"power2.out\",overwrite:true});}else{fill.style.transform=\"translate(-50%, -50%) scale(0)\";text.style.color=textColor;}},[animate,duration,positionFill,textColor]);return /*#__PURE__*/_jsxs(\"a\",{ref:rootRef,href:link||undefined,\"aria-label\":label,onMouseEnter:handleEnter,onMouseLeave:handleLeave,style:{...style,position:\"relative\",display:\"inline-flex\",width:widthMode===\"fill\"?\"100%\":\"fit-content\",minWidth:0,height:buttonHeight,alignItems:\"center\",justifyContent:\"center\",padding:`0 ${paddingX}px`,borderRadius:radius,border:`${borderWidth}px solid ${borderColor}`,background:backgroundColor,color:textColor,textDecoration:\"none\",overflow:\"hidden\",boxSizing:\"border-box\",cursor:\"pointer\",WebkitTapHighlightColor:\"transparent\"},children:[/*#__PURE__*/_jsx(\"span\",{ref:fillRef,\"aria-hidden\":\"true\",style:{position:\"absolute\",left:\"50%\",top:\"50%\",width:\"230%\",aspectRatio:\"1 / 1\",borderRadius:\"50%\",background:hoverColor,transform:\"translate(-50%, -50%) scale(0)\",transformOrigin:\"center\",pointerEvents:\"none\",zIndex:0}}),/*#__PURE__*/_jsx(\"span\",{ref:textRef,style:{position:\"relative\",zIndex:1,color:textColor,fontFamily:\"Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif\",fontSize,fontWeight,lineHeight:1,letterSpacing:0,whiteSpace:\"nowrap\"},children:label})]});}addPropertyControls(GSAPDirectionAwareButton,{label:{type:ControlType.String,title:\"Label\",defaultValue:defaultProps.label},link:{type:ControlType.Link,title:\"Link\"},widthMode:{type:ControlType.Enum,title:\"Width\",options:[\"hug\",\"fill\"],optionTitles:[\"Hug\",\"Fill\"],defaultValue:defaultProps.widthMode,displaySegmentedControl:true},buttonHeight:{type:ControlType.Number,title:\"Height\",defaultValue:defaultProps.buttonHeight,min:36,max:96,step:1,unit:\"px\"},paddingX:{type:ControlType.Number,title:\"Padding X\",defaultValue:defaultProps.paddingX,min:12,max:80,step:1,unit:\"px\"},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:defaultProps.radius,min:0,max:999,step:1,unit:\"px\"},borderWidth:{type:ControlType.Number,title:\"Border\",defaultValue:defaultProps.borderWidth,min:0,max:6,step:.5,unit:\"px\"},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:defaultProps.borderColor},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:defaultProps.backgroundColor},hoverColor:{type:ControlType.Color,title:\"Hover Fill\",defaultValue:defaultProps.hoverColor},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:defaultProps.textColor},hoverTextColor:{type:ControlType.Color,title:\"Hover Text\",defaultValue:defaultProps.hoverTextColor},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:defaultProps.fontSize,min:12,max:32,step:1,unit:\"px\"},fontWeight:{type:ControlType.Number,title:\"Weight\",defaultValue:defaultProps.fontWeight,min:300,max:900,step:100},animate:{type:ControlType.Boolean,title:\"Animate\",defaultValue:defaultProps.animate,enabledTitle:\"On\",disabledTitle:\"Off\"},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:defaultProps.duration,min:.12,max:1.2,step:.01,hidden:({animate})=>!animate}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"GSAPDirectionAwareButton\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"220\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"58\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GSAPDirectionAwareButton.map"],"mappings":"+LAUG,SAAwB,EAAyB,EAAM,CAAC,GAAK,CAAC,QAAM,OAAK,YAAU,eAAa,WAAS,SAAO,cAAY,cAAY,kBAAgB,aAAW,YAAU,iBAAe,WAAS,aAAW,UAAQ,WAAS,SAAO,CAAC,GAAG,EAAa,GAAG,CAAK,EAAQ,EAAQA,EAAa,IAAI,EAAQ,EAAQA,EAAa,IAAI,EAAQ,EAAQA,EAAa,IAAI,EAAQ,EAAQA,EAAa,IAAI,EAAE,MAAoB,CAAC,IAAI,EAAU,GAAM,eAAe,GAAO,CAAC,GAAG,CAAC,EAAQ,OACtd,GAAK,CAAC,QAAM,MAAM,OAAO,4BAAiC,IAAiB,EAAQ,QAAQ,EAAQ,EAAQ,SAAQ,EAAK,IAAI,EAAQ,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAS,OAAR,EAAM,MAAY,CAAC,EAAU,EAAK,CAAE,EAAE,CAAC,CAAO,CAAC,EAAE,IAAM,EAAaC,EAAkB,GAAO,CAAC,IAAM,EAAK,EAAQ,QAAc,EAAK,EAAQ,QAAQ,GAAG,CAAC,GAAM,CAAC,EAAK,OAAO,IAAM,EAAK,EAAK,sBAAsB,EAAE,EAAK,MAAM,KAAK,GAAG,EAAM,QAAQ,EAAK,KAAK,IAAI,EAAK,MAAM,IAAI,GAAG,EAAM,QAAQ,EAAK,IAAI,GAAI,EAAE,CAAC,CAAC,EAAQ,EAAYA,EAAkB,GAAO,CAAC,EAAa,CAAK,EAAE,IAAM,E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