@wallarm-org/design-system 1.29.0 → 1.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -208,6 +208,7 @@
208
208
  --color-component-logo-wordmark-alt: var(--color-white);
209
209
  --color-component-kbi-tooltip-bg: --alpha(var(--color-white) / 20%);
210
210
  --color-component-dialog-overlay: --alpha(var(--color-white) / 60%);
211
+ --color-component-avatar-overlay: --alpha(var(--color-white) / 80%);
211
212
  --color-component-code-snippet-bg: --alpha(var(--color-slate-500) / 6%);
212
213
  --color-component-toast-bg: var(--color-slate-800);
213
214
  --color-component-toast-ic-destructive: var(--color-red-400);
@@ -659,6 +660,7 @@
659
660
  --color-component-logo-wordmark-alt: var(--color-slate-950);
660
661
  --color-component-kbi-tooltip-bg: --alpha(var(--color-slate-950) / 20%);
661
662
  --color-component-dialog-overlay: --alpha(var(--color-slate-950) / 60%);
663
+ --color-component-avatar-overlay: --alpha(var(--color-slate-950) / 80%);
662
664
  --color-component-code-snippet-bg: --alpha(var(--color-slate-300) / 12%);
663
665
  --color-component-toast-bg: var(--color-slate-100);
664
666
  --color-component-toast-ic-destructive: var(--color-red-600);
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Avatar initials: the first letter of the first and of the last word that has a letter,
3
+ * upper-cased. '' when the name has no letter, so the fallback shows its icon.
4
+ */
5
+ export declare const getInitials: (name: string) => string;
@@ -0,0 +1,13 @@
1
+ const segmenter = "u" > typeof Intl && 'Segmenter' in Intl ? new Intl.Segmenter(void 0, {
2
+ granularity: 'grapheme'
3
+ }) : void 0;
4
+ const LETTER = /^\p{L}/u;
5
+ const graphemes = (word)=>segmenter ? Array.from(segmenter.segment(word), (s)=>s.segment) : Array.from(word);
6
+ const firstLetter = (word)=>graphemes(word).find((g)=>LETTER.test(g)) ?? '';
7
+ const getInitials = (name)=>{
8
+ const letters = name.trim().split(/\s+/).map(firstLetter).filter((letter)=>'' !== letter);
9
+ const first = letters.at(0) ?? '';
10
+ const last = letters.length > 1 ? letters.at(-1) ?? '' : '';
11
+ return (first + last).toLocaleUpperCase();
12
+ };
13
+ export { getInitials };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wallarm-org/design-system",
3
- "version": "1.29.0",
3
+ "version": "1.30.0",
4
4
  "description": "Core design system library with React components and Storybook documentation",
5
5
  "publishConfig": {
6
6
  "access": "public",