{"version":3,"file":"FontHoverText.C1Ip9CNJ.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/Hd3fuAHswN6SJwxZMapZ/rByg9jUy1sWSWKFfBt8O/FontHoverText.js"],"sourcesContent":["// Text that changes font letter by letter on hover\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function FontHoverText(props){const{text=\"Hover over me\",defaultFont,hoverFont,textColor,hoverColor,transitionDuration,staggerDelay,useAlexBrush,hoverDelay}=props;const[hoveredIndices,setHoveredIndices]=useState(new Set);const timeoutRefs=useRef(new Map);const handleMouseEnter=index=>{// Clear any existing timeout for this letter\nconst existingTimeout=timeoutRefs.current.get(index);if(existingTimeout){clearTimeout(existingTimeout);timeoutRefs.current.delete(index);}setHoveredIndices(prev=>new Set(prev).add(index));};const handleMouseLeave=index=>{// Set a timeout to remove the hover state after the delay\nconst timeoutId=setTimeout(()=>{setHoveredIndices(prev=>{const newSet=new Set(prev);newSet.delete(index);return newSet;});timeoutRefs.current.delete(index);},hoverDelay);timeoutRefs.current.set(index,timeoutId);};return /*#__PURE__*/_jsxs(\"div\",{style:{...props.style,position:\"relative\",display:\"inline-flex\",width:\"max-content\"},children:[useAlexBrush&&/*#__PURE__*/_jsx(\"link\",{href:\"https://fonts.googleapis.com/css2?family=Alex+Brush&display=swap\",rel:\"stylesheet\"}),text.split(\"\").map((char,index)=>{const isHovered=hoveredIndices.has(index);const isSpace=char===\" \";return /*#__PURE__*/_jsx(\"span\",{onMouseEnter:()=>handleMouseEnter(index),onMouseLeave:()=>handleMouseLeave(index),style:{display:\"inline-block\",cursor:\"default\",transition:`all ${transitionDuration}ms ease`,transitionDelay:`${index*staggerDelay}ms`,color:isHovered?hoverColor:textColor,...isHovered?hoverFont:defaultFont,...isHovered&&useAlexBrush?{fontFamily:\"Alex Brush, cursive\"}:{},minWidth:isSpace?\"0.3em\":\"auto\"},children:isSpace?\"\\xa0\":char},index);})]});}addPropertyControls(FontHoverText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Hover over me\"},defaultFont:{type:ControlType.Font,title:\"Default Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"40px\",variant:\"Regular\",letterSpacing:\"-0.02em\",lineHeight:\"1em\"}},hoverFont:{type:ControlType.Font,title:\"Hover Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"40px\",variant:\"Bold\",letterSpacing:\"-0.04em\",lineHeight:\"1em\"}},useAlexBrush:{type:ControlType.Boolean,title:\"Use Alex Brush\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},hoverColor:{type:ControlType.Color,title:\"Hover Color\",defaultValue:\"#0099FF\"},transitionDuration:{type:ControlType.Number,title:\"Duration\",defaultValue:300,min:0,max:1e3,step:50,unit:\"ms\"},staggerDelay:{type:ControlType.Number,title:\"Stagger\",defaultValue:0,min:0,max:100,step:10,unit:\"ms\"},hoverDelay:{type:ControlType.Number,title:\"Hover Delay\",defaultValue:2e3,min:0,max:5e3,step:100,unit:\"ms\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FontHoverText\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FontHoverText.map"],"mappings":"wLAIG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,OAAK,gBAAgB,cAAY,YAAU,YAAU,aAAW,qBAAmB,eAAa,eAAa,cAAY,EAAW,CAAC,EAAe,GAAmBA,EAAS,IAAI,GAAG,EAAQ,EAAYC,EAAO,IAAI,GAAG,EAAQ,EAAi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