@kaizen/components 0.0.0-canary-button-codemod-canary-20250212054517 → 0.0.0-canary-stacking-context-fix-20250225001220

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 (47) hide show
  1. package/bin/codemod.sh +0 -2
  2. package/codemods/README.md +0 -45
  3. package/codemods/utils/createProp.spec.ts +19 -75
  4. package/codemods/utils/createProp.ts +1 -8
  5. package/codemods/utils/getKaioTagName.ts +5 -13
  6. package/codemods/utils/index.ts +0 -1
  7. package/dist/cjs/Filter/FilterBar/subcomponents/FilterBarButton/FilterBarButton.cjs +1 -0
  8. package/dist/cjs/Filter/FilterMultiSelect/subcomponents/Trigger/FilterTriggerButton/FilterTriggerButton.cjs +1 -0
  9. package/dist/cjs/Filter/FilterMultiSelect/subcomponents/Trigger/RemovableFilterTrigger/RemovableFilterTrigger.cjs +1 -0
  10. package/dist/cjs/index.cjs +2 -0
  11. package/dist/esm/Filter/FilterBar/subcomponents/FilterBarButton/FilterBarButton.mjs +1 -0
  12. package/dist/esm/Filter/FilterMultiSelect/subcomponents/Trigger/FilterTriggerButton/FilterTriggerButton.mjs +1 -0
  13. package/dist/esm/Filter/FilterMultiSelect/subcomponents/Trigger/RemovableFilterTrigger/RemovableFilterTrigger.mjs +1 -0
  14. package/dist/esm/index.mjs +1 -0
  15. package/dist/styles.css +8647 -8640
  16. package/dist/types/Filter/FilterBar/subcomponents/FilterBarButton/FilterBarButton.d.ts +1 -1
  17. package/dist/types/Filter/FilterButton/index.d.ts +1 -0
  18. package/dist/types/Filter/FilterMultiSelect/types.d.ts +2 -1
  19. package/dist/types/RichTextEditor/utils/commands/fixtures/helpers.d.ts +0 -1
  20. package/dist/types/RichTextEditor/utils/commands/fixtures/index.d.ts +2 -0
  21. package/dist/types/RichTextEditor/utils/commands/fixtures/mockRangeForBoundingRect.d.ts +1 -0
  22. package/dist/types/__rc__/Icon/constants.d.ts +1 -1
  23. package/package.json +6 -1
  24. package/src/Filter/FilterButton/index.ts +1 -0
  25. package/src/Filter/FilterMultiSelect/types.ts +3 -1
  26. package/src/RichTextEditor/utils/commands/addMark.spec.ts +1 -5
  27. package/src/RichTextEditor/utils/commands/fixtures/helpers.ts +0 -31
  28. package/src/RichTextEditor/utils/commands/fixtures/index.ts +2 -0
  29. package/src/RichTextEditor/utils/commands/fixtures/mockRangeForBoundingRect.ts +32 -0
  30. package/src/TitleBlockZen/TitleBlockZen.module.scss +1 -6
  31. package/src/__rc__/Button/_docs/Button--usage-guidelines.mdx +170 -1
  32. package/src/__rc__/Button/_docs/Button.docs.stories.tsx +264 -9
  33. package/src/__rc__/Button/_docs/assets/button_anatomy.png +0 -0
  34. package/src/__rc__/Button/_docs/assets/button_icon_only_spec.png +0 -0
  35. package/src/__rc__/Button/_docs/assets/button_icon_spec.png +0 -0
  36. package/src/__rc__/Button/_docs/assets/button_spec.png +0 -0
  37. package/src/__rc__/Icon/constants.ts +1 -0
  38. package/src/__rc__/Tabs/subcomponents/Tab/Tab.module.css +5 -2
  39. package/src/__rc__/Tabs/subcomponents/TabList/TabList.module.css +11 -4
  40. package/codemods/upgradeV1Buttons/index.ts +0 -19
  41. package/codemods/upgradeV1Buttons/transformV1ButtonAttributes.spec.ts +0 -202
  42. package/codemods/upgradeV1Buttons/transformV1ButtonAttributes.ts +0 -132
  43. package/codemods/upgradeV1Buttons/upgradeV1Buttons.spec.ts +0 -658
  44. package/codemods/upgradeV1Buttons/upgradeV1Buttons.ts +0 -93
  45. package/codemods/utils/createJsxElementWithChildren.spec.ts +0 -119
  46. package/codemods/utils/createJsxElementWithChildren.ts +0 -55
  47. package/src/__rc__/Button/_docs/Button--migration-guide.mdx +0 -58
