@transferwise/components 46.105.4 → 46.105.5
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/dateInput/DateInput.js.map +1 -1
- package/build/dateInput/DateInput.mjs.map +1 -1
- package/build/main.css +23 -11
- package/build/styles/listItem/ListItem.css +23 -11
- package/build/styles/listItem/ListItem.grid.css +23 -9
- package/build/styles/main.css +23 -11
- package/build/types/dateInput/DateInput.d.ts.map +1 -1
- package/build/types/listItem/_stories/helpers.d.ts +1 -0
- package/build/types/listItem/_stories/helpers.d.ts.map +1 -1
- package/build/types/listItem/_stories/subcomponents.d.ts +6 -0
- package/build/types/listItem/_stories/subcomponents.d.ts.map +1 -1
- package/build/types/listItem/_stories/variants/helpers.d.ts +8 -0
- package/build/types/listItem/_stories/variants/helpers.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/dateInput/DateInput.tsx +1 -3
- package/src/listItem/ListItem.css +23 -11
- package/src/listItem/ListItem.grid.css +23 -9
- package/src/listItem/ListItem.grid.less +31 -9
- package/src/listItem/ListItem.less +0 -2
- package/src/listItem/_stories/helpers.tsx +8 -0
- package/src/listItem/_stories/subcomponents.tsx +7 -0
- package/src/listItem/_stories/variants/ListItem.brightGreen.test.story.tsx +49 -0
- package/src/listItem/_stories/variants/ListItem.dark.test.story.tsx +43 -0
- package/src/listItem/_stories/variants/ListItem.forestGreen.test.story.tsx +49 -0
- package/src/listItem/_stories/variants/ListItem.medium.test.story.tsx +34 -0
- package/src/listItem/_stories/variants/ListItem.personal.test.story.tsx +130 -0
- package/src/listItem/_stories/variants/ListItem.rtl.test.story.tsx +43 -0
- package/src/listItem/_stories/variants/ListItem.small.test.story.tsx +34 -0
- package/src/listItem/_stories/variants/helpers.tsx +127 -0
- package/src/main.css +23 -11
- package/src/listItem/_stories/ListItem.variants.test.story.tsx +0 -274
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
import { MultiCurrency } from '@transferwise/icons';
|
|
3
|
-
import { storyConfig } from '../../test-utils';
|
|
4
|
-
import Link from '../../link';
|
|
5
|
-
import List from '../../list';
|
|
6
|
-
import { ListItem, type ListItemProps } from '../ListItem';
|
|
7
|
-
import {
|
|
8
|
-
SB_LIST_ITEM_ADDITIONAL_INFO as ADDITIONAL_INFO,
|
|
9
|
-
SB_LIST_ITEM_CONTROLS as CONTROLS,
|
|
10
|
-
SB_LIST_ITEM_PROMPTS as PROMPTS,
|
|
11
|
-
type SB_ListItem_ControlType as ControlType,
|
|
12
|
-
} from './subcomponents';
|
|
13
|
-
|
|
14
|
-
export default {
|
|
15
|
-
component: ListItem,
|
|
16
|
-
title: 'Content/ListItem/tests/variants',
|
|
17
|
-
tags: ['!autodocs'],
|
|
18
|
-
parameters: {
|
|
19
|
-
controls: { disable: true },
|
|
20
|
-
actions: { disable: true },
|
|
21
|
-
knobs: { disable: true },
|
|
22
|
-
},
|
|
23
|
-
} satisfies Meta<ListItemProps>;
|
|
24
|
-
|
|
25
|
-
type Story = StoryObj<ListItemProps>;
|
|
26
|
-
type VariantPartial = { title: string } & Partial<ListItemProps>;
|
|
27
|
-
|
|
28
|
-
const title = 'This is a title';
|
|
29
|
-
const subtitle = 'And it also has a subtitle';
|
|
30
|
-
const infoWithoutLink = (
|
|
31
|
-
<ListItem.AdditionalInfo>Which is augmented with additional info.</ListItem.AdditionalInfo>
|
|
32
|
-
);
|
|
33
|
-
const infoWithLink = (
|
|
34
|
-
<ListItem.AdditionalInfo
|
|
35
|
-
action={{
|
|
36
|
-
label: 'Details about the subject.',
|
|
37
|
-
href: 'https://wise.com',
|
|
38
|
-
target: '_blank',
|
|
39
|
-
}}
|
|
40
|
-
>
|
|
41
|
-
Which is augmented with additional info.
|
|
42
|
-
</ListItem.AdditionalInfo>
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
const valueTitle = '100 GBP';
|
|
46
|
-
const valueSubtitle = '200 USD';
|
|
47
|
-
const prompt = <ListItem.Prompt sentiment="positive">Finally, there is a prompt.</ListItem.Prompt>;
|
|
48
|
-
const promptWithLink = (
|
|
49
|
-
<ListItem.Prompt sentiment="positive">
|
|
50
|
-
Finally, there is a prompt{' '}
|
|
51
|
-
<Link href="https://wise.com" target="_blank" rel="noreferrer">
|
|
52
|
-
referencing some details
|
|
53
|
-
</Link>{' '}
|
|
54
|
-
for your convenience.
|
|
55
|
-
</ListItem.Prompt>
|
|
56
|
-
);
|
|
57
|
-
const media = (
|
|
58
|
-
<ListItem.AvatarView>
|
|
59
|
-
<MultiCurrency />
|
|
60
|
-
</ListItem.AvatarView>
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
const generateVariantsForControl = (controlType: ControlType): Story => {
|
|
64
|
-
const control = CONTROLS[controlType];
|
|
65
|
-
const isInteractive = [
|
|
66
|
-
'partialButton',
|
|
67
|
-
'partialButtonAsLink',
|
|
68
|
-
'partialIconButton',
|
|
69
|
-
'partialIconButtonAsLink',
|
|
70
|
-
].includes(controlType);
|
|
71
|
-
const additionalInfo = isInteractive ? infoWithLink : infoWithoutLink;
|
|
72
|
-
const variants = [
|
|
73
|
-
{ title },
|
|
74
|
-
{ title, valueTitle },
|
|
75
|
-
{ title, subtitle },
|
|
76
|
-
{ title, additionalInfo },
|
|
77
|
-
{ title, valueTitle, valueSubtitle },
|
|
78
|
-
{ title, subtitle, inverted: true },
|
|
79
|
-
{ title, subtitle, valueTitle },
|
|
80
|
-
{ title, subtitle, valueTitle, inverted: true },
|
|
81
|
-
{ title, subtitle, valueTitle, valueSubtitle },
|
|
82
|
-
{ title, subtitle, valueTitle, valueSubtitle, inverted: true },
|
|
83
|
-
{ media, title },
|
|
84
|
-
{ media, title, valueTitle },
|
|
85
|
-
{ media, title, subtitle },
|
|
86
|
-
{ media, title, valueTitle, valueSubtitle },
|
|
87
|
-
{ media, title, valueTitle },
|
|
88
|
-
{ media, title, valueSubtitle },
|
|
89
|
-
{ media, title, subtitle },
|
|
90
|
-
{ media, title, additionalInfo },
|
|
91
|
-
{ media, title, subtitle, valueTitle },
|
|
92
|
-
{ media, title, subtitle, valueTitle, valueSubtitle },
|
|
93
|
-
{ media, title, subtitle, additionalInfo: infoWithoutLink },
|
|
94
|
-
isInteractive ? { media, title, subtitle, additionalInfo: infoWithLink } : null,
|
|
95
|
-
{ media, title, subtitle, additionalInfo, valueTitle },
|
|
96
|
-
{ media, title, subtitle, additionalInfo, valueTitle, valueSubtitle },
|
|
97
|
-
{ media, title, subtitle, additionalInfo, valueTitle, valueSubtitle, prompt },
|
|
98
|
-
{
|
|
99
|
-
media,
|
|
100
|
-
title,
|
|
101
|
-
subtitle,
|
|
102
|
-
additionalInfo,
|
|
103
|
-
valueTitle,
|
|
104
|
-
valueSubtitle,
|
|
105
|
-
prompt: promptWithLink,
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
media,
|
|
109
|
-
title,
|
|
110
|
-
subtitle,
|
|
111
|
-
additionalInfo,
|
|
112
|
-
valueTitle,
|
|
113
|
-
valueSubtitle,
|
|
114
|
-
prompt: promptWithLink,
|
|
115
|
-
inverted: true,
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
media,
|
|
119
|
-
title,
|
|
120
|
-
subtitle,
|
|
121
|
-
additionalInfo,
|
|
122
|
-
valueTitle,
|
|
123
|
-
valueSubtitle,
|
|
124
|
-
prompt: promptWithLink,
|
|
125
|
-
spotlight: 'active',
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
media,
|
|
129
|
-
title,
|
|
130
|
-
subtitle,
|
|
131
|
-
additionalInfo,
|
|
132
|
-
valueTitle,
|
|
133
|
-
valueSubtitle,
|
|
134
|
-
prompt: promptWithLink,
|
|
135
|
-
spotlight: 'inactive',
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
media,
|
|
139
|
-
title,
|
|
140
|
-
subtitle,
|
|
141
|
-
additionalInfo,
|
|
142
|
-
valueTitle,
|
|
143
|
-
valueSubtitle,
|
|
144
|
-
prompt: promptWithLink,
|
|
145
|
-
spotlight: 'inactive',
|
|
146
|
-
disabled: true,
|
|
147
|
-
},
|
|
148
|
-
].filter(Boolean) as VariantPartial[];
|
|
149
|
-
|
|
150
|
-
return storyConfig(
|
|
151
|
-
{
|
|
152
|
-
render: () => (
|
|
153
|
-
<List>
|
|
154
|
-
{variants.map((variant, variantIndex) => (
|
|
155
|
-
<ListItem
|
|
156
|
-
key={`${controlType}-${variantIndex}-${Math.random()}`}
|
|
157
|
-
control={control}
|
|
158
|
-
{...variant}
|
|
159
|
-
/>
|
|
160
|
-
))}
|
|
161
|
-
</List>
|
|
162
|
-
),
|
|
163
|
-
},
|
|
164
|
-
{ variants: ['default', 'dark', 'bright-green', 'forest-green', 'rtl'] },
|
|
165
|
-
);
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
export const Button = generateVariantsForControl('button');
|
|
169
|
-
export const ButtonAsLink = generateVariantsForControl('buttonAsLink');
|
|
170
|
-
export const ButtonPartiallyInteractive = generateVariantsForControl('partialButton');
|
|
171
|
-
export const ButtonAsLinkPartiallyInteractive = generateVariantsForControl('partialButtonAsLink');
|
|
172
|
-
export const IconButton = generateVariantsForControl('iconButton');
|
|
173
|
-
export const IconButtonAsLink = generateVariantsForControl('iconButtonAsLink');
|
|
174
|
-
export const IconButtonWithLabel = generateVariantsForControl('iconButtonWithLabel');
|
|
175
|
-
export const IconButtonAsLinkWithLabel = generateVariantsForControl('iconButtonAsLinkWithLabel');
|
|
176
|
-
export const IconButtonPartiallyInteractive = generateVariantsForControl('partialIconButton');
|
|
177
|
-
export const IconButtonAsLinkPartiallyInteractive =
|
|
178
|
-
generateVariantsForControl('partialIconButtonAsLink');
|
|
179
|
-
export const Navigation = generateVariantsForControl('navigation');
|
|
180
|
-
export const NavigationAsButton = generateVariantsForControl('navigationAsButton');
|
|
181
|
-
export const Checkbox = generateVariantsForControl('checkbox');
|
|
182
|
-
export const Radio = generateVariantsForControl('radio');
|
|
183
|
-
export const Switch = generateVariantsForControl('switch');
|
|
184
|
-
export const NonInteractive = generateVariantsForControl('non-interactive');
|
|
185
|
-
|
|
186
|
-
export const ButtonControlLabel: Story = {
|
|
187
|
-
render: () => (
|
|
188
|
-
<List>
|
|
189
|
-
<ListItem
|
|
190
|
-
title="Fully interactive button."
|
|
191
|
-
subtitle="It uses default content hierarchy."
|
|
192
|
-
valueTitle="100 GBP"
|
|
193
|
-
valueSubtitle="200 USD"
|
|
194
|
-
additionalInfo={ADDITIONAL_INFO.nonInteractive}
|
|
195
|
-
control={CONTROLS.button}
|
|
196
|
-
prompt={PROMPTS.nonInteractive}
|
|
197
|
-
/>
|
|
198
|
-
|
|
199
|
-
<ListItem
|
|
200
|
-
inverted
|
|
201
|
-
title="Fully interactive button."
|
|
202
|
-
subtitle="It uses inverted content hierarchy."
|
|
203
|
-
valueTitle="100 GBP"
|
|
204
|
-
valueSubtitle="200 USD"
|
|
205
|
-
additionalInfo={ADDITIONAL_INFO.nonInteractive}
|
|
206
|
-
control={CONTROLS.button}
|
|
207
|
-
prompt={PROMPTS.nonInteractive}
|
|
208
|
-
/>
|
|
209
|
-
|
|
210
|
-
<ListItem
|
|
211
|
-
title="Fully interactive button as HTML anchor."
|
|
212
|
-
subtitle="It uses default content hierarchy."
|
|
213
|
-
valueTitle="100 GBP"
|
|
214
|
-
valueSubtitle="200 USD"
|
|
215
|
-
additionalInfo={ADDITIONAL_INFO.nonInteractive}
|
|
216
|
-
control={CONTROLS.buttonAsLink}
|
|
217
|
-
prompt={PROMPTS.nonInteractive}
|
|
218
|
-
/>
|
|
219
|
-
|
|
220
|
-
<ListItem
|
|
221
|
-
inverted
|
|
222
|
-
title="Fully interactive button as HTML anchor."
|
|
223
|
-
subtitle="It uses inverted content hierarchy."
|
|
224
|
-
valueTitle="100 GBP"
|
|
225
|
-
valueSubtitle="200 USD"
|
|
226
|
-
additionalInfo={ADDITIONAL_INFO.nonInteractive}
|
|
227
|
-
control={CONTROLS.buttonAsLink}
|
|
228
|
-
prompt={PROMPTS.nonInteractive}
|
|
229
|
-
/>
|
|
230
|
-
|
|
231
|
-
<ListItem
|
|
232
|
-
title="Partially interactive button."
|
|
233
|
-
subtitle="It uses default content hierarchy."
|
|
234
|
-
valueTitle="100 GBP"
|
|
235
|
-
valueSubtitle="200 USD"
|
|
236
|
-
additionalInfo={ADDITIONAL_INFO.nonInteractive}
|
|
237
|
-
control={CONTROLS.partialButton}
|
|
238
|
-
prompt={PROMPTS.nonInteractive}
|
|
239
|
-
/>
|
|
240
|
-
|
|
241
|
-
<ListItem
|
|
242
|
-
inverted
|
|
243
|
-
title="Partially interactive button."
|
|
244
|
-
subtitle="It uses inverted content hierarchy."
|
|
245
|
-
valueTitle="100 GBP"
|
|
246
|
-
valueSubtitle="200 USD"
|
|
247
|
-
additionalInfo={ADDITIONAL_INFO.nonInteractive}
|
|
248
|
-
control={CONTROLS.partialButton}
|
|
249
|
-
prompt={PROMPTS.nonInteractive}
|
|
250
|
-
/>
|
|
251
|
-
|
|
252
|
-
<ListItem
|
|
253
|
-
title="Partially interactive button as HTML anchor."
|
|
254
|
-
subtitle="It uses default content hierarchy."
|
|
255
|
-
valueTitle="100 GBP"
|
|
256
|
-
valueSubtitle="200 USD"
|
|
257
|
-
additionalInfo={ADDITIONAL_INFO.nonInteractive}
|
|
258
|
-
control={CONTROLS.buttonAsLink}
|
|
259
|
-
prompt={PROMPTS.nonInteractive}
|
|
260
|
-
/>
|
|
261
|
-
|
|
262
|
-
<ListItem
|
|
263
|
-
inverted
|
|
264
|
-
title="Partially interactive button as HTML anchor."
|
|
265
|
-
subtitle="It uses inverted content hierarchy."
|
|
266
|
-
valueTitle="100 GBP"
|
|
267
|
-
valueSubtitle="200 USD"
|
|
268
|
-
additionalInfo={ADDITIONAL_INFO.nonInteractive}
|
|
269
|
-
control={CONTROLS.buttonAsLink}
|
|
270
|
-
prompt={PROMPTS.nonInteractive}
|
|
271
|
-
/>
|
|
272
|
-
</List>
|
|
273
|
-
),
|
|
274
|
-
};
|