@backstage/core-components 0.17.5 → 0.17.6-next.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @backstage/core-components
2
2
 
3
+ ## 0.17.6-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - e409bec: Fixes for rendering initials in the avatar component.
8
+
3
9
  ## 0.17.5
4
10
 
5
11
  ### Patch Changes
@@ -11,7 +11,7 @@ function stringToColor(str) {
11
11
  return color;
12
12
  }
13
13
  function extractInitials(name) {
14
- const names = name.trim().split(" ");
14
+ const names = name.replace(/\([^)]{0,1000}\)/g, "").replace(/\[[^\]]{0,1000}\]/g, "").trim().split(/\s+/).map((word) => word.replace(/[^A-Za-z\u00C0-\u017F]/g, "")).filter(Boolean);
15
15
  const firstName = names[0] ?? "";
16
16
  const lastName = names.length > 1 ? names[names.length - 1] : "";
17
17
  return firstName && lastName ? `${firstName.charAt(0)}${lastName.charAt(0)}` : firstName.charAt(0);
@@ -1 +1 @@
1
- {"version":3,"file":"utils.esm.js","sources":["../../../src/components/Avatar/utils.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function stringToColor(str: string) {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n hash = str.charCodeAt(i) + ((hash << 5) - hash);\n }\n let color = '#';\n for (let i = 0; i < 3; i++) {\n const value = (hash >> (i * 8)) & 0xff;\n color += `00${value.toString(16)}`.slice(-2);\n }\n return color;\n}\n\nexport function extractInitials(name: string) {\n const names = name.trim().split(' ');\n const firstName = names[0] ?? '';\n const lastName = names.length > 1 ? names[names.length - 1] : '';\n return firstName && lastName\n ? `${firstName.charAt(0)}${lastName.charAt(0)}`\n : firstName.charAt(0);\n}\n"],"names":[],"mappings":"AAgBO,SAAS,cAAc,GAAA,EAAa;AACzC,EAAA,IAAI,IAAA,GAAO,CAAA;AACX,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,GAAA,CAAI,QAAQ,CAAA,EAAA,EAAK;AACnC,IAAA,IAAA,GAAO,GAAA,CAAI,UAAA,CAAW,CAAC,CAAA,IAAA,CAAM,QAAQ,CAAA,IAAK,IAAA,CAAA;AAAA,EAC5C;AACA,EAAA,IAAI,KAAA,GAAQ,GAAA;AACZ,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,CAAA,EAAG,CAAA,EAAA,EAAK;AAC1B,IAAA,MAAM,KAAA,GAAS,IAAA,IAAS,CAAA,GAAI,CAAA,GAAM,GAAA;AAClC,IAAA,KAAA,IAAS,KAAK,KAAA,CAAM,QAAA,CAAS,EAAE,CAAC,CAAA,CAAA,CAAG,MAAM,EAAE,CAAA;AAAA,EAC7C;AACA,EAAA,OAAO,KAAA;AACT;AAEO,SAAS,gBAAgB,IAAA,EAAc;AAC5C,EAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,IAAA,EAAK,CAAE,MAAM,GAAG,CAAA;AACnC,EAAA,MAAM,SAAA,GAAY,KAAA,CAAM,CAAC,CAAA,IAAK,EAAA;AAC9B,EAAA,MAAM,QAAA,GAAW,MAAM,MAAA,GAAS,CAAA,GAAI,MAAM,KAAA,CAAM,MAAA,GAAS,CAAC,CAAA,GAAI,EAAA;AAC9D,EAAA,OAAO,SAAA,IAAa,QAAA,GAChB,CAAA,EAAG,SAAA,CAAU,OAAO,CAAC,CAAC,CAAA,EAAG,QAAA,CAAS,OAAO,CAAC,CAAC,CAAA,CAAA,GAC3C,SAAA,CAAU,OAAO,CAAC,CAAA;AACxB;;;;"}
1
+ {"version":3,"file":"utils.esm.js","sources":["../../../src/components/Avatar/utils.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function stringToColor(str: string) {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n hash = str.charCodeAt(i) + ((hash << 5) - hash);\n }\n let color = '#';\n for (let i = 0; i < 3; i++) {\n const value = (hash >> (i * 8)) & 0xff;\n color += `00${value.toString(16)}`.slice(-2);\n }\n return color;\n}\n\nexport function extractInitials(name: string) {\n const names = name\n .replace(/\\([^)]{0,1000}\\)/g, '')\n .replace(/\\[[^\\]]{0,1000}\\]/g, '')\n .trim()\n .split(/\\s+/)\n .map(word => word.replace(/[^A-Za-z\\u00C0-\\u017F]/g, ''))\n .filter(Boolean);\n const firstName = names[0] ?? '';\n const lastName = names.length > 1 ? names[names.length - 1] : '';\n return firstName && lastName\n ? `${firstName.charAt(0)}${lastName.charAt(0)}`\n : firstName.charAt(0);\n}\n"],"names":[],"mappings":"AAgBO,SAAS,cAAc,GAAA,EAAa;AACzC,EAAA,IAAI,IAAA,GAAO,CAAA;AACX,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,GAAA,CAAI,QAAQ,CAAA,EAAA,EAAK;AACnC,IAAA,IAAA,GAAO,GAAA,CAAI,UAAA,CAAW,CAAC,CAAA,IAAA,CAAM,QAAQ,CAAA,IAAK,IAAA,CAAA;AAAA,EAC5C;AACA,EAAA,IAAI,KAAA,GAAQ,GAAA;AACZ,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,CAAA,EAAG,CAAA,EAAA,EAAK;AAC1B,IAAA,MAAM,KAAA,GAAS,IAAA,IAAS,CAAA,GAAI,CAAA,GAAM,GAAA;AAClC,IAAA,KAAA,IAAS,KAAK,KAAA,CAAM,QAAA,CAAS,EAAE,CAAC,CAAA,CAAA,CAAG,MAAM,EAAE,CAAA;AAAA,EAC7C;AACA,EAAA,OAAO,KAAA;AACT;AAEO,SAAS,gBAAgB,IAAA,EAAc;AAC5C,EAAA,MAAM,KAAA,GAAQ,IAAA,CACX,OAAA,CAAQ,mBAAA,EAAqB,EAAE,EAC/B,OAAA,CAAQ,oBAAA,EAAsB,EAAE,CAAA,CAChC,IAAA,EAAK,CACL,MAAM,KAAK,CAAA,CACX,GAAA,CAAI,CAAA,IAAA,KAAQ,IAAA,CAAK,OAAA,CAAQ,2BAA2B,EAAE,CAAC,CAAA,CACvD,MAAA,CAAO,OAAO,CAAA;AACjB,EAAA,MAAM,SAAA,GAAY,KAAA,CAAM,CAAC,CAAA,IAAK,EAAA;AAC9B,EAAA,MAAM,QAAA,GAAW,MAAM,MAAA,GAAS,CAAA,GAAI,MAAM,KAAA,CAAM,MAAA,GAAS,CAAC,CAAA,GAAI,EAAA;AAC9D,EAAA,OAAO,SAAA,IAAa,QAAA,GAChB,CAAA,EAAG,SAAA,CAAU,OAAO,CAAC,CAAC,CAAA,EAAG,QAAA,CAAS,OAAO,CAAC,CAAC,CAAA,CAAA,GAC3C,SAAA,CAAU,OAAO,CAAC,CAAA;AACxB;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/core-components",
3
- "version": "0.17.5",
3
+ "version": "0.17.6-next.0",
4
4
  "description": "Core components used by Backstage plugins and apps",
5
5
  "backstage": {
6
6
  "role": "web-library"
@@ -66,11 +66,11 @@
66
66
  "test": "backstage-cli package test"
67
67
  },
68
68
  "dependencies": {
69
- "@backstage/config": "^1.3.3",
70
- "@backstage/core-plugin-api": "^1.10.9",
71
- "@backstage/errors": "^1.2.7",
72
- "@backstage/theme": "^0.6.8",
73
- "@backstage/version-bridge": "^1.0.11",
69
+ "@backstage/config": "1.3.3",
70
+ "@backstage/core-plugin-api": "1.10.9",
71
+ "@backstage/errors": "1.2.7",
72
+ "@backstage/theme": "0.6.8",
73
+ "@backstage/version-bridge": "1.0.11",
74
74
  "@dagrejs/dagre": "^1.1.4",
75
75
  "@date-io/core": "^1.3.13",
76
76
  "@material-table/core": "^3.1.0",
@@ -106,10 +106,10 @@
106
106
  "zod": "^3.22.4"
107
107
  },
108
108
  "devDependencies": {
109
- "@backstage/app-defaults": "^1.6.5",
110
- "@backstage/cli": "^0.34.0",
111
- "@backstage/core-app-api": "^1.18.0",
112
- "@backstage/test-utils": "^1.7.11",
109
+ "@backstage/app-defaults": "1.6.6-next.0",
110
+ "@backstage/cli": "0.34.2-next.1",
111
+ "@backstage/core-app-api": "1.18.0",
112
+ "@backstage/test-utils": "1.7.11",
113
113
  "@testing-library/dom": "^10.0.0",
114
114
  "@testing-library/jest-dom": "^6.0.0",
115
115
  "@testing-library/user-event": "^14.0.0",