@@ -2,7 +2,17 @@ import React from 'react'
2
2
  import { action } from '@storybook/addon-actions'
3
3
  import { type Meta, type StoryObj } from '@storybook/react'
4
4
  import { Badge } from '~components/Badge'
5
- import { Icon } from '~components/__rc__'
5
+ import { EmptyState } from '~components/EmptyState'
6
+ import {
7
+ Icon,
8
+ Menu,
9
+ MenuItem,
10
+ MenuPopover,
11
+ MenuTrigger,
12
+ Select,
13
+ Tooltip,
14
+ TooltipTrigger,
15
+ } from '~components/__rc__'
6
16
  import { ReversedColors } from '~components/__utilities__/v3'
7
17
  import { Button } from '../index'
8
18
 
@@ -15,7 +25,7 @@ const meta = {
15
25
  },
16
26
  argTypes: {
17
27
  icon: {
18
- options: ['delete', 'arrow', 'plus'],
28
+ options: ['delete', 'arrow', 'add'],
19
29
  mapping: {
20
30
  delete: <Icon isPresentational name="delete" />,
21
31
  arrow: <Icon isPresentational name="arrow_forward" />,
@@ -60,13 +70,6 @@ export const ButtonVariantsReversed: Story = {
60
70
  reverseColors: true,
61
71
  backgrounds: { default: 'Purple 700' },
62
72
  },
63
- decorators: [
64
- (Story) => (
65
- <div className="flex gap-8">
66
- <Story />
67
- </div>
68
- ),
69
- ],
70
73
  }
71
74
 
72
75
  export const ButtonSizes: Story = {
@@ -136,3 +139,255 @@ export const ButtonWithBadge: Story = {
136
139
  ),
137
140
  },
138
141
  }
142
+
143
+ // Dos and Donts
144
+
145
+ export const DoExamplePrimaryAndSecondary: Story = {
146
+ render: () => {
147
+ return (
148
+ <>
149
+ <Button variant="primary" className="me-8">
150
+ Submit
151
+ </Button>
152
+ <Button variant="secondary">Cancel</Button>
153
+ </>
154
+ )
155
+ },
156
+ decorators: [
157
+ (Story) => (
158
+ <div className="flex gap-8">
159
+ <Story />
160
+ </div>
161
+ ),
162
+ ],
163
+ }
164
+
165
+ export const DontExamplePrimaryAndSecondary: Story = {
166
+ render: () => {
167
+ return (
168
+ <>
169
+ <Button variant="primary" className="me-8">
170
+ Submit
171
+ </Button>
172
+ <Button variant="primary">Cancel</Button>
173
+ </>
174
+ )
175
+ },
176
+ decorators: [
177
+ (Story) => (
178
+ <div className="flex gap-8">
179
+ <Story />
180
+ </div>
181
+ ),
182
+ ],
183
+ }
184
+
185
+ export const DoExampleCta: Story = {
186
+ render: () => {
187
+ return (
188
+ <>
189
+ <EmptyState
190
+ headingProps={{ children: 'Lorem', variant: 'heading-2', tag: 'span' }}
191
+ bodyText="Ipsum dolor sit amet consectetur adipisicing elit."
192
+ >
193
+ <Button size="large">Action</Button>
194
+ </EmptyState>
195
+ </>
196
+ )
197
+ },
198
+ }
199
+
200
+ export const DoExampleDefaultToMediumSize: Story = {
201
+ render: () => {
202
+ return (
203
+ <>
204
+ <Select items={[]} label="Choose country"></Select>
205
+ <Button className="mt-8">Save</Button>
206
+ </>
207
+ )
208
+ },
209
+ }
210
+
211
+ export const DontExampleDefaultToMediumSize: Story = {
212
+ render: () => {
213
+ return (
214
+ <>
215
+ <Select items={[]} label="Choose country"></Select>
216
+ <Button className="mt-8" variant="primary" size="small">
217
+ Save
218
+ </Button>
219
+ </>
220
+ )
221
+ },
222
+ }
223
+
224
+ export const DoExampleUseIconsSparingly: Story = {
225
+ args: {
226
+ children: 'Add user',
227
+ icon: <Icon isPresentational name="add" />,
228
+ iconPosition: 'end',
229
+ },
230
+ }
231
+
232
+ export const DontExampleUseIconsSparingly: Story = {
233
+ args: {
234
+ children: 'Add user',
235
+ icon: <Icon isPresentational name="star" />,
236
+ iconPosition: 'end',
237
+ },
238
+ }
239
+
240
+ export const DoExampleUseTooltips: Story = {
241
+ args: {
242
+ children: 'Delete',
243
+ icon: <Icon isPresentational name="delete" />,
244
+ hasHiddenLabel: true,
245
+ variant: 'tertiary',
246
+ },
247
+ render: (args) => (
248
+ <TooltipTrigger>
249
+ <Button {...args} />
250
+ <Tooltip>Delete content</Tooltip>
251
+ </TooltipTrigger>
252
+ ),
253
+ }
254
+
255
+ export const DontExampleUseTooltips: Story = {
256
+ args: {
257
+ children: 'Delete',
258
+ icon: <Icon isPresentational name="delete" />,
259
+ hasHiddenLabel: true,
260
+ variant: 'tertiary',
261
+ },
262
+ }
263
+
264
+ export const DoExampleMenuButton: Story = {
265
+ render: () => (
266
+ <MenuTrigger defaultOpen={false}>
267
+ <Button
268
+ variant="secondary"
269
+ icon={<Icon name="keyboard_arrow_down" isPresentational />}
270
+ iconPosition="end"
271
+ >
272
+ Manage
273
+ </Button>
274
+ <MenuPopover>
275
+ <Menu>
276
+ <MenuItem icon={<Icon name="bookmark" isPresentational />}>Save</MenuItem>
277
+ <MenuItem icon={<Icon name="edit" isPresentational isFilled />}>Edit</MenuItem>
278
+ <MenuItem icon={<Icon name="delete" isPresentational isFilled />}>Delete</MenuItem>
279
+ </Menu>
280
+ </MenuPopover>
281
+ </MenuTrigger>
282
+ ),
283
+ }
284
+
285
+ export const DoExampleKebabMenuButton: Story = {
286
+ render: () => (
287
+ <TooltipTrigger>
288
+ <MenuTrigger defaultOpen={false}>
289
+ <Button
290
+ variant="secondary"
291
+ icon={<Icon name="more_horiz" isPresentational />}
292
+ iconPosition="end"
293
+ hasHiddenLabel
294
+ >
295
+ Manage
296
+ </Button>
297
+ <MenuPopover>
298
+ <Menu>
299
+ <MenuItem icon={<Icon name="bookmark" isPresentational />}>Save</MenuItem>
300
+ <MenuItem icon={<Icon name="edit" isPresentational isFilled />}>Edit</MenuItem>
301
+ <MenuItem icon={<Icon name="delete" isPresentational isFilled />}>Delete</MenuItem>
302
+ </Menu>
303
+ </MenuPopover>
304
+ </MenuTrigger>
305
+ <Tooltip>Manage</Tooltip>
306
+ </TooltipTrigger>
307
+ ),
308
+ }
309
+
310
+ export const DoExampleMinimalPunctuation: Story = {
311
+ args: {
312
+ children: 'View tour',
313
+ variant: 'secondary',
314
+ },
315
+ }
316
+
317
+ export const DontExampleMinimalPunctuation: Story = {
318
+ args: {
319
+ children: "What's new?",
320
+ variant: 'secondary',
321
+ },
322
+ }
323
+
324
+ export const DoExampleSecondPerson: Story = {
325
+ args: {
326
+ children: 'View your reports',
327
+ variant: 'secondary',
328
+ },
329
+ }
330
+
331
+ export const DontExampleSecondPerson: Story = {
332
+ args: {
333
+ children: 'View my reports',
334
+ variant: 'secondary',
335
+ },
336
+ }
337
+
338
+ export const DoExampleFunctionalLabels: Story = {
339
+ args: {
340
+ children: 'Edit report',
341
+ variant: 'secondary',
342
+ },
343
+ }
344
+
345
+ export const DontExampleFunctionalLabels: Story = {
346
+ args: {
347
+ children: 'Edit',
348
+ variant: 'secondary',
349
+ },
350
+ }
351
+
352
+ export const DoExampleClearAndConciseLabels: Story = {
353
+ args: {
354
+ children: 'Save',
355
+ variant: 'secondary',
356
+ },
357
+ }
358
+
359
+ export const DontExampleClearAndConciseLabels: Story = {
360
+ args: {
361
+ children: 'Go to next step',
362
+ variant: 'secondary',
363
+ },
364
+ }
365
+
366
+ export const DoExampleDeclareContext: Story = {
367
+ args: {
368
+ children: 'Create survey',
369
+ variant: 'secondary',
370
+ },
371
+ }
372
+
373
+ export const DontExampleDeclareContext: Story = {
374
+ args: {
375
+ children: 'Create',
376
+ variant: 'secondary',
377
+ },
378
+ }
379
+
380
+ export const DoExampleTertiaryButtonWithIcons: Story = {
381
+ args: {
382
+ children: 'Edit cycle',
383
+ variant: 'tertiary',
384
+ icon: <Icon isPresentational name="edit" />,
385
+ },
386
+ }
387
+
388
+ export const DontExampleTertiaryButtonWithIcons: Story = {
389
+ args: {
390
+ children: 'Edit cycle',
391
+ variant: 'tertiary',
392
+ },
393
+ }
@@ -130,6 +130,7 @@ export const iconDefaultSet = [
130
130
  'sentiment_satisfied',
131
131
  'sentiment_very_satisfied',
132
132
  'settings',
133
+ 'share',
133
134
  'sms',
134
135
  'south_east',
135
136
  'star',
@@ -23,7 +23,6 @@
23
23
  }
24
24
 
25
25
  &:focus-visible {
26
- background: var(--color-blue-100);
27
26
  color: var(--color-blue-500);
28
27
  border-color: var(--color-blue-500);
29
28
  }
@@ -37,9 +36,13 @@
37
36
  }
