pixelize-design-library 2.4.1-beta.5 → 2.4.1-beta.6

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.
@@ -38,6 +38,13 @@ export interface OrgSwitcherProps {
38
38
  export declare const AVATAR_COLORS: string[];
39
39
  /** Deterministically pick an avatar color from an org name. */
40
40
  export declare const avatarColor: (seed: string) => string;
41
- /** First letter (uppercased) of an org name, for the fallback avatar. */
41
+ /**
42
+ * Fallback-avatar initials, up to 2 characters. A single letter reads well for one
43
+ * org but collides constantly across a real list — two orgs both starting with
44
+ * "P" render the identical circle, distinguishable only by the hashed color.
45
+ * A multi-word name takes one letter each word ("pixelize default" -> "PD"); a
46
+ * single word takes its own first two letters ("Default1" -> "DE") so a
47
+ * one-word org still gets a distinct-looking mark instead of falling back to one.
48
+ */
42
49
  export declare const orgInitial: (name: string) => string;
43
50
  //# sourceMappingURL=OrgSwitcherProps.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OrgSwitcherProps.d.ts","sourceRoot":"","sources":["../../../src/Components/OrgSwitcher/OrgSwitcherProps.tsx"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,oCAAoC;IACpC,aAAa,EAAE,SAAS,EAAE,CAAC;IAC3B,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,qDAAqD;IACrD,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,K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,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,qDAAqD;IACrD,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,KAAK,IAAI,CAAC;IACxD,+EAA+E;IAC/E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,+DAA+D;IAC/D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,6EAA6E;IAC7E,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;IAChD,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,aAAa,UASzB,CAAC;AAEF,+DAA+D;AAC/D,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,KAAG,MAM1C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,KAAG,MAKzC,CAAC"}
@@ -20,6 +20,20 @@ const avatarColor = (seed) => {
20
20
  return exports.AVATAR_COLORS[Math.abs(hash) % exports.AVATAR_COLORS.length];
21
21
  };
22
22
  exports.avatarColor = avatarColor;
23
- /** First letter (uppercased) of an org name, for the fallback avatar. */
24
- const orgInitial = (name) => { var _a, _b; return ((_b = (_a = name === null || name === void 0 ? void 0 : name.trim()) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : "?").toUpperCase(); };
23
+ /**
24
+ * Fallback-avatar initials, up to 2 characters. A single letter reads well for one
25
+ * org but collides constantly across a real list — two orgs both starting with
26
+ * "P" render the identical circle, distinguishable only by the hashed color.
27
+ * A multi-word name takes one letter each word ("pixelize default" -> "PD"); a
28
+ * single word takes its own first two letters ("Default1" -> "DE") so a
29
+ * one-word org still gets a distinct-looking mark instead of falling back to one.
30
+ */
31
+ const orgInitial = (name) => {
32
+ const words = (name !== null && name !== void 0 ? name : "").trim().split(/\s+/).filter(Boolean);
33
+ if (words.length === 0)
34
+ return "?";
35
+ if (words.length === 1)
36
+ return words[0].slice(0, 2).toUpperCase();
37
+ return (words[0][0] + words[1][0]).toUpperCase();
38
+ };
25
39
  exports.orgInitial = orgInitial;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixelize-design-library",
3
- "version": "2.4.1-beta.5",
3
+ "version": "2.4.1-beta.6",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",