@undefine-ui/design-system 3.10.1 → 3.10.2

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.
package/dist/index.cjs CHANGED
@@ -603,9 +603,12 @@ var fData = (inputValue) => {
603
603
 
604
604
  // src/libs/fullname-utils.ts
605
605
  var getInitials = (name) => {
606
- const names = name?.split(" ");
607
- const initials = names?.map((n) => n.charAt(0)?.toUpperCase())?.join("");
608
- return initials;
606
+ if (!name?.trim()) return "CN";
607
+ const words = name.trim().split(/\s+/);
608
+ if (words.length === 1) {
609
+ return words[0].slice(0, 2).toUpperCase();
610
+ }
611
+ return words.slice(0, 2).map((word) => word.charAt(0).toUpperCase()).join("");
609
612
  };
610
613
  var splitFullname = (name) => {
611
614
  if (!name) {