{"version":3,"file":"TextCombiner.XTObv0pu.mjs","names":["useMemo"],"sources":["https:/framerusercontent.com/modules/37Bcq4NW1mR7Skp2iSMo/w2klXscbe3sb5JYtxPcY/TextCombiner.js"],"sourcesContent":["// CMS Text Combiner - Enhanced with individual author linking (first + last name slugs)\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useMemo}from\"react\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function TextCombiner(props){const{text1=\"\",text2=\"\",filler1=\" \",textStyle1,textStyle2,fillerTextStyle,textColor,backgroundColor,padding,textAlign,spacing,lineHeight,link1=\"\",link2=\"\",enableAuthorLinks=true,authorBasePath=\"/community\"}=props;// Function to extract first and last name only (ignoring middle initials)\nconst getFirstLastName=fullName=>{const nameParts=fullName.trim().split(/\\s+/);if(nameParts.length>=2){return`${nameParts[0]} ${nameParts[nameParts.length-1]}`;}return fullName;};// Function to create slug following Framer's pattern: first-last name only\nconst createAuthorSlug=authorName=>{const firstLastName=getFirstLastName(authorName);const slug=firstLastName.toLowerCase().trim()// Remove apostrophes and other punctuation\n.replace(/['']/g,\"\")// Remove all non-alphanumeric characters except spaces and hyphens\n.replace(/[^a-z0-9\\s-]/g,\"\")// Replace spaces with hyphens\n.replace(/\\s+/g,\"-\")// Remove multiple consecutive hyphens\n.replace(/-+/g,\"-\")// Remove leading/trailing hyphens\n.replace(/^-+|-+$/g,\"\");return`${authorBasePath}/${slug}`;};// Function to get author link\nconst getAuthorLink=authorName=>{if(!enableAuthorLinks){return link2;}return createAuthorSlug(authorName);};// Function to parse authors and create appropriate links\nconst parseAuthors=authorsText=>{if(!authorsText.trim()){return[{text:authorsText,link:link2,isAuthor:false}];}// Check if text contains commas (multiple authors)\nif(authorsText.includes(\",\")){const authors=authorsText.split(\",\").map(author=>author.trim()).filter(author=>author.length>0);return authors.map((author,index)=>({text:author,link:getAuthorLink(author),isAuthor:true,isLast:index===authors.length-1,firstLastName:getFirstLastName(author)}));}else{// Single author\nreturn[{text:authorsText,link:getAuthorLink(authorsText),isAuthor:true,isLast:true,firstLastName:getFirstLastName(authorsText)}];}};const combinedText=useMemo(()=>{const segments=[];if(text1.trim()){segments.push({text:text1,textStyle:textStyle1,type:\"text\",link:link1,authors:null});}if(text1.trim()&&text2.trim()){segments.push({text:filler1,textStyle:fillerTextStyle,type:\"filler\",link:\"\",authors:null});}if(text2.trim()){segments.push({text:text2,textStyle:textStyle2,type:\"authors\",link:link2,authors:parseAuthors(text2)});}return segments;},[text1,text2,filler1,textStyle1,textStyle2,fillerTextStyle,link1,link2,enableAuthorLinks,authorBasePath]);// Function to process text and prevent orphaned short words\nconst processTextForOrphans=text=>{const words=text.trim().split(/\\s+/);const processedElements=[];for(let i=0;i<words.length;i++){const currentWord=words[i];const nextWord=words[i+1];if(currentWord.length<=2&&nextWord){processedElements.push(/*#__PURE__*/_jsxs(\"span\",{style:{whiteSpace:\"nowrap\"},children:[currentWord,\" \",nextWord]},i));i++;if(i<words.length-1){processedElements.push(\" \");}}else{processedElements.push(currentWord);if(i<words.length-1){processedElements.push(\" \");}}}return processedElements;};const renderAuthors=(authors,textStyle)=>{return authors.map((author,index)=>/*#__PURE__*/_jsxs(\"span\",{children:[/*#__PURE__*/_jsx(\"a\",{href:author.link,style:{...textStyle,color:textColor,lineHeight:\"inherit\",textDecoration:\"none\",cursor:\"pointer\"},title:`Go to: ${author.firstLastName||author.text}`,children:processTextForOrphans(author.text)}),!author.isLast&&/*#__PURE__*/_jsx(\"span\",{style:{...textStyle,color:textColor,lineHeight:\"inherit\"},children:index===authors.length-2?\" and \":\", \"})]},index));};const isFixedWidth=props?.style&&props.style.width===\"100%\";return /*#__PURE__*/_jsx(\"div\",{style:{...props.style,position:\"relative\",backgroundColor,color:textColor,padding,borderRadius:8,...isFixedWidth?{...props?.style}:{width:\"max-content\"},textAlign,lineHeight:`${lineHeight}em`,wordBreak:\"break-word\",overflowWrap:\"break-word\",whiteSpace:\"normal\",hyphens:\"none\",widows:2,orphans:2,wordSpacing:\"0.1em\"},children:combinedText.length>0?combinedText.map((segment,index)=>/*#__PURE__*/_jsxs(\"span\",{children:[segment.type===\"authors\"&&segment.authors?// Render individual author links\n    renderAuthors(segment.authors,segment.textStyle):segment.link?// Regular link for text1 and filler\n    /*#__PURE__*/_jsx(\"a\",{href:segment.link,style:{...segment.textStyle,color:textColor,lineHeight:\"inherit\",textDecoration:\"none\"},children:processTextForOrphans(segment.text)}):// Regular text span\n    /*#__PURE__*/_jsx(\"span\",{style:{...segment.textStyle,color:textColor,lineHeight:\"inherit\"},children:processTextForOrphans(segment.text)}),index<combinedText.length-1&&/*#__PURE__*/_jsx(\"span\",{style:{marginRight:`${spacing}px`},children:\" \"})]},index)):/*#__PURE__*/_jsx(\"span\",{style:{...textStyle1,color:textColor,opacity:.5},children:\"Add text to combine...\"})});}addPropertyControls(TextCombiner,{text1:{type:ControlType.String,title:\"Text 1\",defaultValue:\"Welcome\",placeholder:\"Enter first text...\"},textStyle1:{type:ControlType.Font,title:\"Text 1 Font\",defaultValue:{fontSize:\"16px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},link1:{type:ControlType.Link,title:\"Link 1\",defaultValue:\"\"},filler1:{type:ControlType.String,title:\"Filler\",defaultValue:\" by \",placeholder:\"Space between texts\"},text2:{type:ControlType.String,title:\"Authors\",defaultValue:\"Abraham A. Awolich, Jane Smith\",placeholder:\"Enter authors (comma-separated)...\"},textStyle2:{type:ControlType.Font,title:\"Authors Font\",defaultValue:{fontSize:\"16px\",variant:\"Bold\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},link2:{type:ControlType.Link,title:\"Fallback Link 2\",defaultValue:\"\",description:\"Used only when author links are disabled\"},fillerTextStyle:{type:ControlType.Font,title:\"Filler Font\",defaultValue:{fontSize:\"16px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},enableAuthorLinks:{type:ControlType.Boolean,title:\"Enable Author Links\",defaultValue:true,description:\"Automatically create links using first + last name slugs\"},authorBasePath:{type:ControlType.String,title:\"Author Base Path\",defaultValue:\"/community\",placeholder:\"/community\",description:\"Base path for author pages\",hidden:props=>!props.enableAuthorLinks},textAlign:{type:ControlType.Enum,title:\"Text Alignment\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"left\",displaySegmentedControl:true},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:16,min:0,max:50,step:1,unit:\"px\"},spacing:{type:ControlType.Number,title:\"Spacing\",defaultValue:0,min:0,max:20,step:1,unit:\"px\"},lineHeight:{type:ControlType.Number,title:\"Line Height\",defaultValue:1.3,min:.8,max:4,step:.1,unit:\"em\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextCombiner\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextCombiner.map"],"mappings":"iLAIG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,QAAM,GAAG,QAAM,GAAG,UAAQ,IAAI,aAAW,aAAW,kBAAgB,YAAU,kBAAgB,UAAQ,YAAU,UAAQ,aAAW,QAAM,GAAG,QAAM,GAAG,oBAAkB,GAAK,iBAAe,cAAc,EACxP,EAAiB,GAAU,CAAC,IAAM,EAAU,EAAS,KAAK,CAAC,CAAC,MAAM,KAAK,EAAoF,OAA/E,EAAU,QAAQ,EAAS,GAAG,EAAU,GAAG,GAAG,E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