@transferwise/components 46.106.0 → 46.107.0
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/actionOption/ActionOption.js.map +1 -1
- package/build/actionOption/ActionOption.mjs.map +1 -1
- package/build/checkboxOption/CheckboxOption.js.map +1 -1
- package/build/checkboxOption/CheckboxOption.mjs.map +1 -1
- package/build/legacylistItem/LegacyListItem.js.map +1 -1
- package/build/legacylistItem/LegacyListItem.mjs.map +1 -1
- package/build/listItem/ListItem.js +8 -8
- package/build/listItem/ListItem.js.map +1 -1
- package/build/listItem/ListItem.mjs +8 -8
- package/build/listItem/ListItem.mjs.map +1 -1
- package/build/main.css +28 -7
- package/build/navigationOption/NavigationOption.js.map +1 -1
- package/build/navigationOption/NavigationOption.mjs.map +1 -1
- package/build/navigationOptionsList/NavigationOptionsList.js.map +1 -1
- package/build/navigationOptionsList/NavigationOptionsList.mjs.map +1 -1
- package/build/radioOption/RadioOption.js.map +1 -1
- package/build/radioOption/RadioOption.mjs.map +1 -1
- package/build/styles/listItem/ListItem.css +28 -7
- package/build/styles/listItem/ListItem.grid.css +11 -3
- package/build/styles/listItem/ListItem.vars.css +0 -0
- package/build/styles/main.css +28 -7
- package/build/summary/Summary.js +8 -0
- package/build/summary/Summary.js.map +1 -1
- package/build/summary/Summary.mjs +8 -0
- package/build/summary/Summary.mjs.map +1 -1
- package/build/switchOption/SwitchOption.js +8 -0
- package/build/switchOption/SwitchOption.js.map +1 -1
- package/build/switchOption/SwitchOption.mjs +8 -0
- package/build/switchOption/SwitchOption.mjs.map +1 -1
- package/build/types/actionOption/ActionOption.d.ts +8 -0
- package/build/types/actionOption/ActionOption.d.ts.map +1 -1
- package/build/types/checkboxOption/CheckboxOption.d.ts +8 -0
- package/build/types/checkboxOption/CheckboxOption.d.ts.map +1 -1
- package/build/types/legacylistItem/LegacyListItem.d.ts +8 -0
- package/build/types/legacylistItem/LegacyListItem.d.ts.map +1 -1
- package/build/types/listItem/ListItem.d.ts.map +1 -1
- package/build/types/listItem/_stories/helpers.d.ts +1 -1
- package/build/types/listItem/_stories/helpers.d.ts.map +1 -1
- package/build/types/listItem/_stories/subcomponents.d.ts +3 -0
- package/build/types/listItem/_stories/subcomponents.d.ts.map +1 -1
- package/build/types/listItem/_stories/variants/helpers.d.ts.map +1 -1
- package/build/types/listItem/constants.d.ts +16 -0
- package/build/types/listItem/constants.d.ts.map +1 -0
- package/build/types/navigationOption/NavigationOption.d.ts +8 -0
- package/build/types/navigationOption/NavigationOption.d.ts.map +1 -1
- package/build/types/navigationOptionsList/NavigationOptionsList.d.ts +9 -0
- package/build/types/navigationOptionsList/NavigationOptionsList.d.ts.map +1 -1
- package/build/types/radioOption/RadioOption.d.ts +8 -0
- package/build/types/radioOption/RadioOption.d.ts.map +1 -1
- package/build/types/summary/Summary.d.ts +8 -0
- package/build/types/summary/Summary.d.ts.map +1 -1
- package/build/types/switchOption/SwitchOption.d.ts +8 -0
- package/build/types/switchOption/SwitchOption.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/actionOption/ActionOption.story.tsx +4 -0
- package/src/actionOption/ActionOption.tsx +8 -0
- package/src/checkboxOption/CheckboxOption.story.tsx +4 -0
- package/src/checkboxOption/CheckboxOption.tsx +8 -0
- package/src/legacylistItem/LegacyListItem.story.tsx +4 -0
- package/src/legacylistItem/LegacyListItem.tsx +8 -0
- package/src/listItem/ListItem.css +28 -7
- package/src/listItem/ListItem.grid.css +11 -3
- package/src/listItem/ListItem.grid.less +14 -4
- package/src/listItem/ListItem.less +16 -4
- package/src/listItem/ListItem.spec.tsx +4 -1
- package/src/listItem/ListItem.tsx +9 -9
- package/src/listItem/ListItem.vars.css +0 -0
- package/src/listItem/ListItem.vars.less +11 -0
- package/src/listItem/_stories/ListItem.layout.test.story.tsx +10 -155
- package/src/listItem/_stories/ListItem.scenarios.story.tsx +4 -25
- package/src/listItem/_stories/ListItem.story.tsx +16 -10
- package/src/listItem/_stories/helpers.tsx +22 -6
- package/src/listItem/_stories/subcomponents.tsx +14 -2
- package/src/listItem/_stories/variants/ListItem.medium.test.story.tsx +1 -1
- package/src/listItem/_stories/variants/ListItem.neutral.test.story.tsx +55 -0
- package/src/listItem/_stories/variants/ListItem.small.test.story.tsx +1 -1
- package/src/listItem/_stories/variants/helpers.tsx +28 -1
- package/src/listItem/constants.ts +15 -0
- package/src/main.css +28 -7
- package/src/navigationOption/NavigationOption.story.tsx +4 -1
- package/src/navigationOption/NavigationOption.tsx +8 -0
- package/src/navigationOptionsList/NavigationOptionsList.story.tsx +4 -0
- package/src/navigationOptionsList/NavigationOptionsList.tsx +9 -0
- package/src/radioOption/RadioOption.story.tsx +4 -0
- package/src/radioOption/RadioOption.tsx +8 -0
- package/src/summary/Summary.story.tsx +4 -0
- package/src/summary/Summary.tsx +8 -0
- package/src/switchOption/SwitchOption.story.tsx +4 -1
- package/src/switchOption/SwitchOption.tsx +8 -0
- package/src/table/Table.story.tsx +1 -1
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Fragment } from 'react';
|
|
2
2
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
|
-
import { Bank, FastFlag, MultiCurrency, Receipt, Savings } from '@transferwise/icons';
|
|
4
|
-
import Link from '../../link';
|
|
5
3
|
import List from '../../list';
|
|
6
4
|
import { ListItem, type ListItemProps } from '../ListItem';
|
|
7
5
|
import { lorem10, lorem20, lorem5 } from '../../test-utils';
|
|
@@ -9,20 +7,8 @@ import portraitImage from '../../test-utils/assets/placeholder-landscape.svg';
|
|
|
9
7
|
import landscapeImage from '../../test-utils/assets/placeholder-portrait.svg';
|
|
10
8
|
import { SB_LIST_ITEM_CONTROLS as CONTROLS, SB_LIST_ITEM_MEDIA as MEDIA } from './subcomponents';
|
|
11
9
|
import { ListItemMediaSize } from '../ListItemContext';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<List
|
|
15
|
-
className="list-unstyled"
|
|
16
|
-
style={{
|
|
17
|
-
width,
|
|
18
|
-
display: 'flex',
|
|
19
|
-
flexDirection: 'column',
|
|
20
|
-
gap: 16,
|
|
21
|
-
}}
|
|
22
|
-
>
|
|
23
|
-
<Story />
|
|
24
|
-
</List>
|
|
25
|
-
);
|
|
10
|
+
import { withSizedContainer } from './helpers';
|
|
11
|
+
import { LISTITEM_CQ } from '../constants';
|
|
26
12
|
|
|
27
13
|
export default {
|
|
28
14
|
title: 'Content/ListItem/tests/layout',
|
|
@@ -36,143 +22,6 @@ export default {
|
|
|
36
22
|
} satisfies Meta<ListItemProps>;
|
|
37
23
|
type Story = StoryObj<ListItemProps>;
|
|
38
24
|
|
|
39
|
-
const variants = [
|
|
40
|
-
<ListItem
|
|
41
|
-
key="button"
|
|
42
|
-
title="Button only"
|
|
43
|
-
control={
|
|
44
|
-
<ListItem.Button priority="secondary-neutral" onClick={() => {}}>
|
|
45
|
-
Click me
|
|
46
|
-
</ListItem.Button>
|
|
47
|
-
}
|
|
48
|
-
/>,
|
|
49
|
-
<ListItem
|
|
50
|
-
key="media"
|
|
51
|
-
title="With media"
|
|
52
|
-
subtitle="Short subtitle"
|
|
53
|
-
additionalInfo={<ListItem.AdditionalInfo>{lorem5}</ListItem.AdditionalInfo>}
|
|
54
|
-
media={
|
|
55
|
-
<ListItem.AvatarView>
|
|
56
|
-
<FastFlag />
|
|
57
|
-
</ListItem.AvatarView>
|
|
58
|
-
}
|
|
59
|
-
/>,
|
|
60
|
-
<ListItem key="value" title="With value" valueTitle="100 GBP" valueSubtitle="100 USD" />,
|
|
61
|
-
<ListItem
|
|
62
|
-
key="prompt"
|
|
63
|
-
title="With prompt"
|
|
64
|
-
prompt={
|
|
65
|
-
<ListItem.Prompt sentiment="positive">
|
|
66
|
-
This is a prompt with <Link href="https://wise.com">a link</Link>.
|
|
67
|
-
</ListItem.Prompt>
|
|
68
|
-
}
|
|
69
|
-
/>,
|
|
70
|
-
<ListItem
|
|
71
|
-
key="button-media"
|
|
72
|
-
title="Button + media"
|
|
73
|
-
media={
|
|
74
|
-
<ListItem.AvatarView>
|
|
75
|
-
<MultiCurrency />
|
|
76
|
-
</ListItem.AvatarView>
|
|
77
|
-
}
|
|
78
|
-
control={
|
|
79
|
-
<ListItem.Button priority="primary" onClick={() => {}}>
|
|
80
|
-
Action
|
|
81
|
-
</ListItem.Button>
|
|
82
|
-
}
|
|
83
|
-
/>,
|
|
84
|
-
<ListItem
|
|
85
|
-
key="button-value"
|
|
86
|
-
title="Button + value"
|
|
87
|
-
valueTitle="42 EUR"
|
|
88
|
-
control={
|
|
89
|
-
<ListItem.Button priority="secondary-neutral" onClick={() => {}}>
|
|
90
|
-
Pay
|
|
91
|
-
</ListItem.Button>
|
|
92
|
-
}
|
|
93
|
-
/>,
|
|
94
|
-
<ListItem
|
|
95
|
-
key="media-value"
|
|
96
|
-
valueColumnWidth={80}
|
|
97
|
-
title="Media + value"
|
|
98
|
-
subtitle="this column is 20% wide"
|
|
99
|
-
media={
|
|
100
|
-
<ListItem.AvatarView>
|
|
101
|
-
<Bank />
|
|
102
|
-
</ListItem.AvatarView>
|
|
103
|
-
}
|
|
104
|
-
valueTitle="1,000 USD"
|
|
105
|
-
/>,
|
|
106
|
-
<ListItem
|
|
107
|
-
key="prompt-value"
|
|
108
|
-
title="Prompt + value"
|
|
109
|
-
valueTitle="10 GBP"
|
|
110
|
-
prompt={<ListItem.Prompt sentiment="warning">Warning prompt!</ListItem.Prompt>}
|
|
111
|
-
/>,
|
|
112
|
-
<ListItem
|
|
113
|
-
key="media-prompt"
|
|
114
|
-
title="Media + prompt"
|
|
115
|
-
media={
|
|
116
|
-
<ListItem.AvatarView>
|
|
117
|
-
<Receipt />
|
|
118
|
-
</ListItem.AvatarView>
|
|
119
|
-
}
|
|
120
|
-
prompt={<ListItem.Prompt sentiment="positive">Discount available!</ListItem.Prompt>}
|
|
121
|
-
/>,
|
|
122
|
-
<ListItem
|
|
123
|
-
key="most"
|
|
124
|
-
title="Everything but button"
|
|
125
|
-
subtitle="No control"
|
|
126
|
-
media={
|
|
127
|
-
<ListItem.AvatarView>
|
|
128
|
-
<Savings />
|
|
129
|
-
</ListItem.AvatarView>
|
|
130
|
-
}
|
|
131
|
-
valueTitle="999 GBP"
|
|
132
|
-
prompt={
|
|
133
|
-
<ListItem.Prompt sentiment="positive">
|
|
134
|
-
<Link href="https://wise.com">See details</Link>
|
|
135
|
-
</ListItem.Prompt>
|
|
136
|
-
}
|
|
137
|
-
/>,
|
|
138
|
-
<ListItem
|
|
139
|
-
key="all"
|
|
140
|
-
title="All together"
|
|
141
|
-
subtitle="Everything in one"
|
|
142
|
-
media={
|
|
143
|
-
<ListItem.AvatarView>
|
|
144
|
-
<Savings />
|
|
145
|
-
</ListItem.AvatarView>
|
|
146
|
-
}
|
|
147
|
-
valueTitle="999 GBP"
|
|
148
|
-
prompt={
|
|
149
|
-
<ListItem.Prompt sentiment="positive">
|
|
150
|
-
<Link href="https://wise.com">See details</Link>
|
|
151
|
-
</ListItem.Prompt>
|
|
152
|
-
}
|
|
153
|
-
control={
|
|
154
|
-
<ListItem.Button priority="secondary-neutral" onClick={() => {}}>
|
|
155
|
-
Go
|
|
156
|
-
</ListItem.Button>
|
|
157
|
-
}
|
|
158
|
-
/>,
|
|
159
|
-
];
|
|
160
|
-
|
|
161
|
-
export const Under320: Story = {
|
|
162
|
-
render: () => <>{variants}</>,
|
|
163
|
-
decorators: [withSizedContainer(320)],
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
export const Between321And399: Story = {
|
|
167
|
-
render: () => <>{variants}</>,
|
|
168
|
-
decorators: [withSizedContainer(360)],
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
export const Over400: Story = {
|
|
172
|
-
render: () => <>{variants}</>,
|
|
173
|
-
decorators: [withSizedContainer(400)],
|
|
174
|
-
};
|
|
175
|
-
|
|
176
25
|
export const LongButton: Story = {
|
|
177
26
|
render: () => (
|
|
178
27
|
<ListItem
|
|
@@ -190,7 +39,7 @@ export const LongButton: Story = {
|
|
|
190
39
|
}
|
|
191
40
|
/>
|
|
192
41
|
),
|
|
193
|
-
decorators: [withSizedContainer(400)],
|
|
42
|
+
decorators: [withSizedContainer(400, false)],
|
|
194
43
|
};
|
|
195
44
|
|
|
196
45
|
export const GapsBetweenItems: Story = {
|
|
@@ -317,7 +166,13 @@ const ImageAlignmentStory: StoryObj<PreviewStoryArgs> = {
|
|
|
317
166
|
)}
|
|
318
167
|
<List
|
|
319
168
|
className="list-unstyled"
|
|
320
|
-
style={{
|
|
169
|
+
style={{
|
|
170
|
+
display: 'grid',
|
|
171
|
+
gridTemplateColumns: [LISTITEM_CQ.MAX, LISTITEM_CQ.MAX + 10]
|
|
172
|
+
.map((size) => `${size}px`)
|
|
173
|
+
.join(' '),
|
|
174
|
+
gap: '16px',
|
|
175
|
+
}}
|
|
321
176
|
>
|
|
322
177
|
<Story />
|
|
323
178
|
</List>
|
|
@@ -235,23 +235,16 @@ export const CopyAndPasteWithSnackbar: Story = storySourceWithoutNoise({
|
|
|
235
235
|
},
|
|
236
236
|
});
|
|
237
237
|
|
|
238
|
-
export const Summary: Story = {
|
|
238
|
+
export const Summary: Story = storySourceWithoutNoise({
|
|
239
239
|
parameters: {
|
|
240
240
|
docs: {
|
|
241
241
|
canvas: {
|
|
242
242
|
sourceState: 'shown',
|
|
243
243
|
},
|
|
244
244
|
},
|
|
245
|
-
backgrounds: {
|
|
246
|
-
default: 'light',
|
|
247
|
-
values: [
|
|
248
|
-
{ name: 'light', value: '#f8f9fa' },
|
|
249
|
-
{ name: 'dark', value: '#343a40' },
|
|
250
|
-
],
|
|
251
|
-
},
|
|
252
245
|
},
|
|
253
|
-
render: ()
|
|
254
|
-
|
|
246
|
+
render: function Summary() {
|
|
247
|
+
return (
|
|
255
248
|
<List>
|
|
256
249
|
<ListItem
|
|
257
250
|
title="System maintenance"
|
|
@@ -327,19 +320,5 @@ export const Summary: Story = {
|
|
|
327
320
|
/>
|
|
328
321
|
</List>
|
|
329
322
|
);
|
|
330
|
-
return (
|
|
331
|
-
<>
|
|
332
|
-
<div style={{ padding: '24px', width: '450px' }}>{listItems}</div>
|
|
333
|
-
<div
|
|
334
|
-
style={{
|
|
335
|
-
padding: '24px',
|
|
336
|
-
width: '450px',
|
|
337
|
-
backgroundColor: 'var(--color-background-neutral)',
|
|
338
|
-
}}
|
|
339
|
-
>
|
|
340
|
-
{listItems}
|
|
341
|
-
</div>
|
|
342
|
-
</>
|
|
343
|
-
);
|
|
344
323
|
},
|
|
345
|
-
};
|
|
324
|
+
});
|
|
@@ -3,8 +3,10 @@ import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
|
3
3
|
import { MultiCurrency, Plus } from '@transferwise/icons';
|
|
4
4
|
import { lorem5, lorem10 } from '../../test-utils';
|
|
5
5
|
import Emphasis from '../../emphasis';
|
|
6
|
+
import Link from '../../link';
|
|
6
7
|
import List from '../../list';
|
|
7
8
|
import { ListItem, type ListItemProps } from '../ListItem';
|
|
9
|
+
import { LISTITEM_CQ } from '../constants';
|
|
8
10
|
import {
|
|
9
11
|
SB_LIST_ITEM_CONTROLS as CONTROLS,
|
|
10
12
|
SB_LIST_ITEM_ADDITIONAL_INFO as ADDITIONAL_INFO,
|
|
@@ -12,7 +14,6 @@ import {
|
|
|
12
14
|
SB_LIST_ITEM_MEDIA as MEDIA,
|
|
13
15
|
} from './subcomponents';
|
|
14
16
|
import { disableControls, storySourceWithoutNoise, withoutKey } from './helpers';
|
|
15
|
-
import Link from '../../link';
|
|
16
17
|
|
|
17
18
|
const hideControls = disableControls([
|
|
18
19
|
'additionalInfo',
|
|
@@ -46,7 +47,6 @@ export default {
|
|
|
46
47
|
'ListItem.Image': ListItem.Image,
|
|
47
48
|
},
|
|
48
49
|
title: 'Content/ListItem',
|
|
49
|
-
tags: ['early-access'],
|
|
50
50
|
parameters: {
|
|
51
51
|
docs: {
|
|
52
52
|
toc: true,
|
|
@@ -274,19 +274,15 @@ export const Playground: StoryObj<PreviewStoryArgs> = {
|
|
|
274
274
|
decorators: [withoutKey],
|
|
275
275
|
};
|
|
276
276
|
|
|
277
|
-
/**
|
|
278
|
-
* ListItem uses container queries under the hood, which means its layout self-adjusts based on
|
|
279
|
-
* the available space. At the 100% zoom level, these breakpoints correspond to
|
|
280
|
-
* containers under `290px`, those between `291px and 380px`, and finally everything including
|
|
281
|
-
* and above `381px`. <br />
|
|
282
|
-
* This also supports high levels of zoom for assistive tech users.
|
|
283
|
-
*/
|
|
284
277
|
export const Responsiveness: StoryObj<PreviewStoryArgs> = {
|
|
285
278
|
parameters: {
|
|
286
279
|
docs: {
|
|
287
280
|
canvas: {
|
|
288
281
|
sourceState: 'hidden',
|
|
289
282
|
},
|
|
283
|
+
description: {
|
|
284
|
+
story: `ListItem uses container queries under the hood, which means its layout self-adjusts based on the available space. At the 100% zoom level, these breakpoints correspond to containers under \`${LISTITEM_CQ.MIN}px\`, those between \`${LISTITEM_CQ.MIN + 1}px and ${LISTITEM_CQ.MAX}px\`, and finally everything including and above \`${LISTITEM_CQ.MAX + 1}px\`.\n\nThis also supports high levels of zoom for assistive tech users.`,
|
|
285
|
+
},
|
|
290
286
|
},
|
|
291
287
|
},
|
|
292
288
|
argTypes: {
|
|
@@ -311,7 +307,17 @@ export const Responsiveness: StoryObj<PreviewStoryArgs> = {
|
|
|
311
307
|
<List
|
|
312
308
|
as="ol"
|
|
313
309
|
className="list-unstyled"
|
|
314
|
-
style={{
|
|
310
|
+
style={{
|
|
311
|
+
display: 'grid',
|
|
312
|
+
gridTemplateColumns: [
|
|
313
|
+
LISTITEM_CQ.MIN,
|
|
314
|
+
Math.round((LISTITEM_CQ.MAX - LISTITEM_CQ.MIN) / 2 + LISTITEM_CQ.MIN),
|
|
315
|
+
510,
|
|
316
|
+
]
|
|
317
|
+
.map((width) => `${width}px`)
|
|
318
|
+
.join(' '),
|
|
319
|
+
gap: 16,
|
|
320
|
+
}}
|
|
315
321
|
>
|
|
316
322
|
<ListItem {...props} {...previewProps} />
|
|
317
323
|
<ListItem {...props} {...previewProps} />
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { StoryObj, type Decorator } from '@storybook/react-webpack5';
|
|
2
2
|
import type { ListItemProps } from '../ListItem';
|
|
3
|
+
import { LISTITEM_CQ } from '../constants';
|
|
3
4
|
|
|
4
5
|
type Story = StoryObj<ListItemProps>;
|
|
5
6
|
|
|
@@ -49,12 +50,27 @@ export const withoutKey: Decorator = (Story, { args }) => {
|
|
|
49
50
|
};
|
|
50
51
|
|
|
51
52
|
export const withSizedContainer =
|
|
52
|
-
(
|
|
53
|
-
(Story, { args }) =>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
(size: 'small' | 'medium' | 'large' | number = 'large', border = true): Decorator =>
|
|
54
|
+
(Story, { args }) => {
|
|
55
|
+
const width =
|
|
56
|
+
typeof size === 'number'
|
|
57
|
+
? size
|
|
58
|
+
: {
|
|
59
|
+
small: LISTITEM_CQ.MIN,
|
|
60
|
+
medium: Math.round((LISTITEM_CQ.MAX - LISTITEM_CQ.MIN) / 2 + LISTITEM_CQ.MIN),
|
|
61
|
+
large: LISTITEM_CQ.MAX + 1,
|
|
62
|
+
}[size];
|
|
63
|
+
return (
|
|
64
|
+
<div
|
|
65
|
+
style={{
|
|
66
|
+
width,
|
|
67
|
+
border: border ? '1px dashed #ccc' : undefined,
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
<Story />
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
58
74
|
|
|
59
75
|
/**
|
|
60
76
|
* Not all stories need access to all controls as it causes unnecessary UI noise.
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { Edit, Briefcase, Plane } from '@transferwise/icons';
|
|
3
|
-
import { ListItem } from '../ListItem';
|
|
4
3
|
import { fn } from 'storybook/test';
|
|
5
|
-
import Link from '../../link';
|
|
6
4
|
import { Flag } from '@wise/art';
|
|
5
|
+
import { lorem20 } from '../../test-utils';
|
|
6
|
+
import Link from '../../link';
|
|
7
|
+
import { ListItem } from '../ListItem';
|
|
7
8
|
|
|
8
9
|
export type SB_ListItem_ControlType =
|
|
9
10
|
| 'non-interactive'
|
|
@@ -30,6 +31,17 @@ export const SB_LIST_ITEM_TEXT = {
|
|
|
30
31
|
subtitle: 'And it also has a subtitle',
|
|
31
32
|
valueTitle: '100 GBP',
|
|
32
33
|
valueSubtitle: '200 USD',
|
|
34
|
+
longTitle: `This is a long title. ${lorem20}`,
|
|
35
|
+
longSubtitle: `And it also has a long subtitle. ${lorem20}`,
|
|
36
|
+
longValueTitle: (
|
|
37
|
+
<>
|
|
38
|
+
This value title
|
|
39
|
+
<br />
|
|
40
|
+
is made to span
|
|
41
|
+
<br />
|
|
42
|
+
across few lines
|
|
43
|
+
</>
|
|
44
|
+
),
|
|
33
45
|
};
|
|
34
46
|
|
|
35
47
|
export const SB_LIST_ITEM_CONTROLS: Record<SB_ListItem_ControlType, ReactNode> = {
|
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
actions: { disable: true },
|
|
13
13
|
knobs: { disable: true },
|
|
14
14
|
},
|
|
15
|
-
decorators: [withSizedContainer(
|
|
15
|
+
decorators: [withSizedContainer('medium')],
|
|
16
16
|
} satisfies Meta<ListItemProps>;
|
|
17
17
|
|
|
18
18
|
export const Button = generateVariantsForControl('button');
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import List from '../../../list';
|
|
3
|
+
import { ListItem, type ListItemProps } from '../../ListItem';
|
|
4
|
+
import {
|
|
5
|
+
SB_LIST_ITEM_ADDITIONAL_INFO as INFO,
|
|
6
|
+
SB_LIST_ITEM_CONTROLS as CONTROLS,
|
|
7
|
+
SB_LIST_ITEM_MEDIA as MEDIA,
|
|
8
|
+
SB_LIST_ITEM_PROMPTS as PROMPT,
|
|
9
|
+
SB_LIST_ITEM_TEXT as TEXT,
|
|
10
|
+
SB_ListItem_ControlType as ControlType,
|
|
11
|
+
} from '../subcomponents';
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
component: ListItem,
|
|
15
|
+
title: 'Content/ListItem/tests/variants/surface: neutral',
|
|
16
|
+
tags: ['!autodocs'],
|
|
17
|
+
parameters: {
|
|
18
|
+
controls: { disable: true },
|
|
19
|
+
actions: { disable: true },
|
|
20
|
+
knobs: { disable: true },
|
|
21
|
+
padding: '0',
|
|
22
|
+
},
|
|
23
|
+
decorators: [
|
|
24
|
+
(Story) => (
|
|
25
|
+
<div
|
|
26
|
+
style={{
|
|
27
|
+
backgroundColor: 'var(--color-background-neutral)',
|
|
28
|
+
padding: 80,
|
|
29
|
+
minHeight: '100%',
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
<Story />
|
|
33
|
+
</div>
|
|
34
|
+
),
|
|
35
|
+
],
|
|
36
|
+
} satisfies Meta<ListItemProps>;
|
|
37
|
+
|
|
38
|
+
type Story = StoryObj<ListItemProps>;
|
|
39
|
+
|
|
40
|
+
export const OnNeutralBackdrop: Story = {
|
|
41
|
+
render: () => (
|
|
42
|
+
<List>
|
|
43
|
+
<ListItem
|
|
44
|
+
title={TEXT.title}
|
|
45
|
+
subtitle={TEXT.subtitle}
|
|
46
|
+
valueTitle={TEXT.valueTitle}
|
|
47
|
+
valueSubtitle={TEXT.valueSubtitle}
|
|
48
|
+
additionalInfo={INFO.nonInteractive}
|
|
49
|
+
control={CONTROLS.button}
|
|
50
|
+
prompt={PROMPT.nonInteractive}
|
|
51
|
+
media={MEDIA.avatarDouble}
|
|
52
|
+
/>
|
|
53
|
+
</List>
|
|
54
|
+
),
|
|
55
|
+
};
|
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
actions: { disable: true },
|
|
13
13
|
knobs: { disable: true },
|
|
14
14
|
},
|
|
15
|
-
decorators: [withSizedContainer(
|
|
15
|
+
decorators: [withSizedContainer('small')],
|
|
16
16
|
} satisfies Meta<ListItemProps>;
|
|
17
17
|
|
|
18
18
|
export const Button = generateVariantsForControl('button');
|
|
@@ -14,7 +14,8 @@ import {
|
|
|
14
14
|
type Story = StoryObj<ListItemProps>;
|
|
15
15
|
type VariantPartial = { title: string } & Partial<ListItemProps>;
|
|
16
16
|
|
|
17
|
-
const { title, subtitle, valueTitle, valueSubtitle } =
|
|
17
|
+
const { title, subtitle, valueTitle, valueSubtitle, longTitle, longSubtitle, longValueTitle } =
|
|
18
|
+
TEXT;
|
|
18
19
|
const prompt = PROMPT.nonInteractive;
|
|
19
20
|
const media = MEDIA.avatarSingle;
|
|
20
21
|
|
|
@@ -32,18 +33,36 @@ export const generateVariantsForControl = (
|
|
|
32
33
|
const additionalInfo = isInteractive ? INFO.interactive : INFO.nonInteractive;
|
|
33
34
|
const instances = [
|
|
34
35
|
{ title },
|
|
36
|
+
{ title: longTitle },
|
|
35
37
|
{ title, valueTitle },
|
|
38
|
+
{ title, valueTitle: longValueTitle },
|
|
39
|
+
{ title: longTitle, valueTitle },
|
|
36
40
|
{ title, subtitle },
|
|
41
|
+
{ title, subtitle: longSubtitle },
|
|
37
42
|
{ title, additionalInfo },
|
|
38
43
|
{ title, valueTitle, valueSubtitle },
|
|
44
|
+
{ title, valueTitle: longValueTitle, valueSubtitle },
|
|
39
45
|
{ title, subtitle, inverted: true },
|
|
40
46
|
{ title, subtitle, valueTitle },
|
|
41
47
|
{ title, subtitle, valueTitle, inverted: true },
|
|
42
48
|
{ title, subtitle, valueTitle, valueSubtitle },
|
|
49
|
+
{
|
|
50
|
+
title: longTitle,
|
|
51
|
+
subtitle: longSubtitle,
|
|
52
|
+
valueTitle,
|
|
53
|
+
valueSubtitle,
|
|
54
|
+
additionalInfo: INFO.nonInteractive,
|
|
55
|
+
},
|
|
43
56
|
{ title, subtitle, valueTitle, valueSubtitle, inverted: true },
|
|
44
57
|
{ media, title },
|
|
58
|
+
{ media, title: longTitle },
|
|
45
59
|
{ media, title, valueTitle },
|
|
60
|
+
{ media, title: longTitle, valueTitle },
|
|
61
|
+
{ media, title: longTitle, valueSubtitle },
|
|
62
|
+
{ media, title, valueTitle: longValueTitle },
|
|
63
|
+
{ media, title, valueTitle: longValueTitle, valueSubtitle },
|
|
46
64
|
{ media, title, subtitle },
|
|
65
|
+
{ media, title: longTitle, subtitle },
|
|
47
66
|
{ media, title, valueTitle, valueSubtitle },
|
|
48
67
|
{ media, title, valueTitle },
|
|
49
68
|
{ media, title, valueSubtitle },
|
|
@@ -55,6 +74,14 @@ export const generateVariantsForControl = (
|
|
|
55
74
|
isInteractive ? { media, title, subtitle, additionalInfo: INFO.interactive } : null,
|
|
56
75
|
{ media, title, subtitle, additionalInfo, valueTitle },
|
|
57
76
|
{ media, title, subtitle, additionalInfo, valueTitle, valueSubtitle },
|
|
77
|
+
{
|
|
78
|
+
media,
|
|
79
|
+
title: longTitle,
|
|
80
|
+
subtitle: longSubtitle,
|
|
81
|
+
valueTitle,
|
|
82
|
+
valueSubtitle,
|
|
83
|
+
additionalInfo: INFO.nonInteractive,
|
|
84
|
+
},
|
|
58
85
|
{ media, title, subtitle, additionalInfo, valueTitle, valueSubtitle, prompt },
|
|
59
86
|
{
|
|
60
87
|
media,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List item has 3 unique layouts managed through container queries:
|
|
3
|
+
* 1. width <= cq-min
|
|
4
|
+
* 2. cq-min < width <= cq-max
|
|
5
|
+
* 3. width > cq-max
|
|
6
|
+
*
|
|
7
|
+
* ⚠️ NB: These values must be kept in sync with:
|
|
8
|
+
* `packages/components/src/listItem/ListItem.vars.less`
|
|
9
|
+
*
|
|
10
|
+
* @see https://storybook.wise.design/?path=/story/content-listitem--responsiveness
|
|
11
|
+
*/
|
|
12
|
+
export const LISTITEM_CQ = {
|
|
13
|
+
MIN: 240,
|
|
14
|
+
MAX: 308,
|
|
15
|
+
} as const;
|
package/src/main.css
CHANGED
|
@@ -2653,7 +2653,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2653
2653
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-noControl.wds-list-item-noInfo-hasPrompt:not(:has(.wds-list-item-subtitle-value, .wds-list-item-subtitle)) .wds-list-item-prompt {
|
|
2654
2654
|
margin-top: -2px;
|
|
2655
2655
|
}
|
|
2656
|
-
@container (min-width:
|
|
2656
|
+
@container (min-width: 309px) {
|
|
2657
2657
|
.wds-list-item-gridWrapper .wds-list-item-control-wrapper {
|
|
2658
2658
|
height: var(--wds-list-item-control-wrapper-height);
|
|
2659
2659
|
align-content: center;
|
|
@@ -2749,7 +2749,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2749
2749
|
grid-template-areas: "body";
|
|
2750
2750
|
}
|
|
2751
2751
|
}
|
|
2752
|
-
@container (min-width:
|
|
2752
|
+
@container (min-width: 241px) and (max-width: 308px) {
|
|
2753
2753
|
.wds-list-item-gridWrapper .wds-list-item-media-image {
|
|
2754
2754
|
-o-object-position: bottom left;
|
|
2755
2755
|
object-position: bottom left;
|
|
@@ -2875,8 +2875,12 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2875
2875
|
grid-template-rows: auto;
|
|
2876
2876
|
grid-template-areas: "body";
|
|
2877
2877
|
}
|
|
2878
|
+
.wds-list-item-gridWrapper .wds-list-item-button-control--hasPrompt {
|
|
2879
|
+
margin-top: 4px;
|
|
2880
|
+
margin-top: var(--size-4);
|
|
2881
|
+
}
|
|
2878
2882
|
}
|
|
2879
|
-
@container (max-width:
|
|
2883
|
+
@container (max-width: 240px) {
|
|
2880
2884
|
.wds-list-item-gridWrapper .wds-list-item-control-wrapper {
|
|
2881
2885
|
align-content: start;
|
|
2882
2886
|
}
|
|
@@ -3017,6 +3021,10 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
3017
3021
|
.wds-list-item-gridWrapper .wds-list-item-body .wds-list-item-value {
|
|
3018
3022
|
text-align: left;
|
|
3019
3023
|
}
|
|
3024
|
+
.wds-list-item-gridWrapper .wds-list-item-button-control--hasPrompt {
|
|
3025
|
+
margin-top: 4px;
|
|
3026
|
+
margin-top: var(--size-4);
|
|
3027
|
+
}
|
|
3020
3028
|
}
|
|
3021
3029
|
.wds-list-item-prompt {
|
|
3022
3030
|
grid-area: prompt;
|
|
@@ -3298,7 +3306,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
3298
3306
|
}
|
|
3299
3307
|
.wds-list-item-body {
|
|
3300
3308
|
grid-area: body;
|
|
3301
|
-
align-items:
|
|
3309
|
+
align-items: start;
|
|
3302
3310
|
width: 100%;
|
|
3303
3311
|
display: grid;
|
|
3304
3312
|
grid-template-columns: 1fr max-content;
|
|
@@ -3309,14 +3317,27 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
3309
3317
|
gap: var(--size-16);
|
|
3310
3318
|
word-break: break-word;
|
|
3311
3319
|
}
|
|
3320
|
+
.wds-list-item-titles,
|
|
3321
|
+
.wds-list-item-value {
|
|
3322
|
+
display: flex;
|
|
3323
|
+
flex-direction: column;
|
|
3324
|
+
justify-content: center;
|
|
3325
|
+
}
|
|
3326
|
+
@container (min-width: 309px) {
|
|
3327
|
+
.wds-list-item-titles,
|
|
3328
|
+
.wds-list-item-value {
|
|
3329
|
+
min-height: 100%;
|
|
3330
|
+
min-height: var(--wds-list-item-value-min-height, 100%);
|
|
3331
|
+
}
|
|
3332
|
+
}
|
|
3333
|
+
.wds-list-item-value {
|
|
3334
|
+
text-align: right;
|
|
3335
|
+
}
|
|
3312
3336
|
.wds-list-item-title,
|
|
3313
3337
|
.wds-list-item-title-value {
|
|
3314
3338
|
color: #37517e;
|
|
3315
3339
|
color: var(--color-content-primary);
|
|
3316
3340
|
}
|
|
3317
|
-
.wds-list-item-value {
|
|
3318
|
-
text-align: right;
|
|
3319
|
-
}
|
|
3320
3341
|
.wds-list-item-body-center {
|
|
3321
3342
|
display: flex;
|
|
3322
3343
|
flex-direction: row;
|
|
@@ -15,10 +15,13 @@ import { fn } from 'storybook/test';
|
|
|
15
15
|
|
|
16
16
|
type StoryArgs = NavigationOptionProps & { hasTitleOnly?: boolean };
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* > ⚠️ This component is **deprecated** and superseded by the [new ListItem component](?path=/docs/content-listitem--docs) with the [ListItem.Navigation control](?path=/docs/content-listitem-listitem-navigation--docs).
|
|
20
|
+
*/
|
|
18
21
|
const meta: Meta<StoryArgs> = {
|
|
19
22
|
component: NavigationOption,
|
|
20
23
|
title: 'Option/NavigationOption',
|
|
21
|
-
tags: ['
|
|
24
|
+
tags: ['deprecated'],
|
|
22
25
|
argTypes: {
|
|
23
26
|
href: { control: 'text' },
|
|
24
27
|
title: { control: 'text' },
|
|
@@ -8,6 +8,14 @@ import { OptionProps, ReferenceType } from '../common/Option/Option';
|
|
|
8
8
|
|
|
9
9
|
export type NavigationOptionProps = OptionProps;
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Please use `<ListItem />` instead.
|
|
13
|
+
* @deprecatedSince 46.104.0
|
|
14
|
+
* @see [Source](../listItem/ListItem.tsx)
|
|
15
|
+
* @see [Storybook](https://storybook.wise.design/?path=/docs/content-listitem--docs)
|
|
16
|
+
* @see [Design docs](https://wise.design/components/list-item)
|
|
17
|
+
* @see [Release notes](https://transferwise.atlassian.net/wiki/spaces/DS/pages/3647251055/List+Item+release+notes)
|
|
18
|
+
*/
|
|
11
19
|
const NavigationOption = forwardRef<ReferenceType, NavigationOptionProps>(
|
|
12
20
|
({ as: component = 'button', disabled = false, onClick, className, ...rest }, reference) => {
|
|
13
21
|
if ('href' in rest && rest.href) {
|
|
@@ -2,9 +2,13 @@ import NavigationOption from '../navigationOption';
|
|
|
2
2
|
|
|
3
3
|
import NavigationOptionsList from '.';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* > ⚠️ This component is **deprecated** and superseded by the [List](?path=/docs/content-list--docs), [new ListItem component](?path=/docs/content-listitem--docs) with the [ListItem.Navigation control](?path=/docs/content-listitem-listitem-navigation--docs).
|
|
7
|
+
*/
|
|
5
8
|
export default {
|
|
6
9
|
component: NavigationOptionsList,
|
|
7
10
|
title: 'Option/NavigationOptionsList',
|
|
11
|
+
tags: ['deprecated'],
|
|
8
12
|
};
|
|
9
13
|
|
|
10
14
|
export const Basic = () => {
|
|
@@ -5,6 +5,15 @@ export interface NavigationOptionListProps {
|
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Please use `<List />` and `<ListItem />` instead.
|
|
10
|
+
* @deprecatedSince 46.104.0
|
|
11
|
+
* @see [List source](../list/List.tsx)
|
|
12
|
+
* @see [ListItem source](../listItem/ListItem.tsx)
|
|
13
|
+
* @see [Storybook](https://storybook.wise.design/?path=/docs/content-listitem--docs)
|
|
14
|
+
* @see [Design docs](https://wise.design/components/list-item)
|
|
15
|
+
* @see [Release notes](https://transferwise.atlassian.net/wiki/spaces/DS/pages/3647251055/List+Item+release+notes)
|
|
16
|
+
*/
|
|
8
17
|
const NavigationOptionList = ({ children }: NavigationOptionListProps) => {
|
|
9
18
|
return (
|
|
10
19
|
<ul className="np-navigation-options-list">
|