{"version":3,"file":"RotatedText.qQgUEHfa.mjs","names":["useRef","useState","isFixedWidth","isFixedHeight"],"sources":["https:/framerusercontent.com/modules/DHLL6vbvdo5bVdLPQXMe/HgissLsr7GCymgFCJ9U3/RotatedText.js"],"sourcesContent":["// Rotated Text Component\n// Displays a single line of text rotated 90° clockwise\n// Automatically adjusts size to fit rotated text without breaking parent layout\n// Supports dynamic updates to text and font properties\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useRef,useState,startTransition}from\"react\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function RotatedText(props){const{text,font,color,rotation,textTransform,htmlTag=\"p\",style}=props;const textRef=useRef(null);const containerRef=useRef(null);const[dimensions,setDimensions]=useState({width:0,height:0});const[scale,setScale]=useState(1);useEffect(()=>{if(!textRef.current)return;const measureText=()=>{if(!textRef.current)return;const tempSpan=document.createElement(\"span\");tempSpan.style.position=\"absolute\";tempSpan.style.visibility=\"hidden\";tempSpan.style.whiteSpace=\"nowrap\";tempSpan.style.fontFamily=font.fontFamily||\"Inter\";tempSpan.style.fontSize=String(font.fontSize||\"16px\");tempSpan.style.fontWeight=String(font.fontWeight||\"400\");tempSpan.style.lineHeight=String(font.lineHeight||\"1.2\");tempSpan.style.letterSpacing=String(font.letterSpacing||\"0\");tempSpan.style.fontStyle=font.fontStyle||\"normal\";tempSpan.style.textTransform=textTransform;tempSpan.textContent=text;document.body.appendChild(tempSpan);const textWidth=tempSpan.offsetWidth;const textHeight=tempSpan.offsetHeight;document.body.removeChild(tempSpan);startTransition(()=>{setDimensions({width:textHeight,height:textWidth});});};measureText();},[text,font,textTransform]);useEffect(()=>{if(!containerRef.current||dimensions.height===0)return;const updateScale=()=>{if(!containerRef.current)return;const containerHeight=containerRef.current.offsetHeight;const containerWidth=containerRef.current.offsetWidth;const isFixedWidth=style?.width!==\"100%\";const isFixedHeight=style?.height!==\"100%\";let newScale=1;if(!isFixedHeight&&containerHeight>0){newScale=containerHeight/dimensions.height;}else if(!isFixedWidth&&containerWidth>0&&dimensions.width>0){newScale=containerWidth/dimensions.width;}startTransition(()=>{setScale(newScale);});};updateScale();const resizeObserver=new ResizeObserver(updateScale);resizeObserver.observe(containerRef.current);return()=>{resizeObserver.disconnect();};},[dimensions,style?.width,style?.height]);const isFixedWidth=style?.width!==\"100%\";const isFixedHeight=style?.height!==\"100%\";const scaledWidth=dimensions.width*scale;const scaledHeight=dimensions.height*scale;const TextElement=htmlTag;return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...style,position:\"relative\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",overflow:\"visible\",...isFixedWidth&&{width:scaledWidth},...isFixedHeight&&{height:scaledHeight}},children:/*#__PURE__*/_jsx(\"div\",{ref:textRef,style:{position:\"absolute\",top:\"50%\",left:\"50%\",transform:`translate(-50%, -50%) rotate(${rotation}deg) scale(${scale})`,transformOrigin:\"center center\",whiteSpace:\"nowrap\"},children:/*#__PURE__*/_jsx(TextElement,{style:{...font,color,textTransform},children:text})})});}addPropertyControls(RotatedText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Rotated Text\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"16px\",variant:\"Regular\",letterSpacing:\"0em\",lineHeight:\"1.2em\"}},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"},textTransform:{type:ControlType.Enum,title:\"Transform\",defaultValue:\"none\",options:[\"none\",\"uppercase\",\"lowercase\",\"capitalize\"],optionTitles:[\"None\",\"Uppercase\",\"Lowercase\",\"Capitalize\"]},htmlTag:{type:ControlType.Enum,title:\"Tag\",defaultValue:\"p\",options:[\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"p\",\"span\",\"div\"],optionTitles:[\"H1\",\"H2\",\"H3\",\"H4\",\"H5\",\"H6\",\"Paragraph\",\"Span\",\"Div\"]},rotation:{type:ControlType.Number,title:\"Rotation\",defaultValue:90,min:-360,max:360,step:1,unit:\"\\xb0\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RotatedText\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RotatedText.map"],"mappings":"+LAOG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,OAAK,OAAK,QAAM,WAAS,gBAAc,UAAQ,IAAI,SAAO,EAAY,EAAQA,EAAO,KAAK,CAAO,EAAaA,EAAO,KAAK,CAAM,CAAC,EAAW,GAAeC,EAAS,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAM,CAAC,EAAM,GAAUA,EAAS,EAAE,CAAC,MAAc,CAAK,EAAQ,cAAqC,CAAC,GAAG,CAAC,EAAQ,QAAQ,OAAO,IAAM,EAAS,SAAS,cAAc,OAAO,CAAC,EAAS,MAAM,SAAS,WAAW,EAAS,MAAM,WAAW,SAAS,EAAS,MAAM,WAAW,SAAS,EAAS,MAAM,WAAW,EAAK,YAAY,QAAQ,EAAS,MAAM,SAAS,OAAO,EAAK,UAAU,OAAO,CAAC,EAAS,MAAM,WAAW,OAAO,EAAK,YAAY,MAAM,CAAC,EAAS,MAAM,WAAW,OAAO,EAAK,YAAY,MAAM,CAAC,EAAS,MAAM,cAAc,OAAO,EAAK,eAAe,IAAI,CAAC,EAAS,MAAM,UAAU,EAAK,WAAW,SAAS,EAAS,MAAM,cAAc,EAAc,EAAS,YAAY,EAAK,SAAS,KAAK,YAAY,EAAS,CAAC,IAAM,EAAU,EAAS,YAAkB,EAAW,EAAS,aAAa,SAAS,KAAK,YAAY,EAAS,CAAC,MAAoB,CAAC,EAAc,CAAC,MAAM,EAAW,OAAO,EAAU,CAAC,EAAG,IAAgB,EAAG,CAAC,EAAK,EAAK,EAAc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