@transferwise/components 0.0.0-experimental-76038dc → 0.0.0-experimental-5c9e189

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,6 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  function getInitials(name) {
4
+ if (name.length === 2 && /^[A-Z]{2}$/.test(name)) {
5
+ return name;
6
+ }
4
7
  const allInitials = name.split(' ').map(part => part[0]).join('').toUpperCase();
5
8
  if (allInitials.length === 1) {
6
9
  return allInitials[0];
@@ -1 +1 @@
1
- {"version":3,"file":"initials.js","sources":["../../src/common/initials.ts"],"sourcesContent":["export function getInitials(name: string) {\n const allInitials = name\n .split(' ')\n .map((part) => part[0])\n .join('')\n .toUpperCase();\n\n if (allInitials.length === 1) {\n return allInitials[0];\n }\n\n return allInitials[0] + allInitials.slice(-1);\n}\n"],"names":["getInitials","name","allInitials","split","map","part","join","toUpperCase","length","slice"],"mappings":";;AAAM,SAAUA,WAAWA,CAACC,IAAY,EAAA;EACtC,MAAMC,WAAW,GAAGD,IAAI,CACrBE,KAAK,CAAC,GAAG,CAAC,CACVC,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAAC,CAAC,CAAC,CAAC,CACtBC,IAAI,CAAC,EAAE,CAAC,CACRC,WAAW,EAAE;AAEhB,EAAA,IAAIL,WAAW,CAACM,MAAM,KAAK,CAAC,EAAE;IAC5B,OAAON,WAAW,CAAC,CAAC,CAAC;AACvB;EAEA,OAAOA,WAAW,CAAC,CAAC,CAAC,GAAGA,WAAW,CAACO,KAAK,CAAC,EAAE,CAAC;AAC/C;;;;"}
1
+ {"version":3,"file":"initials.js","sources":["../../src/common/initials.ts"],"sourcesContent":["export function getInitials(name: string) {\n if (name.length === 2 && /^[A-Z]{2}$/.test(name)) {\n return name;\n }\n\n const allInitials = name\n .split(' ')\n .map((part) => part[0])\n .join('')\n .toUpperCase();\n\n if (allInitials.length === 1) {\n return allInitials[0];\n }\n\n return allInitials[0] + allInitials.slice(-1);\n}\n"],"names":["getInitials","name","length","test","allInitials","split","map","part","join","toUpperCase","slice"],"mappings":";;AAAM,SAAUA,WAAWA,CAACC,IAAY,EAAA;AACtC,EAAA,IAAIA,IAAI,CAACC,MAAM,KAAK,CAAC,IAAI,YAAY,CAACC,IAAI,CAACF,IAAI,CAAC,EAAE;AAChD,IAAA,OAAOA,IAAI;AACb;EAEA,MAAMG,WAAW,GAAGH,IAAI,CACrBI,KAAK,CAAC,GAAG,CAAC,CACVC,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAAC,CAAC,CAAC,CAAC,CACtBC,IAAI,CAAC,EAAE,CAAC,CACRC,WAAW,EAAE;AAEhB,EAAA,IAAIL,WAAW,CAACF,MAAM,KAAK,CAAC,EAAE;IAC5B,OAAOE,WAAW,CAAC,CAAC,CAAC;AACvB;EAEA,OAAOA,WAAW,CAAC,CAAC,CAAC,GAAGA,WAAW,CAACM,KAAK,CAAC,EAAE,CAAC;AAC/C;;;;"}
@@ -1,4 +1,7 @@
1
1
  function getInitials(name) {
2
+ if (name.length === 2 && /^[A-Z]{2}$/.test(name)) {
3
+ return name;
4
+ }
2
5
  const allInitials = name.split(' ').map(part => part[0]).join('').toUpperCase();
3
6
  if (allInitials.length === 1) {
4
7
  return allInitials[0];
@@ -1 +1 @@
1
- {"version":3,"file":"initials.mjs","sources":["../../src/common/initials.ts"],"sourcesContent":["export function getInitials(name: string) {\n const allInitials = name\n .split(' ')\n .map((part) => part[0])\n .join('')\n .toUpperCase();\n\n if (allInitials.length === 1) {\n return allInitials[0];\n }\n\n return allInitials[0] + allInitials.slice(-1);\n}\n"],"names":["getInitials","name","allInitials","split","map","part","join","toUpperCase","length","slice"],"mappings":"AAAM,SAAUA,WAAWA,CAACC,IAAY,EAAA;EACtC,MAAMC,WAAW,GAAGD,IAAI,CACrBE,KAAK,CAAC,GAAG,CAAC,CACVC,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAAC,CAAC,CAAC,CAAC,CACtBC,IAAI,CAAC,EAAE,CAAC,CACRC,WAAW,EAAE;AAEhB,EAAA,IAAIL,WAAW,CAACM,MAAM,KAAK,CAAC,EAAE;IAC5B,OAAON,WAAW,CAAC,CAAC,CAAC;AACvB;EAEA,OAAOA,WAAW,CAAC,CAAC,CAAC,GAAGA,WAAW,CAACO,KAAK,CAAC,EAAE,CAAC;AAC/C;;;;"}
1
+ {"version":3,"file":"initials.mjs","sources":["../../src/common/initials.ts"],"sourcesContent":["export function getInitials(name: string) {\n if (name.length === 2 && /^[A-Z]{2}$/.test(name)) {\n return name;\n }\n\n const allInitials = name\n .split(' ')\n .map((part) => part[0])\n .join('')\n .toUpperCase();\n\n if (allInitials.length === 1) {\n return allInitials[0];\n }\n\n return allInitials[0] + allInitials.slice(-1);\n}\n"],"names":["getInitials","name","length","test","allInitials","split","map","part","join","toUpperCase","slice"],"mappings":"AAAM,SAAUA,WAAWA,CAACC,IAAY,EAAA;AACtC,EAAA,IAAIA,IAAI,CAACC,MAAM,KAAK,CAAC,IAAI,YAAY,CAACC,IAAI,CAACF,IAAI,CAAC,EAAE;AAChD,IAAA,OAAOA,IAAI;AACb;EAEA,MAAMG,WAAW,GAAGH,IAAI,CACrBI,KAAK,CAAC,GAAG,CAAC,CACVC,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAAC,CAAC,CAAC,CAAC,CACtBC,IAAI,CAAC,EAAE,CAAC,CACRC,WAAW,EAAE;AAEhB,EAAA,IAAIL,WAAW,CAACF,MAAM,KAAK,CAAC,EAAE;IAC5B,OAAOE,WAAW,CAAC,CAAC,CAAC;AACvB;EAEA,OAAOA,WAAW,CAAC,CAAC,CAAC,GAAGA,WAAW,CAACM,KAAK,CAAC,EAAE,CAAC;AAC/C;;;;"}
package/build/main.css CHANGED
@@ -5978,6 +5978,9 @@ html:not([dir="rtl"]) .np-navigation-option {
5978
5978
  .upload-error-message .alert {
5979
5979
  min-width: 100px;
5980
5980
  }
5981
+ .np-theme-personal .droppable-dropping .droppable-complete-card {
5982
+ display: none;
5983
+ }
5981
5984
  .np-upload-input__upload-button {
5982
5985
  position: relative;
5983
5986
  padding: 16px;
@@ -5978,6 +5978,9 @@ html:not([dir="rtl"]) .np-navigation-option {
5978
5978
  .upload-error-message .alert {
5979
5979
  min-width: 100px;
5980
5980
  }
5981
+ .np-theme-personal .droppable-dropping .droppable-complete-card {
5982
+ display: none;
5983
+ }
5981
5984
  .np-upload-input__upload-button {
5982
5985
  position: relative;
5983
5986
  padding: 16px;
@@ -29,3 +29,6 @@
29
29
  .upload-error-message .alert {
30
30
  min-width: 100px;
31
31
  }
32
+ .np-theme-personal .droppable-dropping .droppable-complete-card {
33
+ display: none;
34
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"initials.d.ts","sourceRoot":"","sources":["../../../src/common/initials.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,UAYvC"}
1
+ {"version":3,"file":"initials.d.ts","sourceRoot":"","sources":["../../../src/common/initials.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,UAgBvC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "0.0.0-experimental-76038dc",
3
+ "version": "0.0.0-experimental-5c9e189",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -80,7 +80,7 @@
80
80
  "@types/react": "^18.3.11",
81
81
  "@types/react-dom": "^18.3.1",
82
82
  "@types/react-transition-group": "4.4.12",
83
- "@wise/art": "2.21.1-beta.1",
83
+ "@wise/art": "^2.21.1",
84
84
  "@wise/eslint-config": "^12.3.0",
85
85
  "babel-plugin-formatjs": "^10.5.38",
86
86
  "enzyme": "^3.11.0",
@@ -94,16 +94,16 @@
94
94
  "rollup": "^4.41.1",
95
95
  "rollup-preserve-directives": "^1.1.3",
96
96
  "storybook": "^8.6.14",
97
- "@transferwise/less-config": "0.0.0-experimental-76038dc",
97
+ "@transferwise/less-config": "0.0.0-experimental-5c9e189",
98
98
  "@transferwise/neptune-css": "14.24.4",
99
- "@wise/components-theming": "0.0.0-experimental-76038dc",
99
+ "@wise/components-theming": "0.0.0-experimental-5c9e189",
100
100
  "@wise/wds-configs": "0.0.0"
101
101
  },
102
102
  "peerDependencies": {
103
103
  "@transferwise/icons": "^3.22.0",
104
104
  "@transferwise/neptune-css": "^14.24",
105
- "@wise/art": "2.21.1-beta.1",
106
- "@wise/components-theming": "0.0.0-experimental-76038dc",
105
+ "@wise/art": "^2.21",
106
+ "@wise/components-theming": "0.0.0-experimental-5c9e189",
107
107
  "react": ">=18",
108
108
  "react-dom": ">=18",
109
109
  "react-intl": "^5.10.0 || ^6"
@@ -117,7 +117,7 @@
117
117
  "@react-aria/overlays": "^3.27.1",
118
118
  "@react-spring/web": "~10.0.1",
119
119
  "@transferwise/formatting": "^2.13.1",
120
- "@transferwise/neptune-validation": "0.0.0-experimental-76038dc",
120
+ "@transferwise/neptune-validation": "0.0.0-experimental-5c9e189",
121
121
  "clsx": "^2.1.1",
122
122
  "commonmark": "^0.31.2",
123
123
  "core-js": "^3.42.0",
@@ -0,0 +1,42 @@
1
+ import { getInitials } from './initials';
2
+
3
+ describe('getInitials', () => {
4
+ it('returns both letters if input is exactly two uppercase letters', () => {
5
+ expect(getInitials('ML')).toBe('ML');
6
+ expect(getInitials('JS')).toBe('JS');
7
+ });
8
+
9
+ it('returns one letter if input is exactly two letters and either letter is lowercase', () => {
10
+ expect(getInitials('Na')).toBe('N');
11
+ expect(getInitials('aa')).toBe('A');
12
+ });
13
+
14
+ it('returns first letter if only one word is given', () => {
15
+ expect(getInitials('Anton')).toBe('A');
16
+ expect(getInitials('richard')).toBe('R');
17
+ });
18
+
19
+ it('returns first and last initials for multi-word names', () => {
20
+ expect(getInitials('Ness Grixti')).toBe('NG');
21
+ expect(getInitials('João Goão Cevada')).toBe('JC');
22
+ expect(getInitials('Caio Kaio Erio Orio')).toBe('CO');
23
+ });
24
+
25
+ it('handles lowercase and mixed case names', () => {
26
+ expect(getInitials('ilya puchka')).toBe('IP');
27
+ expect(getInitials('ilYa pUchka')).toBe('IP');
28
+ });
29
+
30
+ it('ignores extra spaces', () => {
31
+ expect(getInitials(' Deji Ajetomobi ')).toBe('DA');
32
+ expect(getInitials(' Gusso ')).toBe('G');
33
+ });
34
+
35
+ it('returns first and last letter if name is two words with single letters', () => {
36
+ expect(getInitials('S L')).toBe('SL');
37
+ });
38
+
39
+ it('handles single character', () => {
40
+ expect(getInitials('Q')).toBe('Q');
41
+ });
42
+ });
@@ -1,4 +1,8 @@
1
1
  export function getInitials(name: string) {
2
+ if (name.length === 2 && /^[A-Z]{2}$/.test(name)) {
3
+ return name;
4
+ }
5
+
2
6
  const allInitials = name
3
7
  .split(' ')
4
8
  .map((part) => part[0])
package/src/main.css CHANGED
@@ -5978,6 +5978,9 @@ html:not([dir="rtl"]) .np-navigation-option {
5978
5978
  .upload-error-message .alert {
5979
5979
  min-width: 100px;
5980
5980
  }
5981
+ .np-theme-personal .droppable-dropping .droppable-complete-card {
5982
+ display: none;
5983
+ }
5981
5984
  .np-upload-input__upload-button {
5982
5985
  position: relative;
5983
5986
  padding: 16px;
@@ -29,3 +29,6 @@
29
29
  .upload-error-message .alert {
30
30
  min-width: 100px;
31
31
  }
32
+ .np-theme-personal .droppable-dropping .droppable-complete-card {
33
+ display: none;
34
+ }
@@ -35,4 +35,10 @@
35
35
  .alert {
36
36
  min-width: 100px;
37
37
  }
38
- }
38
+ }
39
+
40
+ .np-theme-personal {
41
+ .droppable-dropping .droppable-complete-card {
42
+ display: none;
43
+ }
44
+ }