@navikt/aksel 5.18.3 → 6.0.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.
@@ -77,6 +77,14 @@ exports.migrations = {
77
77
  path: "v4.0.0/date/date",
78
78
  },
79
79
  ],
80
+ "v6.0.0": [
81
+ {
82
+ description: "Removes `backgroundColor` and `avatarBgColor` properties from `Chat` and `Chat.Bubble`",
83
+ value: "v6-chat",
84
+ path: "v6.0.0/chat/chat",
85
+ warning: "Remember to update use of `variant`-prop to match previous use of colors. If needed the component exposes css-variables for custom overrides",
86
+ },
87
+ ],
80
88
  };
81
89
  function getMigrationPath(str) {
82
90
  var _a;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const lineterminator_1 = require("../../../utils/lineterminator");
4
+ /**
5
+ * @param {import('jscodeshift').FileInfo} file
6
+ * @param {import('jscodeshift').API} api
7
+ */
8
+ function transformer(file, api) {
9
+ const j = api.jscodeshift;
10
+ let localName = "Chat";
11
+ const root = j(file.source);
12
+ /* Finds used name for Chat component */
13
+ root
14
+ .find(j.ImportDeclaration)
15
+ .filter((path) => path.node.source.value === "@navikt/ds-react")
16
+ .forEach((imp) => {
17
+ imp.value.specifiers.forEach((x) => {
18
+ if (x.imported.name === "Chat" && x.local.name !== x.imported.name) {
19
+ localName = x.local.name;
20
+ }
21
+ });
22
+ });
23
+ root
24
+ .find(j.JSXElement, {
25
+ openingElement: {
26
+ name: {
27
+ name: localName,
28
+ },
29
+ },
30
+ })
31
+ .forEach((path) => {
32
+ j(path)
33
+ .find(j.JSXAttribute, {
34
+ name: {
35
+ name: "backgroundColor",
36
+ },
37
+ })
38
+ .remove();
39
+ j(path)
40
+ .find(j.JSXAttribute, {
41
+ name: {
42
+ name: "avatarBgColor",
43
+ },
44
+ })
45
+ .remove();
46
+ });
47
+ root
48
+ .find(j.JSXElement, {
49
+ openingElement: {
50
+ name: {
51
+ type: "JSXMemberExpression",
52
+ object: {
53
+ name: localName,
54
+ },
55
+ property: {
56
+ name: "Bubble",
57
+ },
58
+ },
59
+ },
60
+ })
61
+ .forEach((path) => {
62
+ j(path)
63
+ .find(j.JSXAttribute, {
64
+ name: {
65
+ name: "backgroundColor",
66
+ },
67
+ })
68
+ .remove();
69
+ });
70
+ return root.toSource((0, lineterminator_1.getLineTerminator)(file.source));
71
+ }
72
+ exports.default = transformer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navikt/aksel",
3
- "version": "5.18.3",
3
+ "version": "6.0.0",
4
4
  "description": "Aksel command line interface. Handles css-imports, codemods and more",
5
5
  "author": "Aksel | NAV designsystem team",
6
6
  "license": "MIT",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "homepage": "https://aksel.nav.no/grunnleggende/kode/kommandolinje",
31
31
  "dependencies": {
32
- "@navikt/ds-css": "5.18.3",
32
+ "@navikt/ds-css": "6.0.0",
33
33
  "axios": "1.6.0",
34
34
  "chalk": "4.1.0",
35
35
  "clipboardy": "^2.3.0",