@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.
- package/build/alert/Alert.js +1 -1
- package/build/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs +1 -1
- package/build/alert/Alert.mjs.map +1 -1
- package/build/checkbox/Checkbox.js +1 -1
- package/build/checkbox/Checkbox.js.map +1 -1
- package/build/checkbox/Checkbox.mjs +1 -1
- package/build/checkbox/Checkbox.mjs.map +1 -1
- package/build/common/initials.js +17 -7
- package/build/common/initials.js.map +1 -1
- package/build/common/initials.mjs +17 -7
- package/build/common/initials.mjs.map +1 -1
- package/build/field/Field.js +8 -4
- package/build/field/Field.js.map +1 -1
- package/build/field/Field.mjs +8 -4
- package/build/field/Field.mjs.map +1 -1
- package/build/inlineAlert/InlineAlert.js +1 -7
- package/build/inlineAlert/InlineAlert.js.map +1 -1
- package/build/inlineAlert/InlineAlert.mjs +1 -7
- package/build/inlineAlert/InlineAlert.mjs.map +1 -1
- package/build/main.css +20 -1
- package/build/prompt/InlinePrompt/InlinePrompt.js +2 -0
- package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -1
- package/build/prompt/InlinePrompt/InlinePrompt.mjs +2 -0
- package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
- package/build/radioGroup/RadioGroup.js +1 -0
- package/build/radioGroup/RadioGroup.js.map +1 -1
- package/build/radioGroup/RadioGroup.mjs +1 -0
- package/build/radioGroup/RadioGroup.mjs.map +1 -1
- package/build/styles/field/Field.css +10 -1
- package/build/styles/main.css +20 -1
- package/build/styles/prompt/InlinePrompt/InlinePrompt.css +3 -0
- package/build/styles/radioGroup/RadioGroup.css +3 -0
- package/build/styles/typeahead/Typeahead.css +4 -0
- package/build/typeahead/Typeahead.js +20 -7
- package/build/typeahead/Typeahead.js.map +1 -1
- package/build/typeahead/Typeahead.mjs +20 -7
- package/build/typeahead/Typeahead.mjs.map +1 -1
- package/build/types/alert/Alert.d.ts +1 -1
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/build/types/common/initials.d.ts.map +1 -1
- package/build/types/field/Field.d.ts +8 -4
- package/build/types/field/Field.d.ts.map +1 -1
- package/build/types/inlineAlert/InlineAlert.d.ts +1 -7
- package/build/types/inlineAlert/InlineAlert.d.ts.map +1 -1
- package/build/types/listItem/_stories/variants/helpers.d.ts +7 -4
- package/build/types/listItem/_stories/variants/helpers.d.ts.map +1 -1
- package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts +6 -1
- package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts.map +1 -1
- package/build/types/radioGroup/RadioGroup.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +0 -1
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/build/types/typeahead/Typeahead.d.ts +8 -4
- package/build/types/typeahead/Typeahead.d.ts.map +1 -1
- package/build/types/upload/Upload.d.ts +1 -1
- package/build/types/upload/steps/uploadImageStep/uploadImageStep.d.ts.map +1 -1
- package/build/upload/Upload.js.map +1 -1
- package/build/upload/Upload.mjs.map +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.js +5 -4
- package/build/upload/steps/uploadImageStep/uploadImageStep.js.map +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.mjs +5 -4
- package/build/upload/steps/uploadImageStep/uploadImageStep.mjs.map +1 -1
- package/package.json +9 -8
- package/src/DisabledComponents.story.tsx +1 -3
- package/src/actionButton/ActionButton.story.tsx +42 -45
- package/src/alert/Alert.spec.tsx +1 -1
- package/src/alert/Alert.tsx +2 -2
- package/src/avatar/Avatar.story.tsx +192 -188
- package/src/button/_stories/Button.tests.story.tsx +122 -119
- package/src/carousel/Carousel.story.tsx +4 -7
- package/src/checkbox/Checkbox.story.tsx +42 -21
- package/src/checkbox/Checkbox.tsx +1 -1
- package/src/checkbox/__snapshots__/Checkbox.spec.tsx.snap +1 -1
- package/src/circularButton/CircularButton.story.tsx +10 -2
- package/src/common/bottomSheet/BottomSheet.story.tsx +48 -14
- package/src/common/circle/Circle.story.tsx +62 -55
- package/src/common/initials.spec.tsx +31 -0
- package/src/common/initials.ts +19 -8
- package/src/criticalBanner/CriticalCommsBanner.story.tsx +30 -19
- package/src/dateInput/DateInput.tests.story.tsx +101 -74
- package/src/dateLookup/DateLookup.story.tsx +69 -59
- package/src/field/Field.css +10 -1
- package/src/field/Field.less +13 -2
- package/src/field/Field.spec.tsx +19 -3
- package/src/field/Field.story.tsx +18 -0
- package/src/field/Field.tsx +17 -5
- package/src/header/Header.story.tsx +5 -16
- package/src/header/Header.tests.story.tsx +95 -69
- package/src/info/Info.story.tsx +27 -11
- package/src/inlineAlert/InlineAlert.story.tsx +4 -0
- package/src/inlineAlert/InlineAlert.tsx +1 -7
- package/src/instructionsList/InstructionsList.story.tsx +0 -1
- package/src/listItem/_stories/ListItem.layout.test.story.tsx +1 -3
- package/src/listItem/_stories/variants/ListItem.brightGreen.test.story.tsx +77 -35
- package/src/listItem/_stories/variants/ListItem.dark.test.story.tsx +65 -29
- package/src/listItem/_stories/variants/ListItem.forestGreen.test.story.tsx +77 -35
- package/src/listItem/_stories/variants/ListItem.medium.test.story.tsx +38 -18
- package/src/listItem/_stories/variants/ListItem.neutral.test.story.tsx +0 -1
- package/src/listItem/_stories/variants/ListItem.personal.test.story.tsx +38 -18
- package/src/listItem/_stories/variants/ListItem.rtl.test.story.tsx +77 -29
- package/src/listItem/_stories/variants/ListItem.small.test.story.tsx +65 -18
- package/src/listItem/_stories/variants/helpers.tsx +136 -133
- package/src/main.css +20 -1
- package/src/main.less +1 -0
- package/src/modal/Modal.story.tsx +47 -8
- package/src/moneyInput/MoneyInput.story.tsx +2 -2
- package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.story.tsx +1 -0
- package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.tests.story.tsx +1 -0
- package/src/primitives/PrimitiveButton/stories/PrimitiveButton.story.tsx +1 -0
- package/src/primitives/PrimitiveButton/stories/PrimitiveButton.tests.story.tsx +1 -0
- package/src/prompt/InlinePrompt/InlinePrompt.css +3 -0
- package/src/prompt/InlinePrompt/InlinePrompt.less +5 -1
- package/src/prompt/InlinePrompt/InlinePrompt.spec.tsx +17 -0
- package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +35 -0
- package/src/prompt/InlinePrompt/InlinePrompt.tsx +7 -0
- package/src/provider/theme/ThemeProvider.story.tsx +1 -0
- package/src/radioGroup/RadioGroup.css +3 -0
- package/src/radioGroup/RadioGroup.less +3 -0
- package/src/radioGroup/RadioGroup.story.tsx +2 -0
- package/src/radioGroup/RadioGroup.test.story.tsx +62 -0
- package/src/radioGroup/RadioGroup.tsx +6 -1
- package/src/segmentedControl/SegmentedControl.story.tsx +71 -67
- package/src/snackbar/Snackbar.tests.story.tsx +116 -114
- package/src/statusIcon/StatusIcon.story.tsx +41 -38
- package/src/test-utils/index.tsx +0 -2
- package/src/tokens/tokens.story.tsx +1 -1
- package/src/tooltip/Tooltip.story.tsx +10 -2
- package/src/typeahead/Typeahead.css +4 -0
- package/src/typeahead/Typeahead.less +5 -1
- package/src/typeahead/Typeahead.spec.tsx +1 -1
- package/src/typeahead/Typeahead.story.tsx +151 -3
- package/src/typeahead/Typeahead.tsx +33 -9
- package/src/upload/Upload.story.tsx +1 -1
- package/src/upload/Upload.tests.story.tsx +36 -1
- package/src/upload/Upload.tsx +1 -1
- package/src/upload/steps/uploadImageStep/uploadImageStep.tsx +7 -3
- package/src/withId/withId.story.tsx +1 -1
- package/build/types/test-utils/story-config.d.ts +0 -64
- package/build/types/test-utils/story-config.d.ts.map +0 -1
- 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 =
|
|
44
|
-
{
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
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
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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 =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
+
};
|