{"version":3,"file":"RotatedText.BJ1jd5CX.mjs","names":["useRef","useState"],"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":"0LAOG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,OAAK,OAAK,QAAM,WAAS,gBAAc,UAAQ,IAAI,SAAO,EAAY,EAAQA,EAAO,IAAI,EAAQ,EAAaA,EAAO,IAAI,EAAO,CAAC,EAAW,GAAeC,EAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAO,CAAC,EAAM,GAAUA,EAAS,CAAC,EAAE,MAAc,CAAK,EAAQ,cAAqC,CAAC,GAAG,CAAC,EAAQ,QAAQ,OAAO,IAAM,EAAS,SAAS,cAAc,MAAM,EAAE,EAAS,MAAM,SAAS,WAAW,EAAS,MAAM,WAAW,SAAS,EAAS,MAAM,WAAW,SAAS,EAAS,MAAM,WAAW,EAAK,YAAY,QAAQ,EAAS,MAAM,SAAS,OAAO,EAAK,UAAU,MAAM,EAAE,EAAS,MAAM,WAAW,OAAO,EAAK,YAAY,KAAK,EAAE,EAAS,MAAM,WAAW,OAAO,EAAK,YAAY,KAAK,EAAE,EAAS,MAAM,cAAc,OAAO,EAAK,eAAe,GAAG,EAAE,EAAS,MAAM,UAAU,EAAK,WAAW,SAAS,EAAS,MAAM,cAAc,EAAc,EAAS,YAAY,EAAK,SAAS,KAAK,YAAY,CAAQ,EAAE,IAAM,EAAU,EAAS,YAAkB,EAAW,EAAS,aAAa,SAAS,KAAK,YAAY,CAAQ,EAAE,MAAoB,CAAC,EAAc,CAAC,MAAM,EAAW,OAAO,CAAS,CAAC,CAAE,CAAC,CAAE,EAAE,CAAY,CAAE,EAAE,CAAC,EAAK,EA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