{"version":3,"file":"ResponsiveText.C2P7OFoL.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/AijjhyOh4D5694z7Bel7/N8KMcFOD6xqDc2Xs8jOZ/ResponsiveText.js"],"sourcesContent":["// Responsive text that auto-scales font size to fill container height, width expands with text length, text is editable via prop. Font size is always based on container height, so all instances in a stack row/column match.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useRef,useLayoutEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * ResponsiveText\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight fixed\n */export default function ResponsiveText(props){const{text,font,color,style,minFontSize}=props;const containerRef=useRef(null);const[fontSize,setFontSize]=useState(font?.fontSize?parseFloat(font.fontSize):40);useLayoutEffect(()=>{if(!containerRef.current)return;let frame=null;let lastHeight=0;const resizeFont=()=>{const h=containerRef.current?.offsetHeight||0;if(h&&h!==lastHeight){lastHeight=h;// Use lineHeight from font control to fit text\nlet lineHeight=1;if(font&&font.lineHeight){if(typeof font.lineHeight===\"string\"&&font.lineHeight.endsWith(\"em\")){lineHeight=parseFloat(font.lineHeight);}else if(typeof font.lineHeight===\"number\"){lineHeight=font.lineHeight;}else{lineHeight=Number(font.lineHeight)||1;}}// Prevent division by zero\nif(!lineHeight)lineHeight=1;// Fit fontSize so that fontSize * lineHeight = container height\nstartTransition(()=>setFontSize(h/lineHeight));}};resizeFont();// Use ResizeObserver for robust detection\nlet ro=null;if(typeof window!==\"undefined\"&&window.ResizeObserver){ro=new window.ResizeObserver(resizeFont);ro.observe(containerRef.current);}else{// fallback\nconst check=()=>{resizeFont();frame=window.requestAnimationFrame(check);};frame=window.requestAnimationFrame(check);}return()=>{if(ro)ro.disconnect();if(frame)window.cancelAnimationFrame(frame);};},[font,style?.height]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...style,width:\"max-content\",height:\"100%\",display:\"flex\",alignItems:\"center\",position:\"relative\",overflow:props.overflowVisible?\"visible\":\"hidden\"},children:/*#__PURE__*/_jsx(\"h1\",{style:{...font,fontSize:Math.max(fontSize,minFontSize),color,lineHeight:1,whiteSpace:\"nowrap\",display:\"inline-block\",margin:0},children:text})});}addPropertyControls(ResponsiveText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Responsive Text\"},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"40px\",variant:\"Bold\",letterSpacing:\"-0.04em\",lineHeight:\"1em\"}},overflowVisible:{type:ControlType.Boolean,title:\"Overflow Visible\",defaultValue:false,enabledTitle:\"Visible\",disabledTitle:\"Hidden\"},minFontSize:{type:ControlType.Number,title:\"Min Font Size\",defaultValue:12,min:1,max:200,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ResponsiveText\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ResponsiveText.map"],"mappings":"6MAMG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,OAAK,OAAK,QAAM,QAAM,eAAa,EAAY,EAAaA,EAAO,IAAI,EAAO,CAAC,EAAS,GAAaC,EAAS,GAAM,SAAS,WAAW,EAAK,QAAQ,EAAE,EAAE,EAKY,OALV,MAAoB,CAAC,GAAG,CAAC,EAAa,QAAQ,OAAO,IAAI,EAAM,KAAS,EAAW,EAAQ,MAAe,CAAC,IAAM,EAAE,EAAa,SAAS,cAAc,EAAE,GAAG,GAAG,IAAI,EAAW,CAAC,EAAW,EAC5Y,IAAI,EAAW,EAAK,GAAM,EAAK,aAAY,AAA0L,EAAvL,OAAO,EAAK,YAAa,UAAU,EAAK,WAAW,SAAS,IAAI,EAAc,WAAW,EAAK,U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