@vkontakte/vkui-codemods 1.0.0-beta.0 → 1.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.
Files changed (54) hide show
  1. package/README.md +62 -19
  2. package/dist/autoDetectVKUIVersion.js +17 -7
  3. package/dist/cli.js +80 -32
  4. package/dist/codemod-helpers.js +86 -1
  5. package/dist/getAvailableCodemods.js +17 -7
  6. package/dist/index.js +45 -57
  7. package/dist/transforms/v7/action-sheet.js +16 -0
  8. package/dist/transforms/v7/alert.js +16 -0
  9. package/dist/transforms/v7/appearance-provider.js +35 -0
  10. package/dist/transforms/v7/appearance.js +45 -0
  11. package/dist/transforms/v7/banner.js +47 -0
  12. package/dist/transforms/v7/calendar.js +17 -0
  13. package/dist/transforms/v7/card-grid.js +16 -0
  14. package/dist/transforms/v7/card-scroll.js +59 -0
  15. package/dist/transforms/v7/cell-button.js +3 -15
  16. package/dist/transforms/v7/cell.js +19 -0
  17. package/dist/transforms/v7/chips-select.js +20 -0
  18. package/dist/transforms/v7/common/moveFromChildrenToLabel.js +68 -0
  19. package/dist/transforms/v7/common/remapSizePropValue.js +10 -5
  20. package/dist/transforms/v7/common/removeChildrenFromComponent.js +17 -0
  21. package/dist/transforms/v7/config-provider.js +136 -0
  22. package/dist/transforms/v7/content-card.js +21 -0
  23. package/dist/transforms/v7/counter.js +60 -0
  24. package/dist/transforms/v7/custom-scroll-view.js +21 -0
  25. package/dist/transforms/v7/custom-select.js +20 -0
  26. package/dist/transforms/v7/date-picker.js +26 -0
  27. package/dist/transforms/v7/form-item.js +2 -2
  28. package/dist/transforms/v7/form-status.js +18 -0
  29. package/dist/transforms/v7/header.js +47 -0
  30. package/dist/transforms/v7/horizontal-cell-show-more.js +33 -13
  31. package/dist/transforms/v7/horizontal-cell.js +16 -0
  32. package/dist/transforms/v7/image-overlay.js +10 -10
  33. package/dist/transforms/v7/mini-info-cell.js +18 -0
  34. package/dist/transforms/v7/modal-card.js +29 -0
  35. package/dist/transforms/v7/onboarding-tooltip.js +16 -0
  36. package/dist/transforms/v7/panel-header-back.js +18 -0
  37. package/dist/transforms/v7/panel-header-close.js +18 -0
  38. package/dist/transforms/v7/panel-header-content.js +16 -0
  39. package/dist/transforms/v7/panel-header-edit.js +19 -0
  40. package/dist/transforms/v7/panel-header-submit.js +18 -0
  41. package/dist/transforms/v7/panel-spinner.js +30 -0
  42. package/dist/transforms/v7/placeholder.js +19 -0
  43. package/dist/transforms/v7/rich-cell.js +20 -0
  44. package/dist/transforms/v7/screen-spinner.js +25 -2
  45. package/dist/transforms/v7/scroll-arrow.js +52 -0
  46. package/dist/transforms/v7/select.js +20 -0
  47. package/dist/transforms/v7/separator.js +1 -0
  48. package/dist/transforms/v7/simple-cell.js +19 -0
  49. package/dist/transforms/v7/subnavigation-bar.js +46 -0
  50. package/dist/transforms/v7/subnavigation-button.js +18 -0
  51. package/dist/transforms/v7/tabbar-item.js +16 -0
  52. package/dist/transforms/v7/tooltip.js +16 -0
  53. package/dist/transforms/v7/users-stack.js +2 -15
  54. package/package.json +9 -9
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parser = void 0;
4
+ exports.default = transformer;
5
+ var codemod_helpers_1 = require("../../codemod-helpers");
6
+ var report_1 = require("../../report");
7
+ exports.parser = 'tsx';
8
+ function transformer(file, api, options) {
9
+ var alias = options.alias;
10
+ var j = api.jscodeshift;
11
+ var source = j(file.source);
12
+ var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'Counter', alias).localName;
13
+ if (!localName) {
14
+ return source.toSource();
15
+ }
16
+ source.find(j.JSXOpeningElement, { name: { name: localName } }).forEach(function (path) {
17
+ var attributes = path.node.attributes;
18
+ if (!attributes || !attributes.length) {
19
+ return;
20
+ }
21
+ var modeProp = attributes.find(function (attr) { return attr.type === 'JSXAttribute' && attr.name.name === 'mode'; });
22
+ if (!modeProp) {
23
+ return;
24
+ }
25
+ var oldMode = (0, codemod_helpers_1.getStringValueFromAttribute)(modeProp);
26
+ if (!oldMode) {
27
+ (0, report_1.report)(api, "Manual changes required for ".concat(localName, "'s \"mode\" prop. Need to replace it to another value and add prop appearance"));
28
+ return;
29
+ }
30
+ var newMode, newAppearance;
31
+ switch (oldMode) {
32
+ case 'inherit':
33
+ newMode = 'inherit';
34
+ break;
35
+ case 'primary':
36
+ newMode = 'primary';
37
+ newAppearance = 'accent';
38
+ break;
39
+ case 'secondary':
40
+ newMode = 'primary';
41
+ newAppearance = 'neutral';
42
+ break;
43
+ case 'prominent':
44
+ newMode = 'primary';
45
+ newAppearance = 'accent-red';
46
+ break;
47
+ case 'contrast':
48
+ newMode = 'contrast';
49
+ newAppearance = 'accent';
50
+ break;
51
+ }
52
+ if (newMode) {
53
+ modeProp.value = j.stringLiteral(newMode);
54
+ if (newAppearance) {
55
+ attributes.push(j.jsxAttribute(j.jsxIdentifier('appearance'), j.stringLiteral(newAppearance)));
56
+ }
57
+ }
58
+ });
59
+ return source.toSource();
60
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parser = void 0;
4
+ exports.default = transformer;
5
+ var codemod_helpers_1 = require("../../codemod-helpers");
6
+ exports.parser = 'tsx';
7
+ var PROPS_TO_REMOVE = ['windowResize', 'autoHideScrollbar', 'autoHideScrollbarDelay'];
8
+ function transformer(file, api, options) {
9
+ var alias = options.alias;
10
+ var j = api.jscodeshift;
11
+ var source = j(file.source);
12
+ var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'CustomScrollView', alias).localName;
13
+ if (!localName) {
14
+ return source.toSource();
15
+ }
16
+ (0, codemod_helpers_1.removeProps)(j, api, source, localName, PROPS_TO_REMOVE, function () {
17
+ return "need to remove props ".concat(PROPS_TO_REMOVE.join(', '));
18
+ });
19
+ (0, codemod_helpers_1.renameProp)(j, source, localName, { boxRef: 'getRootRef' });
20
+ return source.toSource();
21
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parser = void 0;
4
+ exports.default = transformer;
5
+ var codemod_helpers_1 = require("../../codemod-helpers");
6
+ exports.parser = 'tsx';
7
+ var PROPS_TO_REMOVE = ['autoHideScrollbar', 'autoHideScrollbarDelay'];
8
+ function transformer(file, api, options) {
9
+ var alias = options.alias;
10
+ var j = api.jscodeshift;
11
+ var source = j(file.source);
12
+ var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'CustomSelect', alias).localName;
13
+ if (!localName) {
14
+ return source.toSource();
15
+ }
16
+ (0, codemod_helpers_1.removeProps)(j, api, source, localName, PROPS_TO_REMOVE, function () {
17
+ return "need to remove props ".concat(PROPS_TO_REMOVE.join(', '));
18
+ });
19
+ return source.toSource();
20
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parser = void 0;
4
+ exports.default = transformer;
5
+ var codemod_helpers_1 = require("../../codemod-helpers");
6
+ var report_1 = require("../../report");
7
+ exports.parser = 'tsx';
8
+ function transformer(file, api, options) {
9
+ var alias = options.alias;
10
+ var j = api.jscodeshift;
11
+ var source = j(file.source);
12
+ var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'DatePicker', alias).localName;
13
+ if (!localName) {
14
+ return source.toSource();
15
+ }
16
+ source
17
+ .find(j.JSXElement, {
18
+ openingElement: {
19
+ name: { name: localName },
20
+ },
21
+ })
22
+ .forEach(function () {
23
+ (0, report_1.report)(api, "Manual changes required for ".concat(localName, ". component DatePicker was removed in v7.0.0, please use Input, Select or DateInput component"));
24
+ });
25
+ return source.toSource();
26
+ }
@@ -53,6 +53,7 @@ function transformer(file, api, options) {
53
53
  }
