@mittwald/flow-react-components 0.2.0-alpha.831 → 0.2.0-alpha.832

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.
@@ -1,7 +1,14 @@
1
1
  "use client"
2
2
  /* */
3
- const getInitialsFromString = (initials) => {
4
- return initials.replace(/[^\p{L}\s]/giu, "").split(" ").map((part) => part.trim()[0]).filter((p) => p !== void 0).map((char) => char.toUpperCase()).slice(0, 2);
3
+ const getInitialsFromString = (value) => {
4
+ if (!value.trim()) {
5
+ return [];
6
+ }
7
+ return value.trim().split(/\s+/).map((part) => {
8
+ const normalized = part.trim();
9
+ const match = normalized.match(/(\p{Emoji}|\p{L})/u);
10
+ return match ? match[0].toUpperCase() : "";
11
+ }).filter(Boolean).slice(0, 2);
5
12
  };
6
13
 
7
14
  export { getInitialsFromString };
@@ -1 +1 @@
1
- {"version":3,"file":"getInitialsFromString.mjs","sources":["../../../../../../../../src/components/Initials/lib/getInitialsFromString.ts"],"sourcesContent":["export const getInitialsFromString = (initials: string): string[] => {\n return initials\n .replace(/[^\\p{L}\\s]/giu, \"\")\n .split(\" \")\n .map((part) => part.trim()[0])\n .filter((p) => p !== undefined)\n .map((char) => char.toUpperCase())\n .slice(0, 2);\n};\n"],"names":[],"mappings":"AAAO,MAAM,qBAAA,GAAwB,CAAC,QAAA,KAA+B;AACnE,EAAA,OAAO,QAAA,CACJ,OAAA,CAAQ,eAAA,EAAiB,EAAE,EAC3B,KAAA,CAAM,GAAG,CAAA,CACT,GAAA,CAAI,CAAC,IAAA,KAAS,IAAA,CAAK,IAAA,GAAO,CAAC,CAAC,CAAA,CAC5B,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,KAAM,MAAS,EAC7B,GAAA,CAAI,CAAC,IAAA,KAAS,IAAA,CAAK,WAAA,EAAa,CAAA,CAChC,KAAA,CAAM,GAAG,CAAC,CAAA;AACf;;;;"}
1
+ {"version":3,"file":"getInitialsFromString.mjs","sources":["../../../../../../../../src/components/Initials/lib/getInitialsFromString.ts"],"sourcesContent":["export const getInitialsFromString = (value: string): string[] => {\n if (!value.trim()) {\n return [];\n }\n\n return value\n .trim()\n .split(/\\s+/)\n .map((part) => {\n const normalized = part.trim();\n\n const match = normalized.match(/(\\p{Emoji}|\\p{L})/u);\n\n return match ? match[0].toUpperCase() : \"\";\n })\n .filter(Boolean)\n .slice(0, 2);\n};\n"],"names":[],"mappings":"AAAO,MAAM,qBAAA,GAAwB,CAAC,KAAA,KAA4B;AAChE,EAAA,IAAI,CAAC,KAAA,CAAM,IAAA,EAAK,EAAG;AACjB,IAAA,OAAO,EAAC;AAAA,EACV;AAEA,EAAA,OAAO,KAAA,CACJ,MAAK,CACL,KAAA,CAAM,KAAK,CAAA,CACX,GAAA,CAAI,CAAC,IAAA,KAAS;AACb,IAAA,MAAM,UAAA,GAAa,KAAK,IAAA,EAAK;AAE7B,IAAA,MAAM,KAAA,GAAQ,UAAA,CAAW,KAAA,CAAM,oBAAoB,CAAA;AAEnD,IAAA,OAAO,KAAA,GAAQ,KAAA,CAAM,CAAC,CAAA,CAAE,aAAY,GAAI,EAAA;AAAA,EAC1C,CAAC,CAAA,CACA,MAAA,CAAO,OAAO,CAAA,CACd,KAAA,CAAM,GAAG,CAAC,CAAA;AACf;;;;"}
@@ -1,2 +1,2 @@
1
- export declare const getInitialsFromString: (initials: string) => string[];
1
+ export declare const getInitialsFromString: (value: string) => string[];
2
2
  //# sourceMappingURL=getInitialsFromString.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getInitialsFromString.d.ts","sourceRoot":"","sources":["../../../../../src/components/Initials/lib/getInitialsFromString.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,GAAI,UAAU,MAAM,KAAG,MAAM,EAQ9D,CAAC"}
1
+ {"version":3,"file":"getInitialsFromString.d.ts","sourceRoot":"","sources":["../../../../../src/components/Initials/lib/getInitialsFromString.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,GAAI,OAAO,MAAM,KAAG,MAAM,EAiB3D,CAAC"}
@@ -5,4 +5,5 @@ export default meta;
5
5
  type Story = StoryObj<typeof Initials>;
6
6
  export declare const Default: Story;
7
7
  export declare const OneLetter: Story;
8
+ export declare const Emoji: Story;
8
9
  //# sourceMappingURL=Default.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Default.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Initials/stories/Default.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,QAAQ,MAAM,aAAa,CAAC;AAGnC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAO/B,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEvC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,eAAO,MAAM,SAAS,EAAE,KAEvB,CAAC"}
1
+ {"version":3,"file":"Default.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Initials/stories/Default.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,QAAQ,MAAM,aAAa,CAAC;AAKnC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAO/B,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEvC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,eAAO,MAAM,SAAS,EAAE,KAEvB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAQnB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/flow-react-components",
3
- "version": "0.2.0-alpha.831",
3
+ "version": "0.2.0-alpha.832",
4
4
  "type": "module",
5
5
  "description": "A React implementation of Flow, mittwald’s design system",
6
6
  "homepage": "https://mittwald.github.io/flow",
@@ -60,9 +60,9 @@
60
60
  "@codemirror/lint": "^6.9.5",
61
61
  "@internationalized/string": "^3.2.7",
62
62
  "@lezer/highlight": "^1.2.3",
63
- "@mittwald/flow-icons": "0.2.0-alpha.831",
63
+ "@mittwald/flow-icons": "0.2.0-alpha.832",
64
64
  "@mittwald/password-tools-js": "3.0.0-alpha.30",
65
- "@mittwald/react-tunnel": "0.2.0-alpha.831",
65
+ "@mittwald/react-tunnel": "0.2.0-alpha.832",
66
66
  "@mittwald/react-use-promise": "^4.2.2",
67
67
  "@react-aria/form": "^3.1.3",
68
68
  "@react-aria/i18n": "^3.12.16",
@@ -116,7 +116,7 @@
116
116
  "@lezer/generator": "^1.8.0",
117
117
  "@lezer/lr": "^1.4.8",
118
118
  "@mittwald/flow-core": "",
119
- "@mittwald/flow-design-tokens": "0.2.0-alpha.831",
119
+ "@mittwald/flow-design-tokens": "0.2.0-alpha.832",
120
120
  "@mittwald/flow-icons-base": "",
121
121
  "@mittwald/react-use-promise": "^4.2.2",
122
122
  "@mittwald/remote-dom-react": "1.2.2-mittwald.10",
@@ -169,7 +169,7 @@
169
169
  },
170
170
  "peerDependencies": {
171
171
  "@internationalized/date": "^3.10.0",
172
- "@mittwald/flow-icons-pro": "0.2.0-alpha.830",
172
+ "@mittwald/flow-icons-pro": "0.2.0-alpha.831",
173
173
  "@mittwald/react-use-promise": "^4.2.2",
174
174
  "next": "^16.2.3",
175
175
  "react": "^19.2.0",
@@ -190,5 +190,5 @@
190
190
  "optional": true
191
191
  }
192
192
  },
193
- "gitHead": "5f9b835326b4edc2799a7cd2f0c15106cdc5ee45"
193
+ "gitHead": "a517ebfc678e81eed26d551a3cb38372b133c805"
194
194
  }