@kaizen/components 0.0.0-canary-generic-tile-testing-2-20250815051607 → 0.0.0-canary-test-v1-codemod-runner-20250821061337
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/codemods/migrateV2NextToCurrent/migrateV2NextToCurrent.spec.ts +7 -5
- package/codemods/migrateV2NextToCurrent/migrateV2NextToCurrent.ts +2 -2
- package/codemods/runV1Codemods/README.md +65 -0
- package/codemods/runV1Codemods/index.ts +218 -0
- package/codemods/runV1Codemods/runV1Codemods.ts +151 -0
- package/dist/styles.css +22 -22
- package/package.json +1 -1
- package/src/Tile/subcomponents/GenericTile/GenericTile.spec.stories.tsx +8 -3
|
@@ -500,7 +500,7 @@ import type { Menu as KZMenu, MenuItem as KZMenuItem } from "@kaizen/components"
|
|
|
500
500
|
describe('Module path transformations', () => {
|
|
501
501
|
it('should transform react-aria module path', () => {
|
|
502
502
|
const inputAst = parseJsx(`import { Button } from "@kaizen/components/v3/react-aria"`)
|
|
503
|
-
const expectedAst = parseJsx(`import { Button } from "@kaizen/components/react-aria"`)
|
|
503
|
+
const expectedAst = parseJsx(`import { Button } from "@kaizen/components/libs/react-aria"`)
|
|
504
504
|
|
|
505
505
|
const result = transformComponents(inputAst)
|
|
506
506
|
expect(result).toBe(printAst(expectedAst))
|
|
@@ -511,7 +511,7 @@ import type { Menu as KZMenu, MenuItem as KZMenuItem } from "@kaizen/components"
|
|
|
511
511
|
`import { TextField } from "@kaizen/components/v3/react-aria-components"`,
|
|
512
512
|
)
|
|
513
513
|
const expectedAst = parseJsx(
|
|
514
|
-
`import { TextField } from "@kaizen/components/react-aria-components"`,
|
|
514
|
+
`import { TextField } from "@kaizen/components/libs/react-aria-components"`,
|
|
515
515
|
)
|
|
516
516
|
|
|
517
517
|
const result = transformComponents(inputAst)
|
|
@@ -520,7 +520,9 @@ import type { Menu as KZMenu, MenuItem as KZMenuItem } from "@kaizen/components"
|
|
|
520
520
|
|
|
521
521
|
it('should handle multiple imports from react-aria modules', () => {
|
|
522
522
|
const inputAst = parseJsx(`import { Button, Link } from "@kaizen/components/v3/react-aria"`)
|
|
523
|
-
const expectedAst = parseJsx(
|
|
523
|
+
const expectedAst = parseJsx(
|
|
524
|
+
`import { Button, Link } from "@kaizen/components/libs/react-aria"`,
|
|
525
|
+
)
|
|
524
526
|
|
|
525
527
|
const result = transformComponents(inputAst)
|
|
526
528
|
expect(result).toBe(printAst(expectedAst))
|
|
@@ -531,7 +533,7 @@ import type { Menu as KZMenu, MenuItem as KZMenuItem } from "@kaizen/components"
|
|
|
531
533
|
`import { Button as AriaButton } from "@kaizen/components/v3/react-aria"`,
|
|
532
534
|
)
|
|
533
535
|
const expectedAst = parseJsx(
|
|
534
|
-
`import { Button as AriaButton } from "@kaizen/components/react-aria"`,
|
|
536
|
+
`import { Button as AriaButton } from "@kaizen/components/libs/react-aria"`,
|
|
535
537
|
)
|
|
536
538
|
|
|
537
539
|
const result = transformComponents(inputAst)
|
|
@@ -545,7 +547,7 @@ import { Button } from "@kaizen/components/v3/react-aria"
|
|
|
545
547
|
`)
|
|
546
548
|
const expectedAst = parseJsx(`
|
|
547
549
|
import { Menu } from "@kaizen/components"
|
|
548
|
-
import { Button } from "@kaizen/components/react-aria"
|
|
550
|
+
import { Button } from "@kaizen/components/libs/react-aria"
|
|
549
551
|
`)
|
|
550
552
|
|
|
551
553
|
const result = transformComponents(inputAst)
|
|
@@ -49,8 +49,8 @@ const componentGroups: ComponentGroup[] = [
|
|
|
49
49
|
const renameMap = createRenameMapFromGroups(componentGroups)
|
|
50
50
|
|
|
51
51
|
const modulePathMap = new Map([
|
|
52
|
-
['@kaizen/components/v3/react-aria', '@kaizen/components/react-aria'],
|
|
53
|
-
['@kaizen/components/v3/react-aria-components', '@kaizen/components/react-aria-components'],
|
|
52
|
+
['@kaizen/components/v3/react-aria', '@kaizen/components/libs/react-aria'],
|
|
53
|
+
['@kaizen/components/v3/react-aria-components', '@kaizen/components/libs/react-aria-components'],
|
|
54
54
|
])
|
|
55
55
|
|
|
56
56
|
export const migrateV2NextToCurrent =
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# runV1Codemods
|
|
2
|
+
|
|
3
|
+
A comprehensive codemod that runs all V1 migration codemods in the correct sequence.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This codemod executes all 17 V1 migration codemods in the order as pre-work to migrate to `kaizen/component@2.0.0` Kaizen components. After this you will still need to run the `migrateV2NextToCurrent` and `renameV2ComponentImportsAndUsages` after upgrading to `kaizen/component@2.0.0`
|
|
8
|
+
|
|
9
|
+
This codemod runner handles the following:
|
|
10
|
+
|
|
11
|
+
- Icon upgrades (`upgradeIconV1`)
|
|
12
|
+
- Button migrations (`upgradeV1Buttons`)
|
|
13
|
+
- GuidanceBlock actions migration (`migrateGuidanceBlockActionsToActionsSlot`)
|
|
14
|
+
- Mood to variant migrations for multiple components
|
|
15
|
+
- Variant to color migrations
|
|
16
|
+
- Type to variant migrations for notifications
|
|
17
|
+
- Removal of deprecated props
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm kaizen-codemod {target-directory} runV1Codemods
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Example
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pnpm kaizen-codemod src runV1Codemods
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## What it does
|
|
32
|
+
|
|
33
|
+
The codemod runs the following transformations in sequence:
|
|
34
|
+
|
|
35
|
+
1. **upgradeIconV1** - Migrates V1 Icon components to next Icon
|
|
36
|
+
2. **upgradeV1Buttons** - Migrates V1 Button and IconButton to next Button/LinkButton
|
|
37
|
+
3. **migrateGuidanceBlockActionsToActionsSlot** - Migrates GuidanceBlock actions prop to actionsSlot
|
|
38
|
+
4. **migrateBrandMomentMoodToVariant** - Changes `mood` prop to `variant` on BrandMoment
|
|
39
|
+
5. **migrateCardVariantToColor** - Changes `variant` prop to `color` on Card
|
|
40
|
+
6. **migrateConfirmationModalMoodsToVariant** - Changes `mood` prop to `variant` on ConfirmationModal
|
|
41
|
+
7. **migrateEmptyStateIllustrationTypeToVariant** - Changes `illustrationType` prop to `variant` on EmptyState
|
|
42
|
+
8. **migrateGlobalNotificationTypeToVariant** - Changes `type` prop to `variant` on GlobalNotification
|
|
43
|
+
9. **migrateInformationTileMoodToVariant** - Changes `mood` prop to `variant` on InformationTile
|
|
44
|
+
10. **migrateInlineNotificationTypeToVariant** - Changes `type` prop to `variant` on InlineNotification
|
|
45
|
+
11. **migrateMultiActionTileMoodToVariant** - Changes `mood` prop to `variant` on MultiActionTile
|
|
46
|
+
12. **migrateNotificationTypeToVariant** - Changes `type` prop to `variant` on Notification
|
|
47
|
+
13. **migrateProgressBarMoodToColor** - Changes `mood` prop to `color` on ProgressBar
|
|
48
|
+
14. **migrateToastNotificationTypeToVariant** - Changes `type` prop to `variant` on ToastNotification
|
|
49
|
+
15. **migrateWellVariantToColor** - Changes `variant` prop to `color` on Well
|
|
50
|
+
16. **removeInputEditModalMood** - Removes deprecated `mood` prop from InputEditModal
|
|
51
|
+
17. **removePopoverVariant** - Removes deprecated `variant` and `customIcon` props from Popover
|
|
52
|
+
|
|
53
|
+
## Error Handling
|
|
54
|
+
|
|
55
|
+
- If any individual codemod fails, the process continues with the remaining codemods
|
|
56
|
+
- Detailed logging shows the start and completion status of each codemod
|
|
57
|
+
- A summary is provided at the end showing successful vs failed codemods
|
|
58
|
+
|
|
59
|
+
## Cautions and caveats
|
|
60
|
+
|
|
61
|
+
This will create a lot of diffs and changes to your components as the codemod will traverse an entire directory.
|
|
62
|
+
|
|
63
|
+
To reduce the scope, consider either running this on component or page directories or running the mode incrementally, ie:
|
|
64
|
+
|
|
65
|
+
`pnpm kaizen-codemod src/components/MockComponent runV1Codemods`
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { transformBrandMomentMoodToVariant } from '../migrateBrandMomentMoodToVariant/transformBrandMomentMoodToVariant'
|
|
2
|
+
import { transformCardVariantToColor } from '../migrateCardVariantToColor/transformCardVariantToColor'
|
|
3
|
+
import { transformConfirmationModalMoodsToVariant } from '../migrateConfirmationModalMoodsToVariant/transformConfirmationModalMoodsToVariant'
|
|
4
|
+
import { transformEmptyStateIllustrationTypeToVariant } from '../migrateEmptyStateIllustrationTypeToVariant/transformEmptyStateIllustrationTypeToVariant'
|
|
5
|
+
import { migrateGuidanceBlockActionsToActionsSlot } from '../migrateGuidanceBlockActionsToActionsSlot/migrateGuidanceBlockActionsToActionsSlot'
|
|
6
|
+
import { transformInformationTileMoodToVariant } from '../migrateInformationTileMoodToVariant/transformInformationTileMoodToVariant'
|
|
7
|
+
import { transformMultiActionTileMoodToVariant } from '../migrateMultiActionTileMoodToVariant/transformMultiActionTileMoodToVariant'
|
|
8
|
+
import { transformNotificationTypeToVariant } from '../migrateNotificationTypeToVariant/migrateNotificationTypeToVariant'
|
|
9
|
+
import { transformProgressBarMoodToColor } from '../migrateProgressBarMoodToColor/transformProgressBarMoodToColor'
|
|
10
|
+
import { transformWellVariantToColor } from '../migrateWellVariantToColor/transformWellVariantToColor'
|
|
11
|
+
import { removeInputEditModalMood } from '../removeInputEditModalMood/removeInputEditModalMood'
|
|
12
|
+
import { removePopoverVariant } from '../removePopoverVariant/removePopoverVariant'
|
|
13
|
+
import { upgradeIconV1 } from '../upgradeIconV1/upgradeIconV1'
|
|
14
|
+
import { upgradeV1Buttons } from '../upgradeV1Buttons/upgradeV1Buttons'
|
|
15
|
+
import { transformComponentsInDir, transformComponentsInDirByPattern } from '../utils'
|
|
16
|
+
|
|
17
|
+
interface CodemodConfig {
|
|
18
|
+
name: string
|
|
19
|
+
runner: (targetDir: string) => void
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const run = (): void => {
|
|
23
|
+
console.log('🚀 Running all V1 codemods in sequence')
|
|
24
|
+
console.log('')
|
|
25
|
+
console.log('This will run the following codemods in order:')
|
|
26
|
+
console.log('1. upgradeIconV1')
|
|
27
|
+
console.log('2. upgradeV1Buttons')
|
|
28
|
+
console.log('3. migrateGuidanceBlockActionsToActionsSlot')
|
|
29
|
+
console.log('4. migrateBrandMomentMoodToVariant')
|
|
30
|
+
console.log('5. migrateCardVariantToColor')
|
|
31
|
+
console.log('6. migrateConfirmationModalMoodsToVariant')
|
|
32
|
+
console.log('7. migrateEmptyStateIllustrationTypeToVariant')
|
|
33
|
+
console.log('8. migrateGlobalNotificationTypeToVariant')
|
|
34
|
+
console.log('9. migrateInformationTileMoodToVariant')
|
|
35
|
+
console.log('10. migrateInlineNotificationTypeToVariant')
|
|
36
|
+
console.log('11. migrateMultiActionTileMoodToVariant')
|
|
37
|
+
console.log('12. migrateNotificationTypeToVariant')
|
|
38
|
+
console.log('13. migrateProgressBarMoodToColor')
|
|
39
|
+
console.log('14. migrateToastNotificationTypeToVariant')
|
|
40
|
+
console.log('15. migrateWellVariantToColor')
|
|
41
|
+
console.log('16. removeInputEditModalMood')
|
|
42
|
+
console.log('17. removePopoverVariant')
|
|
43
|
+
console.log('')
|
|
44
|
+
|
|
45
|
+
const targetDir = process.argv[2]
|
|
46
|
+
if (!targetDir) {
|
|
47
|
+
console.error('Error: Target directory is required')
|
|
48
|
+
process.exit(1)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const codemods: CodemodConfig[] = [
|
|
52
|
+
{
|
|
53
|
+
name: 'upgradeIconV1',
|
|
54
|
+
runner: (dir) => {
|
|
55
|
+
transformComponentsInDirByPattern(dir, 'Icon$', (tagNames) => [upgradeIconV1(tagNames)])
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'upgradeV1Buttons',
|
|
60
|
+
runner: (dir) => {
|
|
61
|
+
transformComponentsInDir(dir, ['IconButton', 'Button'], (tagNames) => [
|
|
62
|
+
upgradeV1Buttons(tagNames),
|
|
63
|
+
])
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'migrateGuidanceBlockActionsToActionsSlot',
|
|
68
|
+
runner: (dir) => {
|
|
69
|
+
transformComponentsInDir(dir, ['GuidanceBlock'], (tagNames) => [
|
|
70
|
+
migrateGuidanceBlockActionsToActionsSlot(tagNames),
|
|
71
|
+
])
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'migrateBrandMomentMoodToVariant',
|
|
76
|
+
runner: (dir) => {
|
|
77
|
+
transformComponentsInDir(dir, ['BrandMoment'], (tagNames) => [
|
|
78
|
+
transformBrandMomentMoodToVariant(tagNames),
|
|
79
|
+
])
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'migrateCardVariantToColor',
|
|
84
|
+
runner: (dir) => {
|
|
85
|
+
transformComponentsInDir(dir, ['Card'], (tagNames) => [
|
|
86
|
+
transformCardVariantToColor(tagNames),
|
|
87
|
+
])
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'migrateConfirmationModalMoodsToVariant',
|
|
92
|
+
runner: (dir) => {
|
|
93
|
+
transformComponentsInDir(dir, ['ConfirmationModal'], (tagNames) => [
|
|
94
|
+
transformConfirmationModalMoodsToVariant(tagNames),
|
|
95
|
+
])
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: 'migrateEmptyStateIllustrationTypeToVariant',
|
|
100
|
+
runner: (dir) => {
|
|
101
|
+
transformComponentsInDir(dir, ['EmptyState'], (tagNames) => [
|
|
102
|
+
transformEmptyStateIllustrationTypeToVariant(tagNames),
|
|
103
|
+
])
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: 'migrateGlobalNotificationTypeToVariant',
|
|
108
|
+
runner: (dir) => {
|
|
109
|
+
transformComponentsInDir(dir, ['GlobalNotification'], (tagNames) => [
|
|
110
|
+
transformNotificationTypeToVariant(tagNames),
|
|
111
|
+
])
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: 'migrateInformationTileMoodToVariant',
|
|
116
|
+
runner: (dir) => {
|
|
117
|
+
transformComponentsInDir(dir, ['InformationTile'], (tagNames) => [
|
|
118
|
+
transformInformationTileMoodToVariant(tagNames),
|
|
119
|
+
])
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: 'migrateInlineNotificationTypeToVariant',
|
|
124
|
+
runner: (dir) => {
|
|
125
|
+
transformComponentsInDir(dir, ['InlineNotification'], (tagNames) => [
|
|
126
|
+
transformNotificationTypeToVariant(tagNames),
|
|
127
|
+
])
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: 'migrateMultiActionTileMoodToVariant',
|
|
132
|
+
runner: (dir) => {
|
|
133
|
+
transformComponentsInDir(dir, ['MultiActionTile'], (tagNames) => [
|
|
134
|
+
transformMultiActionTileMoodToVariant(tagNames),
|
|
135
|
+
])
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: 'migrateNotificationTypeToVariant',
|
|
140
|
+
runner: (dir) => {
|
|
141
|
+
transformComponentsInDir(dir, ['Notification'], (tagNames) => [
|
|
142
|
+
transformNotificationTypeToVariant(tagNames),
|
|
143
|
+
])
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: 'migrateProgressBarMoodToColor',
|
|
148
|
+
runner: (dir) => {
|
|
149
|
+
transformComponentsInDir(dir, ['ProgressBar'], (tagNames) => [
|
|
150
|
+
transformProgressBarMoodToColor(tagNames),
|
|
151
|
+
])
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: 'migrateToastNotificationTypeToVariant',
|
|
156
|
+
runner: (dir) => {
|
|
157
|
+
transformComponentsInDir(dir, ['ToastNotification'], (tagNames) => [
|
|
158
|
+
transformNotificationTypeToVariant(tagNames),
|
|
159
|
+
])
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: 'migrateWellVariantToColor',
|
|
164
|
+
runner: (dir) => {
|
|
165
|
+
transformComponentsInDir(dir, ['Well'], (tagNames) => [
|
|
166
|
+
transformWellVariantToColor(tagNames),
|
|
167
|
+
])
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: 'removeInputEditModalMood',
|
|
172
|
+
runner: (dir) => {
|
|
173
|
+
transformComponentsInDir(dir, ['InputEditModal'], (tagNames) => [
|
|
174
|
+
removeInputEditModalMood(tagNames),
|
|
175
|
+
])
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
name: 'removePopoverVariant',
|
|
180
|
+
runner: (dir) => {
|
|
181
|
+
transformComponentsInDir(dir, ['Popover'], (tagNames) => [removePopoverVariant(tagNames)])
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
]
|
|
185
|
+
|
|
186
|
+
console.log(`📝 Running ${codemods.length} codemods on directory: ${targetDir}`)
|
|
187
|
+
console.log('')
|
|
188
|
+
|
|
189
|
+
let successCount = 0
|
|
190
|
+
let errorCount = 0
|
|
191
|
+
|
|
192
|
+
for (const codemod of codemods) {
|
|
193
|
+
try {
|
|
194
|
+
console.log(`🔄 Starting codemod: ${codemod.name}`)
|
|
195
|
+
codemod.runner(targetDir)
|
|
196
|
+
console.log(`✅ Completed codemod: ${codemod.name}`)
|
|
197
|
+
successCount++
|
|
198
|
+
} catch (error) {
|
|
199
|
+
console.error(`❌ Error in codemod: ${codemod.name}`)
|
|
200
|
+
console.error(error)
|
|
201
|
+
errorCount++
|
|
202
|
+
}
|
|
203
|
+
console.log('')
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
console.log('📊 Summary:')
|
|
207
|
+
console.log(`✅ Successful codemods: ${successCount}`)
|
|
208
|
+
console.log(`❌ Failed codemods: ${errorCount}`)
|
|
209
|
+
console.log(`🎯 Total codemods: ${codemods.length}`)
|
|
210
|
+
|
|
211
|
+
if (errorCount > 0) {
|
|
212
|
+
console.log('\n⚠️ Some codemods failed. Please review the errors above.')
|
|
213
|
+
} else {
|
|
214
|
+
console.log('\n🎉 All codemods completed successfully!')
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
run()
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { transformBrandMomentMoodToVariant } from '../migrateBrandMomentMoodToVariant/transformBrandMomentMoodToVariant'
|
|
2
|
+
import { transformCardVariantToColor } from '../migrateCardVariantToColor/transformCardVariantToColor'
|
|
3
|
+
import { transformConfirmationModalMoodsToVariant } from '../migrateConfirmationModalMoodsToVariant/transformConfirmationModalMoodsToVariant'
|
|
4
|
+
import { transformEmptyStateIllustrationTypeToVariant } from '../migrateEmptyStateIllustrationTypeToVariant/transformEmptyStateIllustrationTypeToVariant'
|
|
5
|
+
import { migrateGuidanceBlockActionsToActionsSlot } from '../migrateGuidanceBlockActionsToActionsSlot/migrateGuidanceBlockActionsToActionsSlot'
|
|
6
|
+
import { transformInformationTileMoodToVariant } from '../migrateInformationTileMoodToVariant/transformInformationTileMoodToVariant'
|
|
7
|
+
import { transformMultiActionTileMoodToVariant } from '../migrateMultiActionTileMoodToVariant/transformMultiActionTileMoodToVariant'
|
|
8
|
+
import { transformNotificationTypeToVariant } from '../migrateNotificationTypeToVariant/migrateNotificationTypeToVariant'
|
|
9
|
+
import { transformProgressBarMoodToColor } from '../migrateProgressBarMoodToColor/transformProgressBarMoodToColor'
|
|
10
|
+
import { transformWellVariantToColor } from '../migrateWellVariantToColor/transformWellVariantToColor'
|
|
11
|
+
import { removeInputEditModalMood } from '../removeInputEditModalMood/removeInputEditModalMood'
|
|
12
|
+
import { removePopoverVariant } from '../removePopoverVariant/removePopoverVariant'
|
|
13
|
+
import { upgradeIconV1 } from '../upgradeIconV1/upgradeIconV1'
|
|
14
|
+
import { upgradeV1Buttons } from '../upgradeV1Buttons/upgradeV1Buttons'
|
|
15
|
+
import { transformComponentsInDir, transformComponentsInDirByPattern } from '../utils'
|
|
16
|
+
|
|
17
|
+
interface CodemodConfig {
|
|
18
|
+
name: string
|
|
19
|
+
runner: (targetDir: string) => void
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const codemods: CodemodConfig[] = [
|
|
23
|
+
{
|
|
24
|
+
name: 'upgradeIconV1',
|
|
25
|
+
runner: (dir) => {
|
|
26
|
+
transformComponentsInDirByPattern(dir, 'Icon$', (tagNames) => [upgradeIconV1(tagNames)])
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'upgradeV1Buttons',
|
|
31
|
+
runner: (dir) => {
|
|
32
|
+
transformComponentsInDir(dir, ['IconButton', 'Button'], (tagNames) => [
|
|
33
|
+
upgradeV1Buttons(tagNames),
|
|
34
|
+
])
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'migrateGuidanceBlockActionsToActionsSlot',
|
|
39
|
+
runner: (dir) => {
|
|
40
|
+
transformComponentsInDir(dir, ['GuidanceBlock'], (tagNames) => [
|
|
41
|
+
migrateGuidanceBlockActionsToActionsSlot(tagNames),
|
|
42
|
+
])
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'migrateBrandMomentMoodToVariant',
|
|
47
|
+
runner: (dir) => {
|
|
48
|
+
transformComponentsInDir(dir, ['BrandMoment'], (tagNames) => [
|
|
49
|
+
transformBrandMomentMoodToVariant(tagNames),
|
|
50
|
+
])
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'migrateCardVariantToColor',
|
|
55
|
+
runner: (dir) => {
|
|
56
|
+
transformComponentsInDir(dir, ['Card'], (tagNames) => [transformCardVariantToColor(tagNames)])
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'migrateConfirmationModalMoodsToVariant',
|
|
61
|
+
runner: (dir) => {
|
|
62
|
+
transformComponentsInDir(dir, ['ConfirmationModal'], (tagNames) => [
|
|
63
|
+
transformConfirmationModalMoodsToVariant(tagNames),
|
|
64
|
+
])
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'migrateEmptyStateIllustrationTypeToVariant',
|
|
69
|
+
runner: (dir) => {
|
|
70
|
+
transformComponentsInDir(dir, ['EmptyState'], (tagNames) => [
|
|
71
|
+
transformEmptyStateIllustrationTypeToVariant(tagNames),
|
|
72
|
+
])
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'migrateGlobalNotificationTypeToVariant',
|
|
77
|
+
runner: (dir) => {
|
|
78
|
+
transformComponentsInDir(dir, ['GlobalNotification'], (tagNames) => [
|
|
79
|
+
transformNotificationTypeToVariant(tagNames),
|
|
80
|
+
])
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: 'migrateInformationTileMoodToVariant',
|
|
85
|
+
runner: (dir) => {
|
|
86
|
+
transformComponentsInDir(dir, ['InformationTile'], (tagNames) => [
|
|
87
|
+
transformInformationTileMoodToVariant(tagNames),
|
|
88
|
+
])
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: 'migrateInlineNotificationTypeToVariant',
|
|
93
|
+
runner: (dir) => {
|
|
94
|
+
transformComponentsInDir(dir, ['InlineNotification'], (tagNames) => [
|
|
95
|
+
transformNotificationTypeToVariant(tagNames),
|
|
96
|
+
])
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'migrateMultiActionTileMoodToVariant',
|
|
101
|
+
runner: (dir) => {
|
|
102
|
+
transformComponentsInDir(dir, ['MultiActionTile'], (tagNames) => [
|
|
103
|
+
transformMultiActionTileMoodToVariant(tagNames),
|
|
104
|
+
])
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'migrateNotificationTypeToVariant',
|
|
109
|
+
runner: (dir) => {
|
|
110
|
+
transformComponentsInDir(dir, ['Notification'], (tagNames) => [
|
|
111
|
+
transformNotificationTypeToVariant(tagNames),
|
|
112
|
+
])
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: 'migrateProgressBarMoodToColor',
|
|
117
|
+
runner: (dir) => {
|
|
118
|
+
transformComponentsInDir(dir, ['ProgressBar'], (tagNames) => [
|
|
119
|
+
transformProgressBarMoodToColor(tagNames),
|
|
120
|
+
])
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: 'migrateToastNotificationTypeToVariant',
|
|
125
|
+
runner: (dir) => {
|
|
126
|
+
transformComponentsInDir(dir, ['ToastNotification'], (tagNames) => [
|
|
127
|
+
transformNotificationTypeToVariant(tagNames),
|
|
128
|
+
])
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: 'migrateWellVariantToColor',
|
|
133
|
+
runner: (dir) => {
|
|
134
|
+
transformComponentsInDir(dir, ['Well'], (tagNames) => [transformWellVariantToColor(tagNames)])
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: 'removeInputEditModalMood',
|
|
139
|
+
runner: (dir) => {
|
|
140
|
+
transformComponentsInDir(dir, ['InputEditModal'], (tagNames) => [
|
|
141
|
+
removeInputEditModalMood(tagNames),
|
|
142
|
+
])
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: 'removePopoverVariant',
|
|
147
|
+
runner: (dir) => {
|
|
148
|
+
transformComponentsInDir(dir, ['Popover'], (tagNames) => [removePopoverVariant(tagNames)])
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
]
|
package/dist/styles.css
CHANGED
|
@@ -7,12 +7,22 @@
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
@layer kz-components {
|
|
10
|
-
.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
.Trigger-module_button__giSqA {
|
|
11
|
+
anchor-name: var(--anchor-name);
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
font-family: var(--typography-paragraph-body-font-family);
|
|
16
|
+
font-weight: var(--typography-paragraph-body-font-weight);
|
|
17
|
+
font-size: var(--typography-paragraph-body-font-size);
|
|
18
|
+
line-height: var(--typography-paragraph-body-line-height);
|
|
19
|
+
letter-spacing: var(--typography-paragraph-body-letter-spacing);
|
|
20
|
+
padding: var(--spacing-12);
|
|
21
|
+
min-height: var(--spacing-48);
|
|
22
|
+
min-width: var(--spacing-200);
|
|
23
|
+
background-color: var(--color-white);
|
|
24
|
+
border-radius: var(--spacing-8);
|
|
25
|
+
border: 1px solid var(--color-gray-500);
|
|
16
26
|
}
|
|
17
27
|
}
|
|
18
28
|
|
|
@@ -34,22 +44,12 @@
|
|
|
34
44
|
}
|
|
35
45
|
|
|
36
46
|
@layer kz-components {
|
|
37
|
-
.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
font-weight: var(--typography-paragraph-body-font-weight);
|
|
44
|
-
font-size: var(--typography-paragraph-body-font-size);
|
|
45
|
-
line-height: var(--typography-paragraph-body-line-height);
|
|
46
|
-
letter-spacing: var(--typography-paragraph-body-letter-spacing);
|
|
47
|
-
padding: var(--spacing-12);
|
|
48
|
-
min-height: var(--spacing-48);
|
|
49
|
-
min-width: var(--spacing-200);
|
|
50
|
-
background-color: var(--color-white);
|
|
51
|
-
border-radius: var(--spacing-8);
|
|
52
|
-
border: 1px solid var(--color-gray-500);
|
|
47
|
+
.ListSection-module_listSectionHeader__bptHg {
|
|
48
|
+
font-family: var(--typography-heading-5-font-family);
|
|
49
|
+
font-weight: var(--typography-heading-5-font-weight);
|
|
50
|
+
font-size: var(--typography-heading-5-font-size);
|
|
51
|
+
line-height: var(--typography-heading-5-line-height);
|
|
52
|
+
letter-spacing: var(--typography-heading-5-letter-spacing);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaizen/components",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-test-v1-codemod-runner-20250821061337",
|
|
4
4
|
"description": "Kaizen component library",
|
|
5
5
|
"author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
|
|
6
6
|
"homepage": "https://cultureamp.design",
|
|
@@ -20,12 +20,17 @@ type Story = StoryObj<typeof GenericTile>
|
|
|
20
20
|
export const Flip: Story = {
|
|
21
21
|
play: async ({ canvasElement, step }) => {
|
|
22
22
|
const canvas = within(canvasElement)
|
|
23
|
+
const buttonWithInfoLabel = await canvas.findByRole('button', {
|
|
24
|
+
name: 'View more information: Title',
|
|
25
|
+
})
|
|
23
26
|
|
|
24
27
|
await step('initial render complete', async () => {
|
|
28
|
+
expect(buttonWithInfoLabel).toBeInTheDocument()
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
await step('Can focus to button', async () => {
|
|
25
32
|
await waitFor(() => {
|
|
26
|
-
|
|
27
|
-
name: 'View more information: Title',
|
|
28
|
-
})
|
|
33
|
+
buttonWithInfoLabel.click()
|
|
29
34
|
})
|
|
30
35
|
})
|
|
31
36
|
|