54
54
  return undefined;
55
55
  }
56
+ (0, codemod_helpers_1.renameProp)(j, source, localName, { topNode: 'top' });
56
57
  source.find(j.JSXElement, { openingElement: { name: { name: localName } } }).forEach(function (path) {
57
58
  var formItem = path.node;
58
59
  var topMultiline;
@@ -84,8 +85,7 @@ function transformer(file, api, options) {
84
85
  // Ищем FormItem.TopLabel в пропе top и topNode
85
86
  formItemAttributes === null || formItemAttributes === void 0 ? void 0 : formItemAttributes.forEach(function (attr) {
86
87
  var _a, _b;
87
- if (attr.type === 'JSXAttribute' &&
88
- (attr.name.name === 'top' || attr.name.name === 'topNode')) {
88
+ if (attr.type === 'JSXAttribute' && attr.name.name === 'top') {
89
89
  if (((_a = attr.value) === null || _a === void 0 ? void 0 : _a.type) === 'JSXElement') {
90
90
  topLabelMultiline = findTopLabelRecursive(attr.value);
91
91
  }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parser = void 0;
4
+ exports.default = transformer;
5
+ var codemod_helpers_1 = require("../../codemod-helpers");
6
+ exports.parser = 'tsx';
7
+ function transformer(file, api, options) {
8
+ var alias = options.alias;
9
+ var j = api.jscodeshift;
10
+ var source = j(file.source);
11
+ var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'FormStatus', alias).localName;
12
+ if (localName) {
13
+ (0, codemod_helpers_1.renameProp)(j, source, localName, {
14
+ header: 'title',
15
+ });
16
+ }
17
+ return source.toSource();
18
+ }
@@ -2,9 +2,54 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parser = void 0;
4
4
  exports.default = transformer;
5
+ var report_1 = require("../../report");
5
6
  var remapSizePropValue_1 = require("./common/remapSizePropValue");
6
7
  var codemod_helpers_1 = require("../../codemod-helpers");
7
8
  exports.parser = 'tsx';
9
+ function removePropMode(j, api, source, localName) {
10
+ var changeAttributeValue = function (attributes, attribute, attrName, newValue) {
11
+ if (attribute) {
12
+ attribute.value = j.stringLiteral(newValue);
13
+ }
14
+ else {
15
+ attributes === null || attributes === void 0 ? void 0 : attributes.push(j.jsxAttribute(j.jsxIdentifier(attrName), j.stringLiteral(newValue)));
16
+ }
17
+ };
18
+ source
19
+ .find(j.JSXOpeningElement, {
20
+ name: {
21
+ name: localName,
22
+ },
23
+ })
24
+ .forEach(function (path) {
25
+ var attributes = path.node.attributes;
26
+ var modeAttr = (attributes === null || attributes === void 0 ? void 0 : attributes.find(function (attr) { return attr.type === 'JSXAttribute' && attr.name.name === 'mode'; })) || undefined;
27
+ var sizeAttr = (attributes === null || attributes === void 0 ? void 0 : attributes.find(function (attr) { return attr.type === 'JSXAttribute' && attr.name.name === 'size'; })) || undefined;
28
+ var hasSpread = !!(attributes === null || attributes === void 0 ? void 0 : attributes.some(function (attr) { return attr.type === 'JSXSpreadAttribute'; }));
29
+ if (!modeAttr) {
30
+ if (hasSpread) {
31
+ (0, report_1.report)(api, ": ".concat(localName, " has been changed. Manual changes required: remove mode attribute and replace it by size prop"));
32
+ }
33
+ return;
34
+ }
35
+ (0, codemod_helpers_1.removeAttribute)(attributes, modeAttr);
36
+ var modeValue = (0, codemod_helpers_1.getStringValueFromAttribute)(modeAttr);
37
+ if (!modeValue) {
38
+ (0, report_1.report)(api, ": ".concat(localName, " has been changed. Manual changes required: remove mode attribute and replace it by size prop"));
39
+ return;
40
+ }
41
+ var sizeValue = (0, codemod_helpers_1.getStringValueFromAttribute)(sizeAttr);
42
+ if (modeValue === 'primary' && sizeValue === 'l') {
43
+ changeAttributeValue(attributes, sizeAttr, 'size', 'xl');
44
+ }
45
+ else if (modeValue === 'tertiary' || (modeValue === 'primary' && sizeValue === 'm')) {
46
+ changeAttributeValue(attributes, sizeAttr, 'size', 'm');
47
+ }
48
+ else if (modeValue === 'secondary') {
49
+ changeAttributeValue(attributes, sizeAttr, 'size', 's');
50
+ }
51
+ });
52
+ }
8
53
  function transformer(file, api, options) {
9
54
  var alias = options.alias;
10
55
  var j = api.jscodeshift;
@@ -23,5 +68,7 @@ function transformer(file, api, options) {
23
68
  regular: 'm',
24
69
  },
25
70
  });
71
+ (0, codemod_helpers_1.renameProp)(j, source, localName, { aside: 'after' });
72
+ removePropMode(j, api, source, localName);
26
73
  return source.toSource();
27
74
  }
@@ -6,6 +6,31 @@ var codemod_helpers_1 = require("../../codemod-helpers");
6
6
  var report_1 = require("../../report");
7
7
  exports.parser = 'tsx';
8
8
  var componentName = 'HorizontalCellShowMore';
9
+ function compensateLastCellIndentManipulator(api, attribute) {
10
+ var node = attribute.node;
11
+ if (!node.value) {
12
+ api.jscodeshift(attribute).remove();
13
+ }
14
+ else if (node.value.type === 'JSXExpressionContainer' &&
15
+ node.value.expression.type === 'BooleanLiteral') {
16
+ api.jscodeshift(attribute).remove();
17
+ }
18
+ else {
19
+ (0, report_1.report)(api, "Manual changes required for ".concat(componentName, "'s \"compensateLastCellIndent\" prop. You might not need it anymore."));
20
+ }
21
+ }
22
+ function sizeManipulator(api, attribute) {
23
+ var _a;
24
+ var node = attribute.node;
25
+ if (((_a = node.value) === null || _a === void 0 ? void 0 : _a.type) === 'StringLiteral') {
26
+ if (node.value.value !== 's') {
27
+ node.value = api.jscodeshift.stringLiteral('m');
28
+ }
29
+ }
30
+ else {
31
+ (0, report_1.report)(api, "Manual changes required for ".concat(componentName, "'s \"size\" prop. Use \"s\" or \"m\" value only."));
32
+ }
33
+ }
9
34
  function transformer(file, api, options) {
10
35
  var alias = options.alias;
11
36
  var j = api.jscodeshift;
@@ -17,21 +42,16 @@ function transformer(file, api, options) {
17
42
  source
18
43
  .find(j.JSXOpeningElement)
19
44
  .filter(function (path) { return path.value.name.type === 'JSXIdentifier' && path.value.name.name === localName; })
20
- .find(j.JSXAttribute)
21
- .filter(function (attribute) { return attribute.node.name.name === 'compensateLastCellIndent'; })
45
+ .find(j.JSXAttribute, function (attribute) {
46
+ return attribute.name.name === 'compensateLastCellIndent' || attribute.name.name === 'size';
47
+ })
22
48
  .forEach(function (attribute) {
23
- var node = attribute.node;
24
- if (!node.value) {
25
- j(attribute).remove();
49
+ var attributeName = attribute.node.name.name;
50
+ if (attributeName === 'compensateLastCellIndent') {
51
+ compensateLastCellIndentManipulator(api, attribute);
26
52
  }
27
- else if (node.value.type === 'JSXExpressionContainer' &&
28
- node.value.expression.type === 'BooleanLiteral') {
29
- if (node.value.expression.value) {
30
- j(attribute).remove();
31
- }
32
- else {
33
- (0, report_1.report)(api, "Manual changes required for ".concat(componentName, "'s \"compensateLastCellIndent\" prop. You might not need it anymore."));
34
- }
53
+ else if (attributeName === 'size') {
54
+ sizeManipulator(api, attribute);
35
55
  }
36
56
  });
37
57
  return source.toSource();
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parser = void 0;
4
+ exports.default = transformer;
5
+ var codemod_helpers_1 = require("../../codemod-helpers");
6
+ exports.parser = 'tsx';
7
+ function transformer(file, api, options) {
8
+ var alias = options.alias;
9
+ var j = api.jscodeshift;
10
+ var source = j(file.source);
11
+ var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'HorizontalCell', alias).localName;
12
+ if (localName) {
13
+ (0, codemod_helpers_1.renameProp)(j, source, localName, { header: 'title' });
14
+ }
15
+ return source.toSource();
16
+ }
@@ -27,7 +27,7 @@ function transformer(file, api, options) {
27
27
  (0, report_1.report)(api, ": ".concat(chalk_1.default.white.bgBlue("".concat(localName, ".Overlay")), " has been changed. Manual changes required: ").concat(additionalMessage));
28
28
  };
29
29
  var showDisableInteractivePropReport = function (localName) {
30
- showReport(localName, "\"disableInteractive\" has been removed, please use \"onClick\" if you want to make ".concat(localName, ".Overlay interactive"));
30
+ showReport(localName, "\"disableInteractive\" has been removed, please use \"onClick\" if you want to make ".concat(localName, ".Overlay interactive."));
31
31
  };
32
32
  var calcDisableInteractiveValue = function (disableInteractiveAttribute) {
33
33
  var _a, _b;
@@ -66,25 +66,25 @@ function transformer(file, api, options) {
66
66
  var onClickAttribute = findAttribute(overlayItemAttributes, 'onClick');
67
67
  var disableInteractiveAttribute = findAttribute(overlayItemAttributes, 'disableInteractive');
68
68
  // Кейс, когда disableInteractive не был задан, значит overlay interactive.
69
- // Сейчас у него обязательно должен быть onClick, чтобы не ломать обратную совместимость
69
+ // Сейчас у него обязательно должен быть onClick, чтобы не лоймать обратную совместимость
70
70
  if (!disableInteractiveAttribute) {
71
71
  // Проверяем наличие onClick, и если его нет, то пользователь должен добавить onClick
72
72
  if (!onClickAttribute) {
73
- showReport(localName, "If you want to make ".concat(localName, ".Overlay interactive please add \"onClick\" prop"));
73
+ showReport(localName, "If you want to make ".concat(localName, ".Overlay interactive, please add \"onClick\" prop."));
74
74
  }
75
75
  return;
76
76
  }
77
77
  // Рассчитываем значение disableInteractive в boolean
78
78
  var disableInteractiveValue = calcDisableInteractiveValue(disableInteractiveAttribute);
79
79
  if (disableInteractiveValue === null) {
80
- // Если у disableInteractive используется сложное выражение
81
- // То пользователь сам должен удалить этот проп, как ему нужно
80
+ // Если у disableInteractive используется сложное выражение,
81
+ // то пользователь сам должен удалить этот проп, как ему нужно
82
82
  showDisableInteractivePropReport(localName);
83
83
  }
84
84
  // Удаляем аттрибут disableInteractive
85
85
  (0, codemod_helpers_1.removeAttribute)(overlayItemAttributes, disableInteractiveAttribute);
86
86
  if (disableInteractiveValue) {
87
- // Если disableInteractive = true, то все, что нам нужно это удалить атрибут onClick
87
+ // Если disableInteractive = true, то все, что нам нужно, это удалить атрибут onClick
88
88
  // Важно: мы можем его спокойно удалить, так как в этом кейсе он может быть только undefined
89
89
  if (onClickAttribute) {
90
90
  (0, codemod_helpers_1.removeAttribute)(overlayItemAttributes, onClickAttribute);
@@ -96,10 +96,10 @@ function transformer(file, api, options) {
96
96
  showDisableInteractivePropReport(localName);
97
97
  return;
98
98
  }
99
- // Если disableInteractive = false и onClick не пустой надо обработать следующие кейс:
99
+ // Если disableInteractive = false и onClick не пустой, надо обработать следующие кейсы:
100
100
  // onClick=undefined: надо добавить колбэк
101
- // onClick=identifier: все хорошо,оставляем как есть
102
- // В остальных случаях, надо чтобы пользователь убедился, что onClick устанавливается корректно
101
+ // onClick=identifier: все хорошо, оставляем как есть
102
+ // В остальных случаях надо, чтобы пользователь убедился, что onClick устанавливается корректно
103
103
  if (((_a = onClickAttribute.value) === null || _a === void 0 ? void 0 : _a.type) === 'JSXExpressionContainer') {
104
104
  var expression = onClickAttribute.value.expression;
105
105
  if (expression.type === 'Identifier') {
@@ -112,7 +112,7 @@ function transformer(file, api, options) {
112
112
  return;
113
113
  }
114
114
  }
115
- showReport(localName, "\"disableInteractive\" has been removed, please validate that \"onClick\" prop value not falsy");
115
+ showReport(localName, "\"disableInteractive\" has been removed, please validate that \"onClick\" prop value not falsy.");
116
116
  });
117
117
  };
118
118
  if (ImageLocalName) {
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parser = void 0;
4
+ exports.default = transformer;
5
+ var codemod_helpers_1 = require("../../codemod-helpers");
6
+ exports.parser = 'tsx';
7
+ function transformer(file, api, options) {
8
+ var alias = options.alias;
9
+ var j = api.jscodeshift;
10
+ var source = j(file.source);
11
+ var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'MiniInfoCell', alias).localName;
12
+ if (localName) {
13
+ (0, codemod_helpers_1.renameProp)(j, source, localName, {
14
+ expandable: 'chevron',
15
+ });
16
+ }
17
+ return source.toSource();
18
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parser = void 0;
4
+ exports.default = transformer;
5
+ var codemod_helpers_1 = require("../../codemod-helpers");
6
+ exports.parser = 'tsx';
7
+ var RENAME_MAP = {
8
+ header: 'title',
9
+ subheader: 'description',
10
+ headerComponent: 'titleComponent',
11
+ subheaderComponent: 'descriptionComponent',
12
+ };
13
+ function transformer(file, api, options) {
14
+ var alias = options.alias;
15
+ var j = api.jscodeshift;
16
+ var source = j(file.source);
17
+ var modalCardName = (0, codemod_helpers_1.getImportInfo)(j, file, 'ModalCard', alias).localName;
18
+ var modalCardBaseName = (0, codemod_helpers_1.getImportInfo)(j, file, 'ModalCardBase', alias).localName;
19
+ if (!modalCardName && !modalCardBaseName) {
20
+ return source.toSource();
21
+ }
22
+ if (modalCardName) {
23
+ (0, codemod_helpers_1.renameProp)(j, source, modalCardName, RENAME_MAP);
24
+ }
25
+ if (modalCardBaseName) {
26
+ (0, codemod_helpers_1.renameProp)(j, source, modalCardBaseName, RENAME_MAP);
27
+ }
28
+ return source.toSource();
29
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parser = void 0;
4
+ exports.default = transformer;
5
+ var codemod_helpers_1 = require("../../codemod-helpers");
6
+ exports.parser = 'tsx';
7
+ function transformer(file, api, options) {
8
+ var alias = options.alias;
9
+ var j = api.jscodeshift;
10
+ var source = j(file.source);
11
+ var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'OnboardingTooltip', alias).localName;
12
+ if (localName) {
13
+ (0, codemod_helpers_1.renameProp)(j, source, localName, { text: 'description', header: 'title' });
14
+ }
15
+ return source.toSource();
16
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parser = void 0;
4
+ exports.default = transformer;
5
+ var codemod_helpers_1 = require("../../codemod-helpers");
6
+ var moveFromChildrenToLabel_1 = require("./common/moveFromChildrenToLabel");
7
+ exports.parser = 'tsx';
8
+ function transformer(file, api, options) {
9
+ var alias = options.alias;
10
+ var j = api.jscodeshift;
11
+ var source = j(file.source);
12
+ var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'PanelHeaderBack', alias).localName;
13
+ if (!localName) {
14
+ return source.toSource();
15
+ }
16
+ (0, moveFromChildrenToLabel_1.moveFromChildrenToLabel)(api, source, localName, true);
17
+ return source.toSource();
18
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parser = void 0;
4
+ exports.default = transformer;
5
+ var codemod_helpers_1 = require("../../codemod-helpers");
6
+ var moveFromChildrenToLabel_1 = require("./common/moveFromChildrenToLabel");
7
+ exports.parser = 'tsx';
8
+ function transformer(file, api, options) {
9
+ var alias = options.alias;
10
+ var j = api.jscodeshift;
11
+ var source = j(file.source);
12
+ var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'PanelHeaderClose', alias).localName;
13
+ if (!localName) {
14
+ return source.toSource();
15
+ }
16
+ (0, moveFromChildrenToLabel_1.moveFromChildrenToLabel)(api, source, localName, false);
17
+ return source.toSource();
18
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parser = void 0;
4
+ exports.default = transformer;
5
+ var codemod_helpers_1 = require("../../codemod-helpers");
6
+ exports.parser = 'tsx';
7
+ function transformer(file, api, options) {
8
+ var alias = options.alias;
9
+ var j = api.jscodeshift;
10
+ var source = j(file.source);
11
+ var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'PanelHeaderContent', alias).localName;
12
+ if (localName) {
13
+ (0, codemod_helpers_1.renameProp)(j, source, localName, { status: 'subtitle' });
14
+ }
15
+ return source.toSource();
16
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parser = void 0;
4
+ exports.default = transformer;
5
+ var codemod_helpers_1 = require("../../codemod-helpers");
6
+ var removeChildrenFromComponent_1 = require("./common/removeChildrenFromComponent");
7
+ exports.parser = 'tsx';
8
+ function transformer(file, api, options) {
9
+ var alias = options.alias;
10
+ var j = api.jscodeshift;
11
+ var source = j(file.source);
12
+ var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'PanelHeaderEdit', alias).localName;
13
+ if (!localName) {
14
+ return source.toSource();
15
+ }
16
+ (0, codemod_helpers_1.removeProps)(j, api, source, localName, ['children', 'label']);
17
+ (0, removeChildrenFromComponent_1.removeChildrenFromComponent)(api, source, localName);
18
+ return source.toSource();
19
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parser = void 0;
4
+ exports.default = transformer;
5
+ var codemod_helpers_1 = require("../../codemod-helpers");
6
+ var moveFromChildrenToLabel_1 = require("./common/moveFromChildrenToLabel");
7
+ exports.parser = 'tsx';
8
+ function transformer(file, api, options) {
9
+ var alias = options.alias;
10
+ var j = api.jscodeshift;
11
+ var source = j(file.source);
12
+ var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'PanelHeaderSubmit', alias).localName;
13
+ if (!localName) {
14
+ return source.toSource();
15
+ }
16
+ (0, moveFromChildrenToLabel_1.moveFromChildrenToLabel)(api, source, localName, false);
17
+ return source.toSource();
18
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parser = void 0;
4
+ exports.default = transformer;
5
+ var remapSizePropValue_1 = require("./common/remapSizePropValue");
6
+ var codemod_helpers_1 = require("../../codemod-helpers");
7
+ exports.parser = 'tsx';
8
+ var componentName = 'PanelSpinner';
9
+ function transformer(file, api, options) {
10
+ var alias = options.alias;
11
+ var j = api.jscodeshift;
12
+ var source = j(file.source);
13
+ var localName = (0, codemod_helpers_1.getImportInfo)(j, file, componentName, alias).localName;
14
+ if (!localName) {
15
+ return source.toSource();
16
+ }
17
+ (0, remapSizePropValue_1.remapSizePropValue)({
18
+ j: j,
19
+ api: api,
20
+ source: source,
21
+ componentName: localName,
22
+ sizesMap: {
23
+ large: 'xl',
24
+ medium: 'l',
25
+ regular: 'm',
26
+ small: 's',
27
+ },
28
+ });
29
+ return source.toSource();
30
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parser = void 0;
4
+ exports.default = transformer;
5
+ var codemod_helpers_1 = require("../../codemod-helpers");
6
+ exports.parser = 'tsx';
7
+ function transformer(file, api, options) {
8
+ var alias = options.alias;
9
+ var j = api.jscodeshift;
10
+ var source = j(file.source);
11
+ var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'Placeholder', alias).localName;
12
+ if (!localName) {
13
+ return source.toSource();
14
+ }
15
+ (0, codemod_helpers_1.renameProp)(j, source, localName, { header: 'title' });
16
+ (0, codemod_helpers_1.renameSubComponent)(j, source, localName, 'Header', 'Title');
17
+ (0, codemod_helpers_1.renameSubComponent)(j, source, localName, 'Text', 'Description');
18
+ return source.toSource();
19
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parser = void 0;
4
+ exports.default = transformer;
5
+ var codemod_helpers_1 = require("../../codemod-helpers");
6
+ exports.parser = 'tsx';
7
+ function transformer(file, api, options) {
8
+ var alias = options.alias;
9
+ var j = api.jscodeshift;
10
+ var source = j(file.source);
11
+ var localName = (0, codemod_helpers_1.getImportInfo)(j, file, 'RichCell', alias).localName;
12
+ if (localName) {
13
+ (0, codemod_helpers_1.renameProp)(j, source, localName, {
14
+ subhead: 'overTitle',
15
+ text: 'subtitle',
16
+ caption: 'extraSubtitle',
17
+ });
18
+ }
19
+ return source.toSource();
20
+ }