@workday/canvas-kit-codemod 7.0.0-alpha.92-next.19 → 7.0.0-alpha.96-next.22

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 +1 @@
1
- {"version":3,"file":"updateTabs.d.ts","sourceRoot":"","sources":["../../../lib/v7/updateTabs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAC,MAAM,aAAa,CAAC;AAGnD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UA0B7E"}
1
+ {"version":3,"file":"updateTabs.d.ts","sourceRoot":"","sources":["../../../lib/v7/updateTabs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAC,MAAM,aAAa,CAAC;AAGnD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,UAuD7E"}
@@ -7,7 +7,32 @@ export default function transformer(file, api, options) {
7
7
  return file.source;
8
8
  }
9
9
  root
10
- .find(j.JSXOpeningElement, { name: { object: { name: importMap.Tabs }, property: { name: 'Item' } } })
10
+ // Find <Tabs
11
+ .find(j.JSXOpeningElement, { name: { object: { name: importMap.Tabs } } })
12
+ // Filter for <Tabs.Item and <Tabs.Panel
13
+ .filter(function (path) {
14
+ return (path.value.name.type === 'JSXMemberExpression' &&
15
+ (path.value.name.property.name === 'Item' || path.value.name.property.name === 'Panel'));
16
+ })
17
+ .forEach(function (nodePath) {
18
+ var _a;
19
+ nodePath.value.attributes = (_a = nodePath.value.attributes) === null || _a === void 0 ? void 0 : _a.map(function (attribute) {
20
+ if (attribute.type === 'JSXAttribute' &&
21
+ attribute.name.type === 'JSXIdentifier' &&
22
+ attribute.name.name === 'name') {
23
+ attribute.name.name = 'data-id';
24
+ }
25
+ return attribute;
26
+ });
27
+ });
28
+ root
29
+ // find <Tabs.Menu.Item
30
+ .find(j.JSXOpeningElement, {
31
+ name: {
32
+ object: { object: { name: importMap.Tabs }, property: { name: 'Menu' } },
33
+ property: { name: 'Item' },
34
+ },
35
+ })
11
36
  .forEach(function (nodePath) {
12
37
  var _a;
13
38
  nodePath.value.attributes = (_a = nodePath.value.attributes) === null || _a === void 0 ? void 0 : _a.map(function (attribute) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@workday/canvas-kit-codemod",
3
3
  "author": "Workday, Inc. (https://www.workday.com)",
4
4
  "license": "Apache-2.0",
5
- "version": "7.0.0-alpha.92-next.19+e2cad878",
5
+ "version": "7.0.0-alpha.96-next.22+29ac2599",
6
6
  "description": "A collection of codemods for use on Workday Canvas Kit packages.",
7
7
  "main": "dist/es6/index.js",
8
8
  "sideEffects": false,
@@ -42,5 +42,5 @@
42
42
  "test": "TZ=UTC jest -c ../../jest.config.js",
43
43
  "typecheck:src": "tsc -p . --noEmit --incremental false"
44
44
  },
45
- "gitHead": "e2cad87834c40633618cb65a95a0271b1256e214"
45
+ "gitHead": "29ac25992f1ca92c4cc885813c271120511038b5"
46
46
  }