{"version":3,"file":"FontHoverText.BiVI07pJ.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,IAAI,CAAO,EAAYC,EAAO,IAAI,IAAI,CAAO,EAAiB,GA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