{"version":3,"file":"RandomTextBox.UwfzZD_o.mjs","names":["useMemo","useState","useRef"],"sources":["https:/framerusercontent.com/modules/cwl2XfsnTIXOFTdRUAhy/XsnpTMNVDo6xG3gSpaG7/RandomTextBox.js"],"sourcesContent":["// Text box that changes content on each load\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useMemo,useEffect,useState,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * RandomTextBox\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function RandomTextBox(props){const{quotes,background,color,font,borderRadius,style,secondaryColor}=props;const selectedQuote=useMemo(()=>{if(!quotes||quotes.length===0)return{quote:\"\",attribution:\"\"};const idx=Math.floor(Math.random()*quotes.length);return quotes[idx];},[]);const{quote,attribution}=selectedQuote;const[quoteFontSize,setQuoteFontSize]=useState(\"2.5rem\");const containerRef=useRef(null);const quoteRef=useRef(null);useEffect(()=>{if(typeof window===\"undefined\"||!containerRef.current||!quoteRef.current)return;const isMobile=window.innerWidth<=600;const baseFontSize=isMobile?1.5:2;const availableWidth=containerRef.current.offsetWidth-20// 10px padding on each side\n;// Find the longest word in the quote\nconst words=quote.split(/\\s+/);const longestWord=words.reduce((a,b)=>a.length>b.length?a:b,\"\");// Create a temporary span to measure the longest word\nconst tempSpan=document.createElement(\"span\");tempSpan.style.position=\"absolute\";tempSpan.style.visibility=\"hidden\";tempSpan.style.fontWeight=\"700\";tempSpan.style.fontStyle=\"italic\";tempSpan.style.letterSpacing=\"-0.04em\";tempSpan.style.textTransform=\"uppercase\";tempSpan.style.fontFamily=\"Poppins, sans-serif\";tempSpan.style.whiteSpace=\"nowrap\";tempSpan.textContent=longestWord;document.body.appendChild(tempSpan);let fontSize=baseFontSize;tempSpan.style.fontSize=`${fontSize}rem`;// Only decrease font size if the longest word doesn't fit\nif(tempSpan.offsetWidth>availableWidth){while(tempSpan.offsetWidth>availableWidth&&fontSize>.5){fontSize-=.1;tempSpan.style.fontSize=`${fontSize}rem`;}}document.body.removeChild(tempSpan);setQuoteFontSize(`${fontSize}rem`);},[quote,style?.width]);return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{...style,background,color,borderRadius,padding:\"20px 10px\",minWidth:120,minHeight:40,display:\"flex\",alignItems:\"flex-start\",justifyContent:\"flex-start\",...font,width:\"100%\",height:\"auto\",boxSizing:\"border-box\"},children:/*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",minWidth:0,textAlign:\"left\"},children:[/*#__PURE__*/_jsxs(\"span\",{ref:quoteRef,style:{fontSize:quoteFontSize,fontWeight:700,fontStyle:\"italic\",letterSpacing:\"-0.04em\",lineHeight:\"1em\",textTransform:\"uppercase\",fontFamily:\"Poppins, sans-serif\",color:\"#FFFFFF\",display:\"block\",marginBottom:32,width:\"100%\",maxWidth:\"100%\",// Prevent word breaking in the middle of words\nwordBreak:\"normal\",overflowWrap:\"normal\",whiteSpace:\"pre-wrap\",// Responsive font size for mobile\n...typeof window!==\"undefined\"&&window.innerWidth<=600?{fontSize:quoteFontSize}:{}},children:[\" \",/*#__PURE__*/_jsx(\"span\",{style:{color:\"#FFFFFF\"},children:'\"'}),/*#__PURE__*/_jsx(\"span\",{style:{color:\"#FFFFFF\"},children:quote}),/*#__PURE__*/_jsx(\"span\",{style:{color:\"#FFFFFF\"},children:'\"'})]}),attribution&&/*#__PURE__*/_jsx(\"div\",{style:{marginTop:8,fontSize:\"1.1rem\",opacity:1,lineHeight:\"1.1em\",letterSpacing:\"0em\",color:// Highlight specific attributions in F74E48\n[\"Managing Director, Cambridge University Press\",\"CEO, Mindora\",\"Chief Marketing Officer\",\"Marketing Director\"].includes(attribution.trim())?\"#F74E48\":secondaryColor,fontFamily:\"Poppins, sans-serif\",textTransform:\"none\",fontWeight:400,// Make attribution text wrap and shrink if needed\nwidth:\"100%\",wordBreak:\"break-word\",overflowWrap:\"break-word\",whiteSpace:\"pre-wrap\"},children:attribution})]})});}addPropertyControls(RandomTextBox,{quotes:{type:ControlType.Array,title:\"Quotes\",control:{type:ControlType.Object,controls:{quote:{type:ControlType.String,title:\"Quote\",displayTextArea:true,defaultValue:\"Enter quote text...\"},attribution:{type:ControlType.String,title:\"Attribution\",defaultValue:\"Enter attribution...\"}}},defaultValue:[{quote:\"Scott was instrumental in putting our customers, service design approaches, and customer experience at the core of our business delivering top and bottom line benefit.\",attribution:\"Managing Director, Cambridge University Press\"},{quote:\"Few individuals possess the rare combination of vision, strategic insight, and facilitation expertise quite like Scott.\",attribution:\"CEO, Mindora\"},{quote:\"Scott was a pivotal force in helping our team achieve absolute clarity on the future of Mindora.\",attribution:\"CEO, Mindora\"},{quote:\"Scott doesn't just facilitate conversations—he elevates them, unlocking new levels of clarity and execution.\",attribution:\"CEO, Mindora\"},{quote:\"He has pioneered the transition of design from a functional step in the marketing process to a key strategic contributor.\",attribution:\"Chief Marketing Officer\"},{quote:\"In my 20 years of working with brands of all sizes I have never worked with a transformative facilitator like Scott.\",attribution:\"Marketing Director\"}]},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},color:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"22px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"}},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:32},secondaryColor:{type:ControlType.Color,title:\"Secondary Color\",defaultValue:\"#CCCCCC\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RandomTextBox\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RandomTextBox.map"],"mappings":"oNAMG,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