@baseplate-dev/project-builder-web
Version:
Web interface for constructing project builder JSON
3 lines (2 loc) • 1.07 kB
JavaScript
import{i as d}from"./_virtual___federation_fn_import-C4el_tlG.js";import{j as o}from"./jsx-runtime-D_zvdyIk.js";import{c as f}from"./index--XHV4ygU.js";function g(e){const t=/([_\s-]*[A-Z]+(?![^\s\-_A-Z])|[_\s-]*[A-Z]*[^\s\-_A-Z]+)/g;return e.match(t)??[]}function a(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-3))}...`}function p(e,t=20){if(e.length<=t)return e;if(e.length<=3)return"...";const n=g(e);if(n.length===1)return a(e,t);const s=n[0],l=(n.at(-1)??"").replace(/^[_\s-]+/,""),c=l.length;if(s.length+c+3>t)return a(e,t);let i=s;for(let r=1;r<n.length-1;r++){const u=n[r].length;if(i.length+u+c+3>t)break;i+=n[r]}return`${i}...${l}`}const{Badge:m}=await d("@baseplate-dev/ui-components");function b({className:e,children:t,type:n}){return o.jsxs("div",{className:f("flex h-8 w-full items-center justify-between gap-4 rounded-md border bg-muted px-3 text-sm",e),children:[o.jsx("div",{children:t}),o.jsx(m,{variant:"outline",className:"text-muted-foreground",children:p(n,20)})]})}export{b as B};
//# sourceMappingURL=badge-with-type-label-D1uJTxZ1.js.map