@transferwise/components 0.0.0-experimental-a12c97e → 0.0.0-experimental-e1870f3
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/flowNavigation/animatedLabel/AnimatedLabel.js +2 -2
- package/build/flowNavigation/animatedLabel/AnimatedLabel.js.map +1 -1
- package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs +2 -2
- package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs.map +1 -1
- package/build/index.js +2 -2
- package/build/index.mjs +1 -1
- package/build/{legacylistItem → listItem}/List.js +3 -2
- package/build/listItem/List.js.map +1 -0
- package/build/{legacylistItem → listItem}/List.mjs +3 -2
- package/build/listItem/List.mjs.map +1 -0
- package/build/switch/Switch.js.map +1 -1
- package/build/switch/Switch.mjs.map +1 -1
- package/build/types/index.d.ts +4 -4
- package/build/types/index.d.ts.map +1 -1
- package/build/types/legacylistItem/index.d.ts +0 -2
- package/build/types/legacylistItem/index.d.ts.map +1 -1
- package/build/types/listItem/List.d.ts +7 -0
- package/build/types/listItem/List.d.ts.map +1 -0
- package/build/types/listItem/index.d.ts +2 -0
- package/build/types/listItem/index.d.ts.map +1 -1
- package/build/types/switch/Switch.d.ts +1 -1
- package/build/types/switch/Switch.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +1 -1
- package/src/index.ts +9 -4
- package/src/legacylistItem/LegacyListItem.story.tsx +2 -2
- package/src/legacylistItem/LegacyListItem.tests.story.tsx +2 -1
- package/src/legacylistItem/index.ts +0 -2
- package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.story.tsx +8 -58
- package/src/listItem/AvatarLayout/ListItemAvatarLayout.story.tsx +5 -7
- package/src/listItem/AvatarView/ListItemAvatarView.story.tsx +8 -25
- package/src/listItem/Button/ListItemButton.story.tsx +46 -103
- package/src/listItem/Checkbox/ListItemCheckbox.story.tsx +0 -18
- package/src/listItem/IconButton/ListItemIconButton.story.tsx +8 -21
- package/src/listItem/List.tsx +11 -0
- package/src/listItem/Navigation/ListItemNavigation.story.tsx +2 -5
- package/src/listItem/Prompt/ListItemPrompt.story.tsx +7 -7
- package/src/listItem/Radio/ListItemRadio.story.tsx +0 -10
- package/src/listItem/Switch/ListItemSwitch.story.tsx +3 -10
- package/src/listItem/_stories/ListItem.scenarios.story.tsx +30 -13
- package/src/listItem/_stories/ListItem.story.tsx +142 -206
- package/src/listItem/_stories/ListItem.variants.test.story.tsx +5 -4
- package/src/listItem/index.ts +3 -0
- package/src/switch/Switch.tsx +1 -1
- package/build/legacylistItem/List.js.map +0 -1
- package/build/legacylistItem/List.mjs.map +0 -1
- package/build/types/legacylistItem/List.d.ts +0 -6
- package/build/types/legacylistItem/List.d.ts.map +0 -1
- package/build/types/listItem/_stories/helpers.d.ts +0 -27
- package/build/types/listItem/_stories/helpers.d.ts.map +0 -1
- package/src/legacylistItem/List.tsx +0 -10
- package/src/listItem/_stories/helpers.tsx +0 -53
|
@@ -2,11 +2,11 @@ import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
|
2
2
|
import { Flag } from '@wise/art';
|
|
3
3
|
import { lorem10 } from '../../test-utils';
|
|
4
4
|
import { ListItem } from '../ListItem';
|
|
5
|
+
import { List } from '../List';
|
|
5
6
|
import {
|
|
6
7
|
SB_LIST_ITEM_ADDITIONAL_INFO as INFO,
|
|
7
8
|
SB_LIST_ITEM_CONTROLS as CONTROLS,
|
|
8
9
|
} from '../_stories/subcomponents';
|
|
9
|
-
import { disableControls } from '../_stories/helpers';
|
|
10
10
|
import { ListItemAvatarLayoutProps } from './ListItemAvatarLayout';
|
|
11
11
|
|
|
12
12
|
export default {
|
|
@@ -64,10 +64,9 @@ export const Playground: Story = {
|
|
|
64
64
|
* Please refer to the [design documentation](https://wise.design/components/avatar#double) for more details.
|
|
65
65
|
*/
|
|
66
66
|
export const Orientations: Story = {
|
|
67
|
-
argTypes: disableControls()(['orientation']),
|
|
68
67
|
render: (args) => {
|
|
69
68
|
return (
|
|
70
|
-
<
|
|
69
|
+
<List as="ol">
|
|
71
70
|
<ListItem
|
|
72
71
|
title="Horizontal orientation"
|
|
73
72
|
subtitle={lorem10}
|
|
@@ -81,7 +80,7 @@ export const Orientations: Story = {
|
|
|
81
80
|
media={<ListItem.AvatarLayout {...args} orientation="diagonal" />}
|
|
82
81
|
control={CONTROLS.iconButton}
|
|
83
82
|
/>
|
|
84
|
-
</
|
|
83
|
+
</List>
|
|
85
84
|
);
|
|
86
85
|
},
|
|
87
86
|
};
|
|
@@ -97,13 +96,12 @@ export const Sizes: Story = {
|
|
|
97
96
|
},
|
|
98
97
|
},
|
|
99
98
|
},
|
|
100
|
-
argTypes: disableControls()(['size', 'orientation']),
|
|
101
99
|
render: (args) => {
|
|
102
100
|
const sizes = [32, 40, 48, 56, 72] as const;
|
|
103
101
|
const orientations = ['horizontal', 'diagonal'] as const;
|
|
104
102
|
|
|
105
103
|
return (
|
|
106
|
-
<
|
|
104
|
+
<List as="ol">
|
|
107
105
|
{orientations.map((orientation) =>
|
|
108
106
|
sizes.map((size) => (
|
|
109
107
|
<ListItem
|
|
@@ -115,7 +113,7 @@ export const Sizes: Story = {
|
|
|
115
113
|
/>
|
|
116
114
|
)),
|
|
117
115
|
)}
|
|
118
|
-
</
|
|
116
|
+
</List>
|
|
119
117
|
);
|
|
120
118
|
},
|
|
121
119
|
};
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { Leaf, Taxi } from '@transferwise/icons';
|
|
3
|
-
import { lorem10 } from '../../test-utils';
|
|
4
|
-
import { ProfileType } from '../../common';
|
|
5
3
|
import { ListItem } from '../ListItem';
|
|
6
4
|
import {
|
|
7
5
|
SB_LIST_ITEM_ADDITIONAL_INFO as INFO,
|
|
8
6
|
SB_LIST_ITEM_CONTROLS as CONTROLS,
|
|
9
7
|
} from '../_stories/subcomponents';
|
|
10
|
-
import { disableControls } from '../_stories/helpers';
|
|
11
8
|
import { ListItemAvatarViewProps } from './ListItemAvatarView';
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
import { lorem10 } from '../../test-utils';
|
|
10
|
+
import { ProfileType } from '../../common';
|
|
11
|
+
import { List } from '../List';
|
|
14
12
|
|
|
15
13
|
const SIZES = [32, 40, 48, 56, 72] as const;
|
|
16
14
|
const BADGES = {
|
|
@@ -81,11 +79,8 @@ export default {
|
|
|
81
79
|
},
|
|
82
80
|
profileType: {
|
|
83
81
|
control: 'select',
|
|
84
|
-
options: [
|
|
82
|
+
options: ['personal', 'business'],
|
|
85
83
|
description: 'Type of profile for default icons',
|
|
86
|
-
table: {
|
|
87
|
-
type: { summary: 'ProfileType' },
|
|
88
|
-
},
|
|
89
84
|
},
|
|
90
85
|
notification: {
|
|
91
86
|
control: 'boolean',
|
|
@@ -139,7 +134,6 @@ export const ContentTypes: Story = {
|
|
|
139
134
|
args: {
|
|
140
135
|
badge: undefined,
|
|
141
136
|
},
|
|
142
|
-
argTypes: hideControls(['profileName', 'imgSrc', 'profileType']),
|
|
143
137
|
parameters: {
|
|
144
138
|
docs: {
|
|
145
139
|
canvas: {
|
|
@@ -217,10 +211,9 @@ export const Sizes: Story = {
|
|
|
217
211
|
},
|
|
218
212
|
},
|
|
219
213
|
},
|
|
220
|
-
argTypes: hideControls(['profileName', 'imgSrc', 'profileType', 'size']),
|
|
221
214
|
render: (args) => {
|
|
222
215
|
return (
|
|
223
|
-
<
|
|
216
|
+
<List as="ol">
|
|
224
217
|
{SIZES.map((size) => (
|
|
225
218
|
<ListItem
|
|
226
219
|
key={size}
|
|
@@ -234,7 +227,7 @@ export const Sizes: Story = {
|
|
|
234
227
|
control={CONTROLS.iconButton}
|
|
235
228
|
/>
|
|
236
229
|
))}
|
|
237
|
-
</
|
|
230
|
+
</List>
|
|
238
231
|
);
|
|
239
232
|
},
|
|
240
233
|
};
|
|
@@ -254,17 +247,9 @@ export const Notification: Story = {
|
|
|
254
247
|
args: {
|
|
255
248
|
badge: undefined,
|
|
256
249
|
},
|
|
257
|
-
argTypes: hideControls([
|
|
258
|
-
'profileName',
|
|
259
|
-
'imgSrc',
|
|
260
|
-
'profileType',
|
|
261
|
-
'size',
|
|
262
|
-
'notification',
|
|
263
|
-
'selected',
|
|
264
|
-
]),
|
|
265
250
|
render: (args) => {
|
|
266
251
|
return (
|
|
267
|
-
<
|
|
252
|
+
<List as="ol">
|
|
268
253
|
{SIZES.map((size) => (
|
|
269
254
|
<ListItem
|
|
270
255
|
key={size}
|
|
@@ -278,7 +263,7 @@ export const Notification: Story = {
|
|
|
278
263
|
control={CONTROLS.iconButton}
|
|
279
264
|
/>
|
|
280
265
|
))}
|
|
281
|
-
</
|
|
266
|
+
</List>
|
|
282
267
|
);
|
|
283
268
|
},
|
|
284
269
|
};
|
|
@@ -291,7 +276,6 @@ export const Badges: Story = {
|
|
|
291
276
|
args: {
|
|
292
277
|
imgSrc: '../avatar-square-dude.webp',
|
|
293
278
|
},
|
|
294
|
-
argTypes: hideControls(['profileName', 'imgSrc', 'profileType', 'notification', 'selected']),
|
|
295
279
|
parameters: {
|
|
296
280
|
docs: {
|
|
297
281
|
canvas: {
|
|
@@ -320,7 +304,6 @@ export const Badges: Story = {
|
|
|
320
304
|
* AvatarView supports selected state for interactive contexts.
|
|
321
305
|
*/
|
|
322
306
|
export const Selected: Story = {
|
|
323
|
-
argTypes: hideControls(['profileName', 'imgSrc', 'profileType', 'notification', 'selected']),
|
|
324
307
|
render: (args) => {
|
|
325
308
|
return (
|
|
326
309
|
<ol className="list-unstyled">
|
|
@@ -7,15 +7,7 @@ import {
|
|
|
7
7
|
SB_LIST_ITEM_MEDIA as MEDIA,
|
|
8
8
|
} from '../_stories/subcomponents';
|
|
9
9
|
import type { ListItemButtonProps } from './ListItemButton';
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
const hideControls = disableControls([
|
|
13
|
-
'onClick',
|
|
14
|
-
'children',
|
|
15
|
-
'className',
|
|
16
|
-
'addonStart',
|
|
17
|
-
'addonEnd',
|
|
18
|
-
]);
|
|
10
|
+
import { List } from '../List';
|
|
19
11
|
|
|
20
12
|
/**
|
|
21
13
|
* Convenience controls for previewing rich markup,
|
|
@@ -137,11 +129,6 @@ const meta: Meta<typeof ListItem.Button> = {
|
|
|
137
129
|
addonEnd: {
|
|
138
130
|
description: 'Icon accessory to be displayed after the label',
|
|
139
131
|
},
|
|
140
|
-
onClick: {
|
|
141
|
-
table: {
|
|
142
|
-
type: { summary: '(event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void' },
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
132
|
},
|
|
146
133
|
} satisfies Meta<ListItemButtonProps>;
|
|
147
134
|
|
|
@@ -189,35 +176,27 @@ export const Playground: StoryObj<PreviewStoryArgs> = {
|
|
|
189
176
|
*
|
|
190
177
|
* Refer to the [design documentation](https://wise.design/components/list-item#interaction) for details.
|
|
191
178
|
*/
|
|
192
|
-
export const Interactivity:
|
|
179
|
+
export const Interactivity: Story = {
|
|
193
180
|
args: {
|
|
194
181
|
children: 'Action',
|
|
195
|
-
previewAddonStart: false,
|
|
196
|
-
previewAddonEnd: false,
|
|
197
182
|
},
|
|
198
|
-
|
|
199
|
-
...hideControls(['partiallyInteractive']),
|
|
200
|
-
...previewArgTypes,
|
|
201
|
-
},
|
|
202
|
-
render: (args: PreviewStoryArgs) => {
|
|
203
|
-
const [props, previewProps] = getPropsForPreview(args);
|
|
204
|
-
|
|
183
|
+
render: (args: ListItemButtonProps) => {
|
|
205
184
|
return (
|
|
206
|
-
<
|
|
185
|
+
<List as="ol">
|
|
207
186
|
<ListItem
|
|
208
187
|
title="Fully interactive ListItem"
|
|
209
188
|
subtitle="Button in fully interactive context"
|
|
210
189
|
media={MEDIA.avatarSingle}
|
|
211
|
-
control={<ListItem.Button {...
|
|
190
|
+
control={<ListItem.Button {...args} />}
|
|
212
191
|
/>
|
|
213
192
|
|
|
214
193
|
<ListItem
|
|
215
194
|
title="Partially interactive ListItem"
|
|
216
195
|
subtitle="Button in partially interactive context"
|
|
217
196
|
media={MEDIA.avatarSingle}
|
|
218
|
-
control={<ListItem.Button {...
|
|
197
|
+
control={<ListItem.Button {...args} partiallyInteractive />}
|
|
219
198
|
/>
|
|
220
|
-
</
|
|
199
|
+
</List>
|
|
221
200
|
);
|
|
222
201
|
},
|
|
223
202
|
};
|
|
@@ -225,27 +204,20 @@ export const Interactivity: StoryObj<PreviewStoryArgs> = {
|
|
|
225
204
|
/**
|
|
226
205
|
* If `href` prop is set, the component will be automatically rendered as an HTML anchor element.
|
|
227
206
|
*/
|
|
228
|
-
export const AsAnchor:
|
|
207
|
+
export const AsAnchor: Story = {
|
|
229
208
|
args: {
|
|
230
209
|
children: 'Visit link',
|
|
231
210
|
href: 'https://wise.com',
|
|
232
211
|
target: '_blank',
|
|
233
|
-
previewAddonStart: false,
|
|
234
|
-
previewAddonEnd: false,
|
|
235
212
|
},
|
|
236
|
-
|
|
237
|
-
...hideControls(['partiallyInteractive']),
|
|
238
|
-
...previewArgTypes,
|
|
239
|
-
},
|
|
240
|
-
render: (args: PreviewStoryArgs) => {
|
|
241
|
-
const [props, previewProps] = getPropsForPreview(args);
|
|
242
|
-
|
|
213
|
+
render: (args: ListItemButtonProps) => {
|
|
243
214
|
return (
|
|
244
215
|
<ListItem
|
|
245
|
-
title="List item with
|
|
246
|
-
subtitle="
|
|
216
|
+
title="List item with button link"
|
|
217
|
+
subtitle="Button rendered as anchor element"
|
|
247
218
|
media={MEDIA.avatarSingle}
|
|
248
|
-
control={<ListItem.Button {...
|
|
219
|
+
control={<ListItem.Button {...args} />}
|
|
220
|
+
additionalInfo={INFO.nonInteractive}
|
|
249
221
|
/>
|
|
250
222
|
);
|
|
251
223
|
},
|
|
@@ -256,27 +228,16 @@ export const AsAnchor: StoryObj<PreviewStoryArgs> = {
|
|
|
256
228
|
* **NB:** Sentiment only applies to `primary` and `secondary` priorities. <br />
|
|
257
229
|
* [Design documentation](https://wise.design/components/button#types)
|
|
258
230
|
*/
|
|
259
|
-
export const Sentiment:
|
|
260
|
-
args: {
|
|
261
|
-
children: 'Button text',
|
|
262
|
-
previewAddonStart: false,
|
|
263
|
-
previewAddonEnd: false,
|
|
264
|
-
},
|
|
265
|
-
argTypes: {
|
|
266
|
-
...hideControls(['sentiment', 'priority']),
|
|
267
|
-
...previewArgTypes,
|
|
268
|
-
},
|
|
269
|
-
render: (args: PreviewStoryArgs) => {
|
|
270
|
-
const [props, previewProps] = getPropsForPreview(args);
|
|
271
|
-
|
|
231
|
+
export const Sentiment: Story = {
|
|
232
|
+
render: (args: ListItemButtonProps) => {
|
|
272
233
|
return (
|
|
273
|
-
<
|
|
234
|
+
<List as="ol">
|
|
274
235
|
<ListItem
|
|
275
236
|
title="Default Sentiment - Primary"
|
|
276
237
|
subtitle="Default sentiment with primary priority"
|
|
277
238
|
media={MEDIA.avatarSingle}
|
|
278
239
|
control={
|
|
279
|
-
<ListItem.Button {...
|
|
240
|
+
<ListItem.Button {...args} priority="primary">
|
|
280
241
|
Default Sentiment
|
|
281
242
|
</ListItem.Button>
|
|
282
243
|
}
|
|
@@ -286,7 +247,7 @@ export const Sentiment: StoryObj<PreviewStoryArgs> = {
|
|
|
286
247
|
subtitle="Negative sentiment with primary priority"
|
|
287
248
|
media={MEDIA.avatarSingle}
|
|
288
249
|
control={
|
|
289
|
-
<ListItem.Button {...
|
|
250
|
+
<ListItem.Button {...args} priority="primary" sentiment="negative">
|
|
290
251
|
Negative Sentiment
|
|
291
252
|
</ListItem.Button>
|
|
292
253
|
}
|
|
@@ -296,7 +257,7 @@ export const Sentiment: StoryObj<PreviewStoryArgs> = {
|
|
|
296
257
|
subtitle="Default sentiment with secondary priority"
|
|
297
258
|
media={MEDIA.avatarSingle}
|
|
298
259
|
control={
|
|
299
|
-
<ListItem.Button {...
|
|
260
|
+
<ListItem.Button {...args} priority="secondary">
|
|
300
261
|
Default Sentiment
|
|
301
262
|
</ListItem.Button>
|
|
302
263
|
}
|
|
@@ -306,14 +267,17 @@ export const Sentiment: StoryObj<PreviewStoryArgs> = {
|
|
|
306
267
|
subtitle="Negative sentiment with secondary priority"
|
|
307
268
|
media={MEDIA.avatarSingle}
|
|
308
269
|
control={
|
|
309
|
-
<ListItem.Button {...
|
|
270
|
+
<ListItem.Button {...args} priority="secondary" sentiment="negative">
|
|
310
271
|
Negative Sentiment
|
|
311
272
|
</ListItem.Button>
|
|
312
273
|
}
|
|
313
274
|
/>
|
|
314
|
-
</
|
|
275
|
+
</List>
|
|
315
276
|
);
|
|
316
277
|
},
|
|
278
|
+
args: {
|
|
279
|
+
children: 'Button text',
|
|
280
|
+
},
|
|
317
281
|
};
|
|
318
282
|
|
|
319
283
|
/**
|
|
@@ -321,27 +285,16 @@ export const Sentiment: StoryObj<PreviewStoryArgs> = {
|
|
|
321
285
|
* screen to help more important buttons to take precedence over others. <br />
|
|
322
286
|
* [Design documentation](https://wise.design/components/button#priorities)
|
|
323
287
|
*/
|
|
324
|
-
export const Priority:
|
|
325
|
-
args: {
|
|
326
|
-
children: 'Button text',
|
|
327
|
-
previewAddonStart: false,
|
|
328
|
-
previewAddonEnd: false,
|
|
329
|
-
},
|
|
330
|
-
argTypes: {
|
|
331
|
-
...hideControls(['priority']),
|
|
332
|
-
...previewArgTypes,
|
|
333
|
-
},
|
|
334
|
-
render: (args: PreviewStoryArgs) => {
|
|
335
|
-
const [props, previewProps] = getPropsForPreview(args);
|
|
336
|
-
|
|
288
|
+
export const Priority: Story = {
|
|
289
|
+
render: (args: ListItemButtonProps) => {
|
|
337
290
|
return (
|
|
338
|
-
<
|
|
291
|
+
<List as="ol">
|
|
339
292
|
<ListItem
|
|
340
293
|
title="Primary Priority"
|
|
341
294
|
subtitle="Primary priority (default)"
|
|
342
295
|
media={MEDIA.avatarSingle}
|
|
343
296
|
control={
|
|
344
|
-
<ListItem.Button {...
|
|
297
|
+
<ListItem.Button {...args} priority="primary">
|
|
345
298
|
Primary Priority
|
|
346
299
|
</ListItem.Button>
|
|
347
300
|
}
|
|
@@ -351,7 +304,7 @@ export const Priority: StoryObj<PreviewStoryArgs> = {
|
|
|
351
304
|
subtitle="Secondary priority"
|
|
352
305
|
media={MEDIA.avatarSingle}
|
|
353
306
|
control={
|
|
354
|
-
<ListItem.Button {...
|
|
307
|
+
<ListItem.Button {...args} priority="secondary">
|
|
355
308
|
Secondary Priority
|
|
356
309
|
</ListItem.Button>
|
|
357
310
|
}
|
|
@@ -361,7 +314,7 @@ export const Priority: StoryObj<PreviewStoryArgs> = {
|
|
|
361
314
|
subtitle="Secondary neutral priority"
|
|
362
315
|
media={MEDIA.avatarSingle}
|
|
363
316
|
control={
|
|
364
|
-
<ListItem.Button {...
|
|
317
|
+
<ListItem.Button {...args} priority="secondary-neutral">
|
|
365
318
|
Secondary Neutral Priority
|
|
366
319
|
</ListItem.Button>
|
|
367
320
|
}
|
|
@@ -371,46 +324,37 @@ export const Priority: StoryObj<PreviewStoryArgs> = {
|
|
|
371
324
|
subtitle="Tertiary priority"
|
|
372
325
|
media={MEDIA.avatarSingle}
|
|
373
326
|
control={
|
|
374
|
-
<ListItem.Button {...
|
|
327
|
+
<ListItem.Button {...args} priority="tertiary">
|
|
375
328
|
Tertiary Priority
|
|
376
329
|
</ListItem.Button>
|
|
377
330
|
}
|
|
378
331
|
/>
|
|
379
|
-
</
|
|
332
|
+
</List>
|
|
380
333
|
);
|
|
381
334
|
},
|
|
335
|
+
args: {
|
|
336
|
+
children: 'Button text',
|
|
337
|
+
},
|
|
382
338
|
};
|
|
383
339
|
|
|
384
340
|
/**
|
|
385
341
|
* Button in loading state.
|
|
386
342
|
*/
|
|
387
|
-
export const Loading:
|
|
388
|
-
args: {
|
|
389
|
-
loading: true,
|
|
390
|
-
previewAddonStart: false,
|
|
391
|
-
previewAddonEnd: false,
|
|
392
|
-
},
|
|
393
|
-
argTypes: {
|
|
394
|
-
...hideControls(['loading']),
|
|
395
|
-
...previewArgTypes,
|
|
396
|
-
},
|
|
397
|
-
render: (args: PreviewStoryArgs) => {
|
|
398
|
-
const [props, previewProps] = getPropsForPreview(args);
|
|
399
|
-
|
|
343
|
+
export const Loading: Story = {
|
|
344
|
+
render: (args: ListItemButtonProps) => {
|
|
400
345
|
return (
|
|
401
346
|
<ListItem
|
|
402
347
|
title="Loading Button"
|
|
403
348
|
subtitle="Button in loading state"
|
|
404
349
|
media={MEDIA.avatarSingle}
|
|
405
|
-
control={
|
|
406
|
-
<ListItem.Button {...props} {...previewProps}>
|
|
407
|
-
Loading Button
|
|
408
|
-
</ListItem.Button>
|
|
409
|
-
}
|
|
350
|
+
control={<ListItem.Button {...args}>Loading Button</ListItem.Button>}
|
|
410
351
|
additionalInfo={INFO.nonInteractive}
|
|
411
352
|
/>
|
|
412
353
|
);
|
|
413
354
|
},
|
|
355
|
+
args: {
|
|
356
|
+
loading: true,
|
|
357
|
+
},
|
|
414
358
|
};
|
|
415
359
|
|
|
416
360
|
const addonProps = {
|
|
@@ -423,13 +367,9 @@ const addonProps = {
|
|
|
423
367
|
* **NB:** ListItem.Button only supports icon addons.
|
|
424
368
|
*/
|
|
425
369
|
export const WithIcons: Story = {
|
|
426
|
-
args: {
|
|
427
|
-
children: 'Button text',
|
|
428
|
-
},
|
|
429
|
-
argTypes: hideControls(),
|
|
430
370
|
render: (args: ListItemButtonProps) => {
|
|
431
371
|
return (
|
|
432
|
-
<
|
|
372
|
+
<List as="ol">
|
|
433
373
|
<ListItem
|
|
434
374
|
title="With Start Icon"
|
|
435
375
|
subtitle="Button with icon before the label"
|
|
@@ -460,7 +400,10 @@ export const WithIcons: Story = {
|
|
|
460
400
|
</ListItem.Button>
|
|
461
401
|
}
|
|
462
402
|
/>
|
|
463
|
-
</
|
|
403
|
+
</List>
|
|
464
404
|
);
|
|
465
405
|
},
|
|
406
|
+
args: {
|
|
407
|
+
children: 'Button text',
|
|
408
|
+
},
|
|
466
409
|
};
|
|
@@ -32,21 +32,6 @@ const meta: Meta<ListItemCheckboxProps> = {
|
|
|
32
32
|
indeterminate: {
|
|
33
33
|
control: 'boolean',
|
|
34
34
|
},
|
|
35
|
-
onChange: {
|
|
36
|
-
table: {
|
|
37
|
-
type: { summary: '(event: ChangeEvent<HTMLInputElement>) => void' },
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
onFocus: {
|
|
41
|
-
table: {
|
|
42
|
-
type: { summary: '(event: FocusEvent<HTMLInputElement>) => void' },
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
onBlur: {
|
|
46
|
-
table: {
|
|
47
|
-
type: { summary: '(event: FocusEvent<HTMLInputElement>) => void' },
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
35
|
},
|
|
51
36
|
} satisfies Meta<ListItemCheckboxProps>;
|
|
52
37
|
|
|
@@ -73,9 +58,6 @@ export const Playground: Story = {
|
|
|
73
58
|
* Checkbox controls demonstrate different states including checked, unchecked, and indeterminate.
|
|
74
59
|
*/
|
|
75
60
|
export const States: Story = {
|
|
76
|
-
parameters: {
|
|
77
|
-
controls: { disable: true },
|
|
78
|
-
},
|
|
79
61
|
render: function Render() {
|
|
80
62
|
const [isChecked0, setisChecked0] = useState(false);
|
|
81
63
|
const [isChecked1, setisChecked1] = useState(true);
|
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import ListItem, { List } from '..';
|
|
2
3
|
import { Edit } from '@transferwise/icons';
|
|
3
|
-
import { fn } from 'storybook/test';
|
|
4
|
-
import { ListItem } from '../ListItem';
|
|
5
4
|
import {
|
|
6
5
|
SB_LIST_ITEM_ADDITIONAL_INFO as INFO,
|
|
7
6
|
SB_LIST_ITEM_MEDIA as MEDIA,
|
|
8
7
|
SB_LIST_ITEM_PROMPTS as PROMPTS,
|
|
9
8
|
} from '../_stories/subcomponents';
|
|
10
|
-
import { disableControls } from '../_stories/helpers';
|
|
11
9
|
import type { ListItemIconButtonProps } from './ListItemIconButton';
|
|
12
|
-
|
|
13
|
-
const hideControls = disableControls([
|
|
14
|
-
'onClick',
|
|
15
|
-
'children',
|
|
16
|
-
'className',
|
|
17
|
-
'addonStart',
|
|
18
|
-
'addonEnd',
|
|
19
|
-
]);
|
|
10
|
+
import { fn } from 'storybook/test';
|
|
20
11
|
|
|
21
12
|
/**
|
|
22
13
|
* Use IconButton to provide compact action controls within a ListItem context using iconography.
|
|
@@ -121,10 +112,9 @@ export const Interactivity: Story = {
|
|
|
121
112
|
args: {
|
|
122
113
|
children: <Edit />,
|
|
123
114
|
},
|
|
124
|
-
argTypes: hideControls(['partiallyInteractive']),
|
|
125
115
|
render: (args: ListItemIconButtonProps) => {
|
|
126
116
|
return (
|
|
127
|
-
<
|
|
117
|
+
<List as="ol">
|
|
128
118
|
<ListItem
|
|
129
119
|
control={<ListItem.IconButton {...args} />}
|
|
130
120
|
title="Fully interactive ListItem"
|
|
@@ -142,7 +132,7 @@ export const Interactivity: Story = {
|
|
|
142
132
|
additionalInfo={INFO.interactive}
|
|
143
133
|
prompt={PROMPTS.interactive}
|
|
144
134
|
/>
|
|
145
|
-
</
|
|
135
|
+
</List>
|
|
146
136
|
);
|
|
147
137
|
},
|
|
148
138
|
};
|
|
@@ -153,10 +143,9 @@ export const Interactivity: Story = {
|
|
|
153
143
|
* [Design documentation](https://wise.design/components/icon-button#types)
|
|
154
144
|
*/
|
|
155
145
|
export const Sentiment: Story = {
|
|
156
|
-
argTypes: hideControls(['sentiment', 'priority']),
|
|
157
146
|
render: (args) => {
|
|
158
147
|
return (
|
|
159
|
-
<
|
|
148
|
+
<List as="ol">
|
|
160
149
|
<ListItem
|
|
161
150
|
control={<ListItem.IconButton {...args} priority="primary" type="default" />}
|
|
162
151
|
title="Default Sentiment - Primary"
|
|
@@ -181,7 +170,7 @@ export const Sentiment: Story = {
|
|
|
181
170
|
subtitle="Negative sentiment with secondary priority"
|
|
182
171
|
media={MEDIA.avatarSingle}
|
|
183
172
|
/>
|
|
184
|
-
</
|
|
173
|
+
</List>
|
|
185
174
|
);
|
|
186
175
|
},
|
|
187
176
|
};
|
|
@@ -192,10 +181,9 @@ export const Sentiment: Story = {
|
|
|
192
181
|
* [Design documentation](https://wise.design/components/icon-button#priorities)
|
|
193
182
|
*/
|
|
194
183
|
export const Priority: Story = {
|
|
195
|
-
argTypes: hideControls(['sentiment', 'priority']),
|
|
196
184
|
render: (args) => {
|
|
197
185
|
return (
|
|
198
|
-
<
|
|
186
|
+
<List as="ol">
|
|
199
187
|
<ListItem
|
|
200
188
|
title="Primary Priority"
|
|
201
189
|
subtitle="Primary priority (default)"
|
|
@@ -220,7 +208,7 @@ export const Priority: Story = {
|
|
|
220
208
|
media={MEDIA.avatarSingle}
|
|
221
209
|
control={<ListItem.IconButton {...args} priority="minimal" />}
|
|
222
210
|
/>
|
|
223
|
-
</
|
|
211
|
+
</List>
|
|
224
212
|
);
|
|
225
213
|
},
|
|
226
214
|
};
|
|
@@ -235,7 +223,6 @@ export const AsAnchor: Story = {
|
|
|
235
223
|
target: '_blank',
|
|
236
224
|
onClick: undefined,
|
|
237
225
|
},
|
|
238
|
-
argTypes: hideControls(),
|
|
239
226
|
render: (args: ListItemIconButtonProps) => {
|
|
240
227
|
return (
|
|
241
228
|
<ListItem
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
|
|
3
|
+
export interface ListProps {
|
|
4
|
+
as?: 'ul' | 'ol' | 'div';
|
|
5
|
+
className?: string;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function List({ as: Element = 'ul', className, children }: ListProps) {
|
|
10
|
+
return <Element className={clsx('wds-list', 'list-unstyled', className)}>{children}</Element>;
|
|
11
|
+
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
import { fn } from 'storybook/test';
|
|
3
|
-
import { lorem10 } from '../../test-utils';
|
|
4
2
|
import { ListItem } from '../ListItem';
|
|
5
3
|
import {
|
|
6
4
|
SB_LIST_ITEM_ADDITIONAL_INFO as INFO,
|
|
@@ -8,6 +6,8 @@ import {
|
|
|
8
6
|
SB_LIST_ITEM_MEDIA as MEDIA,
|
|
9
7
|
} from '../_stories/subcomponents';
|
|
10
8
|
import type { ListItemNavigationProps } from './ListItemNavigation';
|
|
9
|
+
import { lorem10 } from '../../test-utils';
|
|
10
|
+
import { fn } from 'storybook/test';
|
|
11
11
|
|
|
12
12
|
const meta: Meta<ListItemNavigationProps> = {
|
|
13
13
|
component: ListItem.Navigation,
|
|
@@ -62,9 +62,6 @@ export const AsButton: Story = {
|
|
|
62
62
|
args: {
|
|
63
63
|
onClick: fn(),
|
|
64
64
|
},
|
|
65
|
-
parameters: {
|
|
66
|
-
controls: { disable: true },
|
|
67
|
-
},
|
|
68
65
|
render: (args) => {
|
|
69
66
|
return (
|
|
70
67
|
<ol className="list-unstyled">
|
|
@@ -3,7 +3,7 @@ import { action } from 'storybook/actions';
|
|
|
3
3
|
import { lorem10, lorem5 } from '../../test-utils';
|
|
4
4
|
import Link from '../../link';
|
|
5
5
|
import { Sentiment as Sentiments } from '../../common';
|
|
6
|
-
import { ListItem } from '../..';
|
|
6
|
+
import { List, ListItem } from '../..';
|
|
7
7
|
import { Prompt, ListItemPromptProps } from './ListItemPrompt';
|
|
8
8
|
import {
|
|
9
9
|
SB_LIST_ITEM_CONTROLS as CONTROLS,
|
|
@@ -74,7 +74,7 @@ export const Sentiment: Story = {
|
|
|
74
74
|
knobs: { disable: true },
|
|
75
75
|
},
|
|
76
76
|
render: (args) => (
|
|
77
|
-
<
|
|
77
|
+
<List as="ol">
|
|
78
78
|
<ListItem
|
|
79
79
|
title={lorem5}
|
|
80
80
|
subtitle={lorem10}
|
|
@@ -103,7 +103,7 @@ export const Sentiment: Story = {
|
|
|
103
103
|
control={CONTROLS.switch}
|
|
104
104
|
prompt={<Prompt sentiment={Sentiments.NEGATIVE}>This is a negative prompt.</Prompt>}
|
|
105
105
|
/>
|
|
106
|
-
</
|
|
106
|
+
</List>
|
|
107
107
|
),
|
|
108
108
|
};
|
|
109
109
|
|
|
@@ -122,7 +122,7 @@ export const Interactivity: Story = {
|
|
|
122
122
|
},
|
|
123
123
|
},
|
|
124
124
|
render: (args) => (
|
|
125
|
-
<
|
|
125
|
+
<List as="ol">
|
|
126
126
|
<ListItem
|
|
127
127
|
title={lorem5}
|
|
128
128
|
subtitle={lorem10}
|
|
@@ -154,7 +154,7 @@ export const Interactivity: Story = {
|
|
|
154
154
|
</Prompt>
|
|
155
155
|
}
|
|
156
156
|
/>
|
|
157
|
-
</
|
|
157
|
+
</List>
|
|
158
158
|
),
|
|
159
159
|
};
|
|
160
160
|
|
|
@@ -172,7 +172,7 @@ export const Sizing: Story = {
|
|
|
172
172
|
},
|
|
173
173
|
},
|
|
174
174
|
render: (args) => (
|
|
175
|
-
<
|
|
175
|
+
<List as="ol">
|
|
176
176
|
<ListItem
|
|
177
177
|
title={lorem5}
|
|
178
178
|
subtitle={lorem10}
|
|
@@ -196,6 +196,6 @@ export const Sizing: Story = {
|
|
|
196
196
|
</ListItem.Prompt>
|
|
197
197
|
}
|
|
198
198
|
/>
|
|
199
|
-
</
|
|
199
|
+
</List>
|
|
200
200
|
),
|
|
201
201
|
};
|