@transferwise/components 46.119.5 → 46.120.1

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 (140) hide show
  1. package/build/alert/Alert.js +1 -1
  2. package/build/alert/Alert.js.map +1 -1
  3. package/build/alert/Alert.mjs +1 -1
  4. package/build/alert/Alert.mjs.map +1 -1
  5. package/build/checkbox/Checkbox.js +1 -1
  6. package/build/checkbox/Checkbox.js.map +1 -1
  7. package/build/checkbox/Checkbox.mjs +1 -1
  8. package/build/checkbox/Checkbox.mjs.map +1 -1
  9. package/build/common/initials.js +17 -7
  10. package/build/common/initials.js.map +1 -1
  11. package/build/common/initials.mjs +17 -7
  12. package/build/common/initials.mjs.map +1 -1
  13. package/build/field/Field.js +8 -4
  14. package/build/field/Field.js.map +1 -1
  15. package/build/field/Field.mjs +8 -4
  16. package/build/field/Field.mjs.map +1 -1
  17. package/build/inlineAlert/InlineAlert.js +1 -7
  18. package/build/inlineAlert/InlineAlert.js.map +1 -1
  19. package/build/inlineAlert/InlineAlert.mjs +1 -7
  20. package/build/inlineAlert/InlineAlert.mjs.map +1 -1
  21. package/build/main.css +20 -1
  22. package/build/prompt/InlinePrompt/InlinePrompt.js +2 -0
  23. package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -1
  24. package/build/prompt/InlinePrompt/InlinePrompt.mjs +2 -0
  25. package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
  26. package/build/radioGroup/RadioGroup.js +1 -0
  27. package/build/radioGroup/RadioGroup.js.map +1 -1
  28. package/build/radioGroup/RadioGroup.mjs +1 -0
  29. package/build/radioGroup/RadioGroup.mjs.map +1 -1
  30. package/build/styles/field/Field.css +10 -1
  31. package/build/styles/main.css +20 -1
  32. package/build/styles/prompt/InlinePrompt/InlinePrompt.css +3 -0
  33. package/build/styles/radioGroup/RadioGroup.css +3 -0
  34. package/build/styles/typeahead/Typeahead.css +4 -0
  35. package/build/typeahead/Typeahead.js +20 -7
  36. package/build/typeahead/Typeahead.js.map +1 -1
  37. package/build/typeahead/Typeahead.mjs +20 -7
  38. package/build/typeahead/Typeahead.mjs.map +1 -1
  39. package/build/types/alert/Alert.d.ts +1 -1
  40. package/build/types/alert/Alert.d.ts.map +1 -1
  41. package/build/types/common/initials.d.ts.map +1 -1
  42. package/build/types/field/Field.d.ts +8 -4
  43. package/build/types/field/Field.d.ts.map +1 -1
  44. package/build/types/inlineAlert/InlineAlert.d.ts +1 -7
  45. package/build/types/inlineAlert/InlineAlert.d.ts.map +1 -1
  46. package/build/types/listItem/_stories/variants/helpers.d.ts +7 -4
  47. package/build/types/listItem/_stories/variants/helpers.d.ts.map +1 -1
  48. package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts +6 -1
  49. package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts.map +1 -1
  50. package/build/types/radioGroup/RadioGroup.d.ts.map +1 -1
  51. package/build/types/test-utils/index.d.ts +0 -1
  52. package/build/types/test-utils/index.d.ts.map +1 -1
  53. package/build/types/typeahead/Typeahead.d.ts +8 -4
  54. package/build/types/typeahead/Typeahead.d.ts.map +1 -1
  55. package/build/types/upload/Upload.d.ts +1 -1
  56. package/build/types/upload/steps/uploadImageStep/uploadImageStep.d.ts.map +1 -1
  57. package/build/upload/Upload.js.map +1 -1
  58. package/build/upload/Upload.mjs.map +1 -1
  59. package/build/upload/steps/uploadImageStep/uploadImageStep.js +5 -4
  60. package/build/upload/steps/uploadImageStep/uploadImageStep.js.map +1 -1
  61. package/build/upload/steps/uploadImageStep/uploadImageStep.mjs +5 -4
  62. package/build/upload/steps/uploadImageStep/uploadImageStep.mjs.map +1 -1
  63. package/package.json +9 -8
  64. package/src/DisabledComponents.story.tsx +1 -3
  65. package/src/actionButton/ActionButton.story.tsx +42 -45
  66. package/src/alert/Alert.spec.tsx +1 -1
  67. package/src/alert/Alert.tsx +2 -2
  68. package/src/avatar/Avatar.story.tsx +192 -188
  69. package/src/button/_stories/Button.tests.story.tsx +122 -119
  70. package/src/carousel/Carousel.story.tsx +4 -7
  71. package/src/checkbox/Checkbox.story.tsx +42 -21
  72. package/src/checkbox/Checkbox.tsx +1 -1
  73. package/src/checkbox/__snapshots__/Checkbox.spec.tsx.snap +1 -1
  74. package/src/circularButton/CircularButton.story.tsx +10 -2
  75. package/src/common/bottomSheet/BottomSheet.story.tsx +48 -14
  76. package/src/common/circle/Circle.story.tsx +62 -55
  77. package/src/common/initials.spec.tsx +31 -0
  78. package/src/common/initials.ts +19 -8
  79. package/src/criticalBanner/CriticalCommsBanner.story.tsx +30 -19
  80. package/src/dateInput/DateInput.tests.story.tsx +101 -74
  81. package/src/dateLookup/DateLookup.story.tsx +69 -59
  82. package/src/field/Field.css +10 -1
  83. package/src/field/Field.less +13 -2
  84. package/src/field/Field.spec.tsx +19 -3
  85. package/src/field/Field.story.tsx +18 -0
  86. package/src/field/Field.tsx +17 -5
  87. package/src/header/Header.story.tsx +5 -16
  88. package/src/header/Header.tests.story.tsx +95 -69
  89. package/src/info/Info.story.tsx +27 -11
  90. package/src/inlineAlert/InlineAlert.story.tsx +4 -0
  91. package/src/inlineAlert/InlineAlert.tsx +1 -7
  92. package/src/instructionsList/InstructionsList.story.tsx +0 -1
  93. package/src/listItem/_stories/ListItem.layout.test.story.tsx +1 -3
  94. package/src/listItem/_stories/variants/ListItem.brightGreen.test.story.tsx +77 -35
  95. package/src/listItem/_stories/variants/ListItem.dark.test.story.tsx +65 -29
  96. package/src/listItem/_stories/variants/ListItem.forestGreen.test.story.tsx +77 -35
  97. package/src/listItem/_stories/variants/ListItem.medium.test.story.tsx +38 -18
  98. package/src/listItem/_stories/variants/ListItem.neutral.test.story.tsx +0 -1
  99. package/src/listItem/_stories/variants/ListItem.personal.test.story.tsx +38 -18
  100. package/src/listItem/_stories/variants/ListItem.rtl.test.story.tsx +77 -29
  101. package/src/listItem/_stories/variants/ListItem.small.test.story.tsx +65 -18
  102. package/src/listItem/_stories/variants/helpers.tsx +136 -133
  103. package/src/main.css +20 -1
  104. package/src/main.less +1 -0
  105. package/src/modal/Modal.story.tsx +47 -8
  106. package/src/moneyInput/MoneyInput.story.tsx +2 -2
  107. package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.story.tsx +1 -0
  108. package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.tests.story.tsx +1 -0
  109. package/src/primitives/PrimitiveButton/stories/PrimitiveButton.story.tsx +1 -0
  110. package/src/primitives/PrimitiveButton/stories/PrimitiveButton.tests.story.tsx +1 -0
  111. package/src/prompt/InlinePrompt/InlinePrompt.css +3 -0
  112. package/src/prompt/InlinePrompt/InlinePrompt.less +5 -1
  113. package/src/prompt/InlinePrompt/InlinePrompt.spec.tsx +17 -0
  114. package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +35 -0
  115. package/src/prompt/InlinePrompt/InlinePrompt.tsx +7 -0
  116. package/src/provider/theme/ThemeProvider.story.tsx +1 -0
  117. package/src/radioGroup/RadioGroup.css +3 -0
  118. package/src/radioGroup/RadioGroup.less +3 -0
  119. package/src/radioGroup/RadioGroup.story.tsx +2 -0
  120. package/src/radioGroup/RadioGroup.test.story.tsx +62 -0
  121. package/src/radioGroup/RadioGroup.tsx +6 -1
  122. package/src/segmentedControl/SegmentedControl.story.tsx +71 -67
  123. package/src/snackbar/Snackbar.tests.story.tsx +116 -114
  124. package/src/statusIcon/StatusIcon.story.tsx +41 -38
  125. package/src/test-utils/index.tsx +0 -2
  126. package/src/tokens/tokens.story.tsx +1 -1
  127. package/src/tooltip/Tooltip.story.tsx +10 -2
  128. package/src/typeahead/Typeahead.css +4 -0
  129. package/src/typeahead/Typeahead.less +5 -1
  130. package/src/typeahead/Typeahead.spec.tsx +1 -1
  131. package/src/typeahead/Typeahead.story.tsx +151 -3
  132. package/src/typeahead/Typeahead.tsx +33 -9
  133. package/src/upload/Upload.story.tsx +1 -1
  134. package/src/upload/Upload.tests.story.tsx +36 -1
  135. package/src/upload/Upload.tsx +1 -1
  136. package/src/upload/steps/uploadImageStep/uploadImageStep.tsx +7 -3
  137. package/src/withId/withId.story.tsx +1 -1
  138. package/build/types/test-utils/story-config.d.ts +0 -64
  139. package/build/types/test-utils/story-config.d.ts.map +0 -1
  140. package/src/test-utils/story-config.ts +0 -95
