{"version":3,"file":"RollingTextHover_Prod.qJ0n8yc1.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/FiiQ0BKlVUNzxXjo8hFs/BDeIULpeB9kBv3zq3U1w/RollingTextHover_Prod.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion}from\"framer-motion\";// --- Helper Functions ---\nconst uuidv4=()=>{return\"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g,c=>{const r=Math.random()*16|0;const v=c===\"x\"?r:r&3|8;return v.toString(16);});};// --- Component ---\n/**\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 50\n * @framerDisableUnlink\n */export default function RollingText({text,transition,stagger,reverse,font,color,textTransform,tag,padding}){const[isHovered,setIsHovered]=useState(false);const innerClassName=`rolling-text-inner-${uuidv4()}`;const Tag=tag;const fontSizeStr=font?.fontSize??\"16px\";const letterSpacingStr=font?.letterSpacing??\"0px\";const rawLineHeight=font?.lineHeight;const fontFamily=font?.fontFamily??\"Inter\";const fontSizeNum=parseInt(fontSizeStr,10)||16;let absoluteLineHeightPx;if(typeof rawLineHeight===\"number\"){absoluteLineHeightPx=fontSizeNum*rawLineHeight;}else if(typeof rawLineHeight===\"string\"&&rawLineHeight.includes(\"em\")){const emValue=parseFloat(rawLineHeight)||1.2;absoluteLineHeightPx=fontSizeNum*emValue;}else if(typeof rawLineHeight===\"string\"){const pxValue=parseFloat(rawLineHeight);absoluteLineHeightPx=isNaN(pxValue)?rawLineHeight:`${pxValue}px`;}else{absoluteLineHeightPx=fontSizeNum*1.2;}const absoluteLineHeightStr=typeof absoluteLineHeightPx===\"number\"?`${absoluteLineHeightPx}px`:absoluteLineHeightPx;const yOffset=`-${absoluteLineHeightStr}`;const styles=`\n    .${innerClassName} {\n      --font-size: ${fontSizeStr};\n      --text: ${color};\n      --line-height-abs: ${absoluteLineHeightStr};\n      box-sizing: border-box; margin: 0; padding: 0; vertical-align: top;\n      display: flex; overflow: hidden; width: max-content;\n      font-family: ${fontFamily}; font-size: ${fontSizeStr};\n      text-transform: ${textTransform}; user-select: none;\n      text-shadow: 0 var(--line-height-abs) 0 var(--text);\n    }\n    .${innerClassName} span {\n      display: block; -webkit-backface-visibility: hidden; backface-visibility: hidden;\n      white-space: pre; flex-shrink: 0;\n      font-family: inherit; font-weight: inherit; font-style: inherit;\n      font-size: inherit; letter-spacing: inherit;\n      line-height: ${rawLineHeight??1.2};\n      color: var(--text);\n    }\n  `;const wrapperStyle={display:\"flex\",alignItems:\"center\",justifyContent:\"center\",width:\"100%\",height:\"100%\",overflow:\"hidden\",padding:padding,boxSizing:\"border-box\"};const spanVariants={initial:{y:\"0%\"},hover:{y:yOffset}};const baseDuration=typeof transition?.duration===\"number\"?transition.duration:.5;// Convert stagger percentage (0-100) to a factor (0-1)\nconst staggerFactor=stagger/100;return /*#__PURE__*/_jsxs(\"div\",{style:wrapperStyle,onMouseEnter:()=>setIsHovered(true),onMouseLeave:()=>setIsHovered(false),children:[/*#__PURE__*/_jsx(Tag,{className:innerClassName,children:[...text].map((str,index)=>{const charIndex=reverse?text.length-1-index:index;// Apply staggerFactor to the delay calculation\nconst delay=text.length>0?baseDuration/text.length*charIndex*staggerFactor// Multiply by factor\n:0;const motionSpanStyle={display:\"block\",...font};return /*#__PURE__*/_jsx(motion.span,{variants:spanVariants,initial:\"initial\",animate:isHovered?\"hover\":\"initial\",transition:{...transition,delay:delay},style:motionSpanStyle,children:str===\" \"?\"\\xa0\":str},index);})}),/*#__PURE__*/_jsx(\"style\",{children:styles})]});}// --- Component Display Name ---\nRollingText.displayName=\"Rolling Text\";// --- Default Properties ---\nconst defaultFont={fontFamily:\"Inter\",fontWeight:\"400\",fontSize:\"16px\",fontStyle:\"normal\",letterSpacing:\"0px\",lineHeight:1.2};const defaultTransition={type:\"spring\",duration:.4,bounce:0};// --- Framer Property Controls ---\naddPropertyControls(RollingText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Rolling Text\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultValue:defaultFont},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#808080\"},transition:{type:ControlType.Transition,title:\"Transition\",defaultValue:defaultTransition},// Added Stagger control\nstagger:{title:\"Stagger\",type:ControlType.Number,min:0,max:100,step:1,defaultValue:35,unit:\"%\"},padding:{title:\"Padding\",type:ControlType.Padding,defaultValue:\"0px\"},reverse:{type:ControlType.Boolean,title:\"Reverse\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"},textTransform:{title:\"Transform\",type:ControlType.Enum,defaultValue:\"none\",options:[\"none\",\"uppercase\",\"lowercase\",\"capitalize\"],optionTitles:[\"None\",\"Uppercase\",\"Lowercase\",\"Capitalize\"]},tag:{type:ControlType.Enum,title:\"Tag\",options:[\"p\",\"span\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"],optionTitles:[\"p\",\"span\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"],defaultValue:\"p\",description:\"More components at [Framer University](https://frameruni.link/cc).\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RollingText\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"50\",\"framerDisableUnlink\":\"\",\"framerIntrinsicWidth\":\"200\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RollingTextHover_Prod.map"],"mappings":"yVAMG,SAAwB,EAAY,CAAC,OAAK,aAAW,UAAQ,UAAQ,OAAK,QAAM,gBAAc,MAAI,WAAS,CAAC,GAAK,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAO,EAAe,sBAAsB,GAAQ,GAAS,EAAI,EAAU,EAAY,GAAM,UAAU,OAA8B,GAAM,cAAqB,IAAM,EAAc,GAAM,WAAiB,EAAW,GAAM,YAAY,QAAc,EAA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