sate-lib
Version:
A lightweight and modular React component library designed for modern web interfaces. **SATE Lib** powers the [sate.menu](https://sate.menu) platform with reusable, scalable, and themeable UI components.
1 lines • 712 B
JavaScript
import{jsx as e}from"react/jsx-runtime";import r from"./avatar.styles.module.js";function t(e){if(!e)return"";let r=e.trim().replace(/\s+/g," "),t=r.includes(" ")?r.split(" "):r.split(/(?=[A-Z])/);return 0===(t=t.filter(Boolean)).length?"":1===t.length?t[0].substring(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}function a({src:a,alt:l,name:i,size:s="medium",shape:n="circle",border:o=!1,className:m,...c}){return e("div",{"aria-label":l||i,className:[r.root,r[s],r[n],o&&r.border,m].filter(Boolean).join(" "),role:"img",...c,children:i?e("span",{className:`bodyDefaultEmphasis ${r.text}`,children:t(i)}):e("img",{alt:l,className:r.img,draggable:!1,src:a})})}export{a as Avatar,t as getInitials};