@@ -3,9 +3,9 @@ import * as wiseIcons from '@transferwise/icons';
3
3
  import { Flag } from '@wise/art';
4
4
 
5
5
  import { Size } from '../common';
6
- import { storyConfig } from '../test-utils';
7
6
 
8
7
  import Avatar, { AvatarType } from '.';
8
+ import { allModes } from '../../.storybook/modes';
9
9
 
10
10
  /**
11
11
  * @deprecated use **`AvatarView`** components instead
@@ -40,193 +40,197 @@ export const FlagStory: Story = {
40
40
  },
41
41
  };
42
42
 
43
- export const Table: Story = storyConfig(
44
- {
45
- render: () => {
46
- const flagJPY = <Flag code="JPY" />;
47
- const flagGBP = <Flag code="GBP" />;
48
- const backgroundColor = '#d6f5e3';
49
- const emoji = '✈️';
50
- const initials = 'GN';
51
- const Icon = wiseIcons.Check;
43
+ export const Table: Story = {
44
+ render: () => {
45
+ const flagJPY = <Flag code="JPY" />;
46
+ const flagGBP = <Flag code="GBP" />;
47
+ const backgroundColor = '#d6f5e3';
48
+ const emoji = '✈️';
49
+ const initials = 'GN';
50
+ const Icon = wiseIcons.Check;
52
51
 
53
- return (
54
- <div>
55
- <table>
56
- Outlined
57
- <tr>
58
- <td>
59
- <Avatar size={Size.LARGE} type={AvatarType.THUMBNAIL} outlined>
60
- {flagJPY}
61
- </Avatar>
62
- </td>
63
- <td>
64
- <Avatar size={56} type={AvatarType.THUMBNAIL} outlined>
65
- {flagJPY}
66
- </Avatar>
67
- </td>
68
- <td>
69
- <Avatar size={Size.MEDIUM} type={AvatarType.THUMBNAIL} outlined>
70
- {flagJPY}
71
- </Avatar>
72
- </td>
73
- <td>
74
- <Avatar size={40} type={AvatarType.THUMBNAIL} outlined>
75
- {flagJPY}
76
- </Avatar>
77
- </td>
78
- <td>
79
- <Avatar size={Size.SMALL} type={AvatarType.THUMBNAIL} outlined>
80
- {flagJPY}
81
- </Avatar>
82
- </td>
83
- </tr>
84
- Image URL
85
- <tr>
86
- <td>
87
- <Avatar size={Size.LARGE} type={AvatarType.THUMBNAIL}>
88
- {flagGBP}
89
- </Avatar>
90
- </td>
91
- <td>
92
- <Avatar size={56} type={AvatarType.THUMBNAIL}>
93
- {flagGBP}
94
- </Avatar>
95
- </td>
96
- <td>
97
- <Avatar size={Size.MEDIUM} type={AvatarType.THUMBNAIL}>
98
- {flagGBP}
99
- </Avatar>
100
- </td>
101
- <td>
102
- <Avatar size={40} type={AvatarType.THUMBNAIL}>
103
- {flagGBP}
104
- </Avatar>
105
- </td>
106
- <td>
107
- <Avatar size={Size.SMALL} type={AvatarType.THUMBNAIL}>
108
- {flagGBP}
109
- </Avatar>
110
- </td>
111
- </tr>
112
- Emoji
113
- <tr>
114
- <td>
115
- <Avatar size={Size.LARGE} type={AvatarType.EMOJI}>
116
- {emoji}
117
- </Avatar>
118
- </td>
119
- <td>
120
- <Avatar size={56} type={AvatarType.EMOJI}>
121
- {emoji}
122
- </Avatar>
123
- </td>
124
- <td>
125
- <Avatar size={Size.MEDIUM} type={AvatarType.EMOJI}>
126
- {emoji}
127
- </Avatar>
128
- </td>
129
- <td>
130
- <Avatar size={40} type={AvatarType.EMOJI}>
131
- {emoji}
132
- </Avatar>
133
- </td>
134
- <td>
135
- <Avatar size={Size.SMALL} type={AvatarType.EMOJI}>
136
- {emoji}
137
- </Avatar>
138
- </td>
139
- </tr>
140
- <div style={{ paddingBottom: '20px' }}>
141
- <span style={{ position: 'absolute' }}>Custom background and icon</span>
142
- </div>
143
- <tr>
144
- <td>
145
- <Avatar size={Size.LARGE} type={AvatarType.ICON} backgroundColor={backgroundColor}>
146
- <Icon size={24} />
147
- </Avatar>
148
- </td>
149
- <td>
150
- <Avatar size={56} type={AvatarType.ICON} backgroundColor={backgroundColor}>
151
- <Icon size={24} />
152
- </Avatar>
153
- </td>
154
- <td>
155
- <Avatar size={Size.MEDIUM} type={AvatarType.ICON} backgroundColor={backgroundColor}>
156
- <Icon size={24} />
157
- </Avatar>
158
- </td>
159
- <td>
160
- <Avatar size={40} type={AvatarType.ICON} backgroundColor={backgroundColor}>
161
- <Icon size={24} />
162
- </Avatar>
163
- </td>
164
- <td>
165
- <Avatar size={Size.SMALL} type={AvatarType.ICON} backgroundColor={backgroundColor}>
166
- <Icon size={16} />
167
- </Avatar>
168
- </td>
169
- </tr>
170
- Initials
171
- <tr>
172
- <td>
173
- <Avatar size={72} type={AvatarType.INITIALS}>
174
- {initials}
175
- </Avatar>
176
- </td>
177
- <td>
178
- <Avatar size={56} type={AvatarType.INITIALS}>
179
- {initials}
180
- </Avatar>
181
- </td>
182
- <td>
183
- <Avatar size={48} type={AvatarType.INITIALS}>
184
- {initials}
185
- </Avatar>
186
- </td>
187
- <td>
188
- <Avatar size={40} type={AvatarType.INITIALS}>
189
- {initials}
190
- </Avatar>
191
- </td>
192
- <td>
193
- <Avatar size={24} type={AvatarType.INITIALS}>
194
- {initials}
195
- </Avatar>
196
- </td>
197
- </tr>
198
- Branded
199
- <tr>
200
- <td>
201
- <Avatar size={72} type={AvatarType.INITIALS} backgroundColorSeed="1">
202
- {initials}
203
- </Avatar>
204
- </td>
205
- <td>
206
- <Avatar size={56} type={AvatarType.INITIALS} backgroundColorSeed="2">
207
- {initials}
208
- </Avatar>
209
- </td>
210
- <td>
211
- <Avatar size={48} type={AvatarType.INITIALS} backgroundColorSeed="3">
212
- {initials}
213
- </Avatar>
214
- </td>
215
- <td>
216
- <Avatar size={40} type={AvatarType.INITIALS} backgroundColorSeed="4">
217
- {initials}
218
- </Avatar>
219
- </td>
220
- <td>
221
- <Avatar size={24} type={AvatarType.INITIALS} backgroundColorSeed="5">
222
- {initials}
223
- </Avatar>
224
- </td>
225
- </tr>
226
- </table>
227
- </div>
228
- );
52
+ return (
53
+ <div>
54
+ <table>
55
+ Outlined
56
+ <tr>
57
+ <td>
58
+ <Avatar size={Size.LARGE} type={AvatarType.THUMBNAIL} outlined>
59
+ {flagJPY}
60
+ </Avatar>
61
+ </td>
62
+ <td>
63
+ <Avatar size={56} type={AvatarType.THUMBNAIL} outlined>
64
+ {flagJPY}
65
+ </Avatar>
66
+ </td>
67
+ <td>
68
+ <Avatar size={Size.MEDIUM} type={AvatarType.THUMBNAIL} outlined>
69
+ {flagJPY}
70
+ </Avatar>
71
+ </td>
72
+ <td>
73
+ <Avatar size={40} type={AvatarType.THUMBNAIL} outlined>
74
+ {flagJPY}
75
+ </Avatar>
76
+ </td>
77
+ <td>
78
+ <Avatar size={Size.SMALL} type={AvatarType.THUMBNAIL} outlined>
79
+ {flagJPY}
80
+ </Avatar>
81
+ </td>
82
+ </tr>
83
+ Image URL
84
+ <tr>
85
+ <td>
86
+ <Avatar size={Size.LARGE} type={AvatarType.THUMBNAIL}>
87
+ {flagGBP}
88
+ </Avatar>
89
+ </td>
90
+ <td>
91
+ <Avatar size={56} type={AvatarType.THUMBNAIL}>
92
+ {flagGBP}
93
+ </Avatar>
94
+ </td>
95
+ <td>
96
+ <Avatar size={Size.MEDIUM} type={AvatarType.THUMBNAIL}>
97
+ {flagGBP}
98
+ </Avatar>
99
+ </td>
100
+ <td>
101
+ <Avatar size={40} type={AvatarType.THUMBNAIL}>
102
+ {flagGBP}
103
+ </Avatar>
104
+ </td>
105
+ <td>
106
+ <Avatar size={Size.SMALL} type={AvatarType.THUMBNAIL}>
107
+ {flagGBP}
108
+ </Avatar>
109
+ </td>
110
+ </tr>
111
+ Emoji
112
+ <tr>
113
+ <td>
114
+ <Avatar size={Size.LARGE} type={AvatarType.EMOJI}>
115
+ {emoji}
116
+ </Avatar>
117
+ </td>
118
+ <td>
119
+ <Avatar size={56} type={AvatarType.EMOJI}>
120
+ {emoji}
121
+ </Avatar>
122
+ </td>
123
+ <td>
124
+ <Avatar size={Size.MEDIUM} type={AvatarType.EMOJI}>
125
+ {emoji}
126
+ </Avatar>
127
+ </td>
128
+ <td>
129
+ <Avatar size={40} type={AvatarType.EMOJI}>
130
+ {emoji}
131
+ </Avatar>
132
+ </td>
133
+ <td>
134
+ <Avatar size={Size.SMALL} type={AvatarType.EMOJI}>
135
+ {emoji}
136
+ </Avatar>
137
+ </td>
138
+ </tr>
139
+ <div style={{ paddingBottom: '20px' }}>
140
+ <span style={{ position: 'absolute' }}>Custom background and icon</span>
141
+ </div>
142
+ <tr>
143
+ <td>
144
+ <Avatar size={Size.LARGE} type={AvatarType.ICON} backgroundColor={backgroundColor}>
145
+ <Icon size={24} />
146
+ </Avatar>
147
+ </td>
148
+ <td>
149
+ <Avatar size={56} type={AvatarType.ICON} backgroundColor={backgroundColor}>
150
+ <Icon size={24} />
151
+ </Avatar>
152
+ </td>
153
+ <td>
154
+ <Avatar size={Size.MEDIUM} type={AvatarType.ICON} backgroundColor={backgroundColor}>
155
+ <Icon size={24} />
156
+ </Avatar>
157
+ </td>
158
+ <td>
159
+ <Avatar size={40} type={AvatarType.ICON} backgroundColor={backgroundColor}>
160
+ <Icon size={24} />
161
+ </Avatar>
162
+ </td>
163
+ <td>
164
+ <Avatar size={Size.SMALL} type={AvatarType.ICON} backgroundColor={backgroundColor}>
165
+ <Icon size={16} />
166
+ </Avatar>
167
+ </td>
168
+ </tr>
169
+ Initials
170
+ <tr>
171
+ <td>
172
+ <Avatar size={72} type={AvatarType.INITIALS}>
173
+ {initials}
174
+ </Avatar>
175
+ </td>
176
+ <td>
177
+ <Avatar size={56} type={AvatarType.INITIALS}>
178
+ {initials}
179
+ </Avatar>
180
+ </td>
181
+ <td>
182
+ <Avatar size={48} type={AvatarType.INITIALS}>
183
+ {initials}
184
+ </Avatar>
185
+ </td>
186
+ <td>
187
+ <Avatar size={40} type={AvatarType.INITIALS}>
188
+ {initials}
189
+ </Avatar>
190
+ </td>
191
+ <td>
192
+ <Avatar size={24} type={AvatarType.INITIALS}>
193
+ {initials}
194
+ </Avatar>
195
+ </td>
196
+ </tr>
197
+ Branded
198
+ <tr>
199
+ <td>
200
+ <Avatar size={72} type={AvatarType.INITIALS} backgroundColorSeed="1">
201
+ {initials}
202
+ </Avatar>
203
+ </td>
204
+ <td>
205
+ <Avatar size={56} type={AvatarType.INITIALS} backgroundColorSeed="2">
206
+ {initials}
207
+ </Avatar>
208
+ </td>
209
+ <td>
210
+ <Avatar size={48} type={AvatarType.INITIALS} backgroundColorSeed="3">
211
+ {initials}
212
+ </Avatar>
213
+ </td>
214
+ <td>
215
+ <Avatar size={40} type={AvatarType.INITIALS} backgroundColorSeed="4">
216
+ {initials}
217
+ </Avatar>
218
+ </td>
219
+ <td>
220
+ <Avatar size={24} type={AvatarType.INITIALS} backgroundColorSeed="5">
221
+ {initials}
222
+ </Avatar>
223
+ </td>
224
+ </tr>
225
+ </table>
226
+ </div>
227
+ );
228
+ },
229
+ parameters: {
230
+ variants: ['default', 'dark', 'rtl'],
231
+ chromatic: {
232
+ dark: allModes.dark,
233
+ rtl: allModes.rtl,
229
234
  },
230
235
  },
231
- { variants: ['default', 'dark', 'rtl'] },
232
- );
236
+ };
@@ -1,9 +1,9 @@
1
- import { Meta } from '@storybook/react-webpack5';
1
+ import { Meta, StoryObj } from '@storybook/react-webpack5';
2
2
  import { ArrowRight, ChevronRight, Freeze } from '@transferwise/icons';
3
3
  import { expect, userEvent, within } from 'storybook/test';
4
- import { storyConfig } from '../../test-utils';
5
4
  import Button from '../Button.resolver';
6
5
  import { ButtonPriority } from '../Button.types';
6
+ import { allModes } from '../../../.storybook/modes';
7
7
 
8
8
  const meta: Meta<typeof Button> = {
9
9
  component: Button,
@@ -12,128 +12,131 @@ const meta: Meta<typeof Button> = {
12
12
  };
13
13
  export default meta;
14
14
 
15
- export const FocusTertiary = storyConfig(
16
- {
17
- render: () => (
18
- <Button v2 priority="tertiary">
19
- Focus has underline
20
- </Button>
21
- ),
15
+ type Story = StoryObj<typeof Button>;
16
+
17
+ export const FocusTertiary: Story = {
18
+ render: () => (
19
+ <Button v2 priority="tertiary">
20
+ Focus has underline
21
+ </Button>
22
+ ),
23
+ play: async ({ canvasElement }) => {
24
+ await userEvent.tab();
25
+ const canvas = within(canvasElement);
26
+ const buttonElement: HTMLButtonElement = canvas.getByRole('button');
27
+ await expect(buttonElement).toHaveFocus();
22
28
  },
23
- {},
24
- );
25
- FocusTertiary.play = async ({ canvasElement }) => {
26
- await userEvent.tab();
27
- const canvas = within(canvasElement);
28
- const buttonElement: HTMLButtonElement = canvas.getByRole('button');
29
- await expect(buttonElement).toHaveFocus();
30
29
  };
31
30
 
32
31
  const buttonPriorities = ['primary', 'secondary', 'secondary-neutral', 'tertiary'] as const;
33
32
  const buttonSizes = ['sm', 'md', 'lg'] as const;
34
- export const AllVariants = storyConfig(
35
- {
36
- tags: ['!autodocs'],
37
- parameters: {
38
- padding: '0',
33
+ export const AllVariants: Story = {
34
+ tags: ['!autodocs'],
35
+ parameters: {
36
+ padding: '0',
37
+ variants: ['default', 'dark', 'bright-green', 'forest-green', 'rtl'],
38
+ chromatic: {
39
+ dark: allModes.dark,
40
+ brightGreen: allModes.brightGreen,
41
+ forestGreen: allModes.forestGreen,
42
+ rtl: allModes.rtl,
39
43
  },
40
- render: () => (
41
- <div
42
- className="button-variants"
43
- style={{ display: 'flex', flexWrap: 'wrap', gap: '16px', maxWidth: '1200px' }}
44
- >
45
- {buttonPriorities.map((priority) =>
46
- buttonSizes.map((size) => (
47
- <div
48
- key={`${priority}-default-${size}`}
49
- style={{ flex: '1 0 30%', marginBottom: '16px', justifyContent: 'space-between' }}
44
+ },
45
+ render: () => (
46
+ <div
47
+ className="button-variants"
48
+ style={{ display: 'flex', flexWrap: 'wrap', gap: '16px', maxWidth: '1200px' }}
49
+ >
50
+ {buttonPriorities.map((priority) =>
51
+ buttonSizes.map((size) => (
52
+ <div
53
+ key={`${priority}-default-${size}`}
54
+ style={{ flex: '1 0 30%', marginBottom: '16px', justifyContent: 'space-between' }}
55
+ >
56
+ <Button
57
+ v2
58
+ priority={priority as ButtonPriority}
59
+ size={size}
60
+ addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
61
+ addonEnd={{ type: 'icon', value: <ArrowRight /> }}
62
+ block
50
63
  >
51
- <Button
52
- v2
53
- priority={priority as ButtonPriority}
54
- size={size}
55
- addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
56
- addonEnd={{ type: 'icon', value: <ArrowRight /> }}
57
- block
58
- >
59
- {`${priority} default ${size}`}
60
- </Button>
61
- <Button
62
- className="m-t-1 m-b-1"
63
- v2
64
- priority={priority as ButtonPriority}
65
- size={size}
66
- addonStart={{
67
- type: 'avatar',
68
- value: [{ asset: <Freeze /> }, { asset: <Freeze /> }],
69
- }}
70
- addonEnd={{ type: 'icon', value: <ArrowRight /> }}
71
- block
72
- disabled
73
- >
74
- {`${priority} default ${size} Disabled`}
75
- </Button>
76
- <Button
77
- v2
78
- priority={priority as ButtonPriority}
79
- size={size}
80
- addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
81
- addonEnd={{ type: 'icon', value: <ArrowRight /> }}
82
- block
83
- loading
84
- >
85
- {`${priority} default ${size} Loading`}
86
- </Button>
87
- </div>
88
- )),
89
- )}
90
- {['primary', 'secondary'].map((priority) =>
91
- buttonSizes.map((size) => (
92
- <div
93
- key={`${priority}-negative-${size}`}
94
- style={{ flex: '1 0 30%', marginBottom: '16px', justifyContent: 'space-between' }}
64
+ {`${priority} default ${size}`}
65
+ </Button>
66
+ <Button
67
+ className="m-t-1 m-b-1"
68
+ v2
69
+ priority={priority as ButtonPriority}
70
+ size={size}
71
+ addonStart={{
72
+ type: 'avatar',
73
+ value: [{ asset: <Freeze /> }, { asset: <Freeze /> }],
74
+ }}
75
+ addonEnd={{ type: 'icon', value: <ArrowRight /> }}
76
+ block
77
+ disabled
95
78
  >
96
- <Button
97
- v2
98
- sentiment="negative"
99
- priority={priority as ButtonPriority}
100
- size={size}
101
- addonEnd={{ type: 'icon', value: <ChevronRight /> }}
102
- addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
103
- block
104
- >
105
- {`${priority} negative ${size}`}
106
- </Button>
107
- <Button
108
- className="m-t-1 m-b-1"
109
- v2
110
- sentiment="negative"
111
- priority={priority as ButtonPriority}
112
- size={size}
113
- addonEnd={{ type: 'icon', value: <ChevronRight /> }}
114
- addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
115
- block
116
- disabled
117
- >
118
- {`${priority} negative ${size} Disabled`}
119
- </Button>
120
- <Button
121
- v2
122
- sentiment="negative"
123
- priority={priority as ButtonPriority}
124
- size={size}
125
- addonEnd={{ type: 'icon', value: <ChevronRight /> }}
126
- addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
127
- block
128
- loading
129
- >
130
- {`${priority} negative ${size} Loading`}
131
- </Button>
132
- </div>
133
- )),
134
- )}
135
- </div>
136
- ),
137
- },
138
- { variants: ['default', 'dark', 'bright-green', 'forest-green', 'rtl'] },
139
- );
79
+ {`${priority} default ${size} Disabled`}
80
+ </Button>
81
+ <Button
82
+ v2
83
+ priority={priority as ButtonPriority}
84
+ size={size}
85
+ addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
86
+ addonEnd={{ type: 'icon', value: <ArrowRight /> }}
87
+ block
88
+ loading
89
+ >
90
+ {`${priority} default ${size} Loading`}
91
+ </Button>
92
+ </div>
93
+ )),
94
+ )}
95
+ {['primary', 'secondary'].map((priority) =>
96
+ buttonSizes.map((size) => (
97
+ <div
98
+ key={`${priority}-negative-${size}`}
99
+ style={{ flex: '1 0 30%', marginBottom: '16px', justifyContent: 'space-between' }}
100
+ >
101
+ <Button
102
+ v2
103
+ sentiment="negative"
104
+ priority={priority as ButtonPriority}
105
+ size={size}
106
+ addonEnd={{ type: 'icon', value: <ChevronRight /> }}
107
+ addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
108
+ block
109
+ >
110
+ {`${priority} negative ${size}`}
111
+ </Button>
112
+ <Button
113
+ className="m-t-1 m-b-1"
114
+ v2
115
+ sentiment="negative"
116
+ priority={priority as ButtonPriority}
117
+ size={size}
118
+ addonEnd={{ type: 'icon', value: <ChevronRight /> }}
119
+ addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
120
+ block
121
+ disabled
122
+ >
123
+ {`${priority} negative ${size} Disabled`}
124
+ </Button>
125
+ <Button
126
+ v2
127
+ sentiment="negative"
128
+ priority={priority as ButtonPriority}
129
+ size={size}
130
+ addonEnd={{ type: 'icon', value: <ChevronRight /> }}
131
+ addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
132
+ block
133
+ loading
134
+ >
135
+ {`${priority} negative ${size} Loading`}
136
+ </Button>
137
+ </div>
138
+ )),
139
+ )}
140
+ </div>
141
+ ),
142
+ };