{"version":3,"file":"NameTruncate.DspLBRCB.mjs","names":["useMemo"],"sources":["https:/framerusercontent.com/modules/koe4ir1fXPtH4y7X50db/NJNvNx3OcCC0Iq5oSrJi/NameTruncate.js"],"sourcesContent":["// Instructions: Create a Framer component that truncates only the last name (e.g. \"Dan Edwards\" -> \"Dan E.\") instead of using native \"...\" truncation.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useMemo}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function NameTruncate(props){const{fullName,color,font,applyTruncate,truncateWord,nativeTruncate,style}=props;const output=useMemo(()=>{const raw=(fullName??\"\").trim();if(!raw)return\"\";if(!applyTruncate)return raw;const parts=raw.split(/\\s+/).filter(Boolean);if(parts.length===1){return parts[0];}const first=parts[0];const second=parts[1]??\"\";const rest=parts.slice(2).join(\" \");const firstInitial=(first?.trim()?.[0]??\"\").toUpperCase();const secondInitial=(second?.trim()?.[0]??\"\").toUpperCase();if(truncateWord===\"first\"){return`${firstInitial}${firstInitial?\".\":\"\"} ${parts.slice(1).join(\" \")}`.replace(/\\s+/g,\" \").trim();}return`${first} ${secondInitial}${secondInitial?\".\":\"\"}${rest?` ${rest}`:\"\"}`.replace(/\\s+/g,\" \").trim();},[applyTruncate,fullName,truncateWord]);const isFixedWidth=!!style&&style.width===\"100%\";const isFixedHeight=!!style&&style.height===\"100%\";return /*#__PURE__*/_jsx(\"span\",{style:{position:\"relative\",display:isFixedWidth||isFixedHeight?\"block\":\"inline-block\",color,...font,...isFixedWidth?{width:\"100%\"}:{width:\"max-content\",minWidth:\"max-content\"},...isFixedHeight?{height:\"100%\"}:undefined,whiteSpace:\"nowrap\",overflow:\"hidden\",textOverflow:nativeTruncate?\"ellipsis\":\"clip\",...style},\"aria-label\":fullName,title:fullName,children:output});}addPropertyControls(NameTruncate,{fullName:{type:ControlType.String,title:\"Name\",defaultValue:\"Dan Edwards\",placeholder:\"First Last\"},nativeTruncate:{type:ControlType.Boolean,title:\"Native Truncate\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"},applyTruncate:{type:ControlType.Boolean,title:\"Truncate\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},truncateWord:{type:ControlType.Enum,title:\"Truncate\",defaultValue:\"second\",options:[\"second\",\"first\"],optionTitles:[\"2nd word\",\"1st word\"],displaySegmentedControl:true,hidden:({applyTruncate})=>!applyTruncate},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"},font:{type:ControlType.Font,title:\"Text Style\",description:\"In this control you can pick a project Text Style from the Styles dropdown, or customize the font manually.\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"NameTruncate\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./NameTruncate.map"],"mappings":"0KAIG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,WAAS,QAAM,OAAK,gBAAc,eAAa,iBAAe,SAAO,EAAY,EAAOA,MAAY,CAAC,IAAM,GAAK,GAAU,IAAI,MAAM,CAAC,GAAG,CAAC,EAAI,MAAM,GAAG,GAAG,CAAC,EAAc,OAAO,EAAI,IAAM,EAAM,EAAI,MAAM,MAAM,CAAC,OAAO,QAAQ,CAAC,GAAG,EAAM,SAAS,EAAG,OAAO,EAAM,GAAI,IAAM,EAAM,EAAM,GAAS,EAAO,EAAM,IAAI,GAAS,EAAK,EAAM,MAAM,EAAE,CAAC,KAAK,IAAI,CAAO,GAAc,GAAO,MAAM,GAAG,IAAI,IAAI,aAAa,CAAO,GAAe,GAAQ,MAAM,GAAG,IAAI,IAAI,a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