38
37
 
39
38
  &:not([data-disabled]):hover {
40
- background: var(--color-blue-100);
39
+ background: var(--color-blue-200);
41
40
  color: var(--color-blue-500);
42
41
  }
42
+
43
+ &:not([data-disabled]):active {
44
+ background: var(--color-blue-100);
45
+ }
43
46
  }
44
47
 
45
48
  .tab[data-selected] {
@@ -3,7 +3,7 @@
3
3
  }
4
4
 
5
5
  .tabList {
6
- border-bottom: 1px solid rgba(var(--color-gray-600-rgb), 0.1);
6
+ border-bottom: 1px solid var(--color-gray-300);
7
7
  padding: var(--spacing-6) 0 0;
8
8
  width: 100%;
9
9
  height: 100%;
@@ -42,7 +42,7 @@
42
42
 
43
43
  .leftArrow,
44
44
  .leftArrow:hover {
45
- border-right: 1px solid rgba(var(--color-gray-600-rgb), 0.1);
45
+ border-right: 1px solid var(--color-gray-300);
46
46
  }
47
47
 
48
48
  .rightArrow {
@@ -51,10 +51,17 @@
51
51
 
52
52
  .rightArrow,
53
53
  .rightArrow:hover {
54
- border-left: 1px solid rgba(var(--color-gray-600-rgb), 0.1);
54
+ border-left: 1px solid var(--color-gray-300);
55
55
  }
56
56
 
57
57
  .leftArrow:hover,
58
58
  .rightArrow:hover {
59
- background: var(--color-gray-200);
59
+ background: var(--color-blue-200);
60
+ color: var(--color-blue-500);
61
+ }
62
+
63
+ .leftArrow:active,
64
+ .rightArrow:active {
65
+ background: var(--color-blue-100);
66
+ color: var(--color-blue-500);
60
67
  }
@@ -1,19 +0,0 @@
1
- import { transformComponentsInDir } from '../utils'
2
- import { upgradeV1Buttons } from './upgradeV1Buttons'
3
-
4
- const run = (): void => {
5
- console.log('It is recommended that the `upgradeIconV1` codemod be run prior to this')
6
- console.log('---')
7
- console.log('~(-_- ~) Running V1 Buttons upgrade (~ -_-)~')
8
-
9
- const targetDir = process.argv[2]
10
- if (!targetDir) {
11
- process.exit(1)
12
- }
13
-
14
- transformComponentsInDir(targetDir, ['IconButton', 'Button'], (tagNames) => [
15
- upgradeV1Buttons(tagNames),
16
- ])
17
- }
18
-
19
- run()
@@ -1,202 +0,0 @@
1
- import ts from 'typescript'
2
- import { parseJsx } from '../__tests__/utils'
3
- import { createJsxElementWithChildren, printAst } from '../utils'
4
- import { transformV1ButtonAttributes } from './transformV1ButtonAttributes'
5
-
6
- export const mockedTransformer =
7
- (kaioComponentName: string) =>
8
- (context: ts.TransformationContext) =>
9
- (rootNode: ts.Node): ts.Node => {
10
- const visit = (node: ts.Node): ts.Node => {
11
- if (ts.isJsxSelfClosingElement(node)) {
12
- const { targetComponentName, newAttributes, childrenValue } = transformV1ButtonAttributes(
13
- node,
14
- kaioComponentName,
15
- )
16
- return createJsxElementWithChildren(targetComponentName, newAttributes, childrenValue)
17
- }
18
- return ts.visitEachChild(node, visit, context)
19
- }
20
- return ts.visitNode(rootNode, visit)
21
- }
22
-
23
- const transformInput = (
24
- sourceFile: ts.SourceFile,
25
- kaioComponentName: string = 'Button',
26
- ): string => {
27
- const result = ts.transform(sourceFile, [mockedTransformer(kaioComponentName)])
28
- const transformedSource = result.transformed[0] as ts.SourceFile
29
- return printAst(transformedSource)
30
- }
31
-
32
- describe('transformV1ButtonAttributes()', () => {
33
- it('changes label to children', () => {
34
- const inputAst = parseJsx('<Button label="Pancakes" />')
35
- const outputAst = parseJsx('<Button variant="secondary" size="large">Pancakes</Button>')
36
- expect(transformInput(inputAst)).toEqual(printAst(outputAst))
37
- })
38
-
39
- it('replaces IconButton with Button and changes label to children and adds hasHiddenLabel', () => {
40
- const inputAst = parseJsx('<IconButton icon={icon} label="Pancakes" />')
41
- const outputAst = parseJsx(
42
- '<Button icon={icon} variant="tertiary" size="large" hasHiddenLabel>Pancakes</Button>',
43
- )
44
- expect(transformInput(inputAst, 'IconButton')).toEqual(printAst(outputAst))
45
- })
46
-
47
- it('replaces V1 Buttons with LinkButton if href exists', () => {
48
- const inputAst = parseJsx('<Button label="Pancakes" href="#" />')
49
- const outputAst = parseJsx(
50
- '<LinkButton href="#" variant="secondary" size="large">Pancakes</LinkButton>',
51
- )
52
- expect(transformInput(inputAst)).toEqual(printAst(outputAst))
53
- })
54
-
55
- it('replaces V1 Buttons with LinkButton if component prop exists', () => {
56
- const inputAst = parseJsx('<Button label="Pancakes" component={Component} />')
57
- const outputAst = parseJsx(
58
- '<LinkButton component={Component} variant="secondary" size="large">Pancakes</LinkButton>',
59
- )
60
- expect(transformInput(inputAst)).toEqual(printAst(outputAst))
61
- })
62
-
63
- describe('transform existing props', () => {
64
- it('changes onClick to onPress', () => {
65
- const inputAst = parseJsx('<Button label="Pancakes" onClick={handleClick} />')
66
- const outputAst = parseJsx(
67
- '<Button onPress={handleClick} variant="secondary" size="large">Pancakes</Button>',
68
- )
69
- expect(transformInput(inputAst)).toEqual(printAst(outputAst))
70
- })
71
-
72
- it('changes reversed to isReversed', () => {
73
- const inputAst = parseJsx(`
74
- <>
75
- <Button label="Pancakes" reversed />
76
- <Button label="Pancakes" reversed={false} />
77
- </>
78
- `)
79
- const outputAst = parseJsx(`
80
- <>
81
- <Button isReversed variant="secondary" size="large">Pancakes</Button>
82
- <Button isReversed={false} variant="secondary" size="large">Pancakes</Button>
83
- </>
84
- `)
85
- expect(transformInput(inputAst)).toEqual(printAst(outputAst))
86
- })
87
-
88
- it('changes classNameOverride to className', () => {
89
- const inputAst = parseJsx('<Button label="Pancakes" classNameOverride="hello" />')
90
- const outputAst = parseJsx(
91
- '<Button className="hello" variant="secondary" size="large">Pancakes</Button>',
92
- )
93
- expect(transformInput(inputAst)).toEqual(printAst(outputAst))
94
- })
95
-
96
- it('changes data-automation-id to data-testid', () => {
97
- const inputAst = parseJsx('<Button label="Pancakes" data-automation-id="pancakes" />')
98
- const outputAst = parseJsx(
99
- '<Button data-testid="pancakes" variant="secondary" size="large">Pancakes</Button>',
100
- )
101
- expect(transformInput(inputAst)).toEqual(printAst(outputAst))
102
- })
103
-
104
- it('changes disabled to isDisabled', () => {
105
- const inputAst = parseJsx(`
106
- <>
107
- <Button label="Pancakes" disabled />
108
- <Button label="Pancakes" disabled={false} />
109
- </>
110
- `)
111
- const outputAst = parseJsx(`
112
- <>
113
- <Button isDisabled variant="secondary" size="large">Pancakes</Button>
114
- <Button isDisabled={false} variant="secondary" size="large">Pancakes</Button>
115
- </>
116
- `)
117
- expect(transformInput(inputAst)).toEqual(printAst(outputAst))
118
- })
119
-
120
- it('changes newTabAndIUnderstandTheAccessibilityImplications to target="_blank" and rel="noopener noreferrer"', () => {
121
- const inputAst = parseJsx(
122
- '<Button label="Pancakes" newTabAndIUnderstandTheAccessibilityImplications />',
123
- )
124
- const outputAst = parseJsx(
125
- '<Button target="_blank" rel="noopener noreferrer" variant="secondary" size="large">Pancakes</Button>',
126
- )
127
- expect(transformInput(inputAst)).toEqual(printAst(outputAst))
128
- })
129
-
130
- describe('transform variant', () => {
131
- it('changes default (undefined) for Button to variant secondary', () => {
132
- const inputAst = parseJsx('<Button label="Pancakes" />')
133
- const outputAst = parseJsx('<Button variant="secondary" size="large">Pancakes</Button>')
134
- expect(transformInput(inputAst)).toEqual(printAst(outputAst))
135
- })
136
-
137
- it('changes default (undefined) for IconButton to variant tertiary', () => {
138
- const inputAst = parseJsx('<IconButton label="Pancakes" />')
139
- const outputAst = parseJsx(
140
- '<Button variant="tertiary" size="large" hasHiddenLabel>Pancakes</Button>',
141
- )
142
- expect(transformInput(inputAst, 'IconButton')).toEqual(printAst(outputAst))
143
- })
144
-
145
- it('changes primary to variant primary', () => {
146
- const inputAst = parseJsx('<Button label="Pancakes" primary />')
147
- const outputAst = parseJsx('<Button variant="primary" size="large">Pancakes</Button>')
148
- expect(transformInput(inputAst)).toEqual(printAst(outputAst))
149
- })
150
-
151
- it('changes secondary to variant tertiary', () => {
152
- const inputAst = parseJsx('<Button label="Pancakes" secondary />')
153
- const outputAst = parseJsx('<Button variant="tertiary" size="large">Pancakes</Button>')
154
- expect(transformInput(inputAst)).toEqual(printAst(outputAst))
155
- })
156
-
157
- it('removes destructive', () => {
158
- const inputAst = parseJsx(`
159
- <>
160
- <Button label="Pancakes" destructive />
161
- <Button label="Pancakes" primary destructive />
162
- <Button label="Pancakes" secondary destructive />
163
- </>
164
- `)
165
- const outputAst = parseJsx(`
166
- <>
167
- <Button variant="secondary" size="large">Pancakes</Button>
168
- <Button variant="primary" size="large">Pancakes</Button>
169
- <Button variant="tertiary" size="large">Pancakes</Button>
170
- </>
171
- `)
172
- expect(transformInput(inputAst)).toEqual(printAst(outputAst))
173
- })
174
- })
175
-
176
- describe('transform size', () => {
177
- it('changes default (undefined) to large', () => {
178
- const inputAst = parseJsx('<Button label="Pancakes" />')
179
- const outputAst = parseJsx('<Button variant="secondary" size="large">Pancakes</Button>')
180
- expect(transformInput(inputAst)).toEqual(printAst(outputAst))
181
- })
182
-
183
- it('changes small to medium', () => {
184
- const inputAst = parseJsx('<Button label="Pancakes" size="small" />')
185
- const outputAst = parseJsx('<Button size="medium" variant="secondary">Pancakes</Button>')
186
- expect(transformInput(inputAst)).toEqual(printAst(outputAst))
187
- })
188
-
189
- it('changes regular to large', () => {
190
- const inputAst = parseJsx('<Button label="Pancakes" size="regular" />')
191
- const outputAst = parseJsx('<Button size="large" variant="secondary">Pancakes</Button>')
192
- expect(transformInput(inputAst)).toEqual(printAst(outputAst))
193
- })
194
-
195
- it('does not change a non-string value', () => {
196
- const inputAst = parseJsx('<Button label="Pancakes" size={size} />')
197
- const outputAst = parseJsx('<Button size={size} variant="secondary">Pancakes</Button>')
198
- expect(transformInput(inputAst)).toEqual(printAst(outputAst))
199
- })
200
- })
201
- })
202
- })