@transferwise/components 0.0.0-experimental-09066ec → 0.0.0-experimental-148ffef

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/build/common/liveRegion/LiveRegion.js +44 -7
  2. package/build/common/liveRegion/LiveRegion.js.map +1 -1
  3. package/build/common/liveRegion/LiveRegion.mjs +44 -7
  4. package/build/common/liveRegion/LiveRegion.mjs.map +1 -1
  5. package/build/flowNavigation/FlowNavigation.js +1 -0
  6. package/build/flowNavigation/FlowNavigation.js.map +1 -1
  7. package/build/flowNavigation/FlowNavigation.mjs +1 -0
  8. package/build/flowNavigation/FlowNavigation.mjs.map +1 -1
  9. package/build/overlayHeader/OverlayHeader.js +1 -0
  10. package/build/overlayHeader/OverlayHeader.js.map +1 -1
  11. package/build/overlayHeader/OverlayHeader.mjs +1 -0
  12. package/build/overlayHeader/OverlayHeader.mjs.map +1 -1
  13. package/build/prompt/InfoPrompt/InfoPrompt.js +2 -0
  14. package/build/prompt/InfoPrompt/InfoPrompt.js.map +1 -1
  15. package/build/prompt/InfoPrompt/InfoPrompt.mjs +2 -0
  16. package/build/prompt/InfoPrompt/InfoPrompt.mjs.map +1 -1
  17. package/build/types/common/liveRegion/LiveRegion.d.ts +5 -2
  18. package/build/types/common/liveRegion/LiveRegion.d.ts.map +1 -1
  19. package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts.map +1 -1
  20. package/package.json +3 -3
  21. package/src/{DisabledComponents.story.tsx → DisabledComponents.test.story.tsx} +1 -1
  22. package/src/actionButton/ActionButton.story.tsx +11 -7
  23. package/src/actionButton/ActionButton.test.story.tsx +49 -0
  24. package/src/avatarLayout/AvatarLayout.story.tsx +1 -105
  25. package/src/avatarLayout/AvatarLayout.test.story.tsx +117 -0
  26. package/src/avatarView/AvatarView.story.tsx +1 -104
  27. package/src/avatarView/AvatarView.test.story.tsx +114 -0
  28. package/src/button/LegacyButton.story.tsx +1 -26
  29. package/src/button/LegacyButton.test.story.tsx +37 -0
  30. package/src/button/_stories/Button.story.tsx +17 -41
  31. package/src/button/_stories/Button.test.story.tsx +30 -0
  32. package/src/checkbox/Checkbox.story.tsx +1 -6
  33. package/src/checkbox/Checkbox.test.story.tsx +33 -0
  34. package/src/circularButton/CircularButton.story.tsx +0 -6
  35. package/src/circularButton/CircularButton.test.story.tsx +62 -1
  36. package/src/common/bottomSheet/BottomSheet.story.tsx +0 -55
  37. package/src/common/bottomSheet/BottomSheet.test.story.tsx +118 -2
  38. package/src/common/liveRegion/LiveRegion.test.tsx +69 -2
  39. package/src/common/liveRegion/LiveRegion.tsx +75 -8
  40. package/src/criticalBanner/CriticalCommsBanner.test.story.tsx +1 -1
  41. package/src/dateLookup/DateLookup.story.tsx +0 -18
  42. package/src/dateLookup/DateLookup.test.story.tsx +51 -1
  43. package/src/divider/Divider.story.tsx +0 -1
  44. package/src/expressiveMoneyInput/ExpressiveMoneyInput.autofocus.docs.mdx +1 -1
  45. package/src/expressiveMoneyInput/ExpressiveMoneyInput.story.tsx +0 -9
  46. package/src/expressiveMoneyInput/ExpressiveMoneyInput.test.story.tsx +23 -0
  47. package/src/field/Field.story.tsx +1 -34
  48. package/src/field/Field.test.story.tsx +56 -0
  49. package/src/header/Header.test.story.tsx +1 -1
  50. package/src/info/Info.story.tsx +1 -34
  51. package/src/info/Info.test.story.tsx +53 -0
  52. package/src/inputWithDisplayFormat/InputWithDisplayFormat.story.tsx +0 -12
  53. package/src/inputWithDisplayFormat/InputWithDisplayFormat.test.story.tsx +33 -0
  54. package/src/legacylistItem/LegacyListItem.test.story.tsx +1 -1
  55. package/src/listItem/_stories/Breakpoints/ListItem.noMedia.test.story.tsx +1 -1
  56. package/src/listItem/_stories/Breakpoints/ListItem.sideMedia.test.story.tsx +1 -1
  57. package/src/listItem/_stories/Breakpoints/ListItem.stackedMedia.test.story.tsx +1 -1
  58. package/src/listItem/_stories/ListItem.focus.test.story.tsx +1 -1
  59. package/src/listItem/_stories/ListItem.layout.test.story.tsx +1 -1
  60. package/src/listItem/_stories/variants/ListItem.brightGreen.test.story.tsx +1 -1
  61. package/src/listItem/_stories/variants/ListItem.dark.test.story.tsx +1 -1
  62. package/src/listItem/_stories/variants/ListItem.forestGreen.test.story.tsx +1 -1
  63. package/src/listItem/_stories/variants/ListItem.medium.test.story.tsx +1 -1
  64. package/src/listItem/_stories/variants/ListItem.neutral.test.story.tsx +1 -1
  65. package/src/listItem/_stories/variants/ListItem.personal.test.story.tsx +1 -1
  66. package/src/listItem/_stories/variants/ListItem.rtl.test.story.tsx +1 -1
  67. package/src/listItem/_stories/variants/ListItem.small.test.story.tsx +1 -1
  68. package/src/logo/Logo.story.tsx +0 -6
  69. package/src/logo/Logo.test.story.tsx +20 -0
  70. package/src/modal/Modal.story.tsx +0 -26
  71. package/src/modal/Modal.test.story.tsx +125 -0
  72. package/src/moneyInput/MoneyInput.test.story.tsx +1 -1
  73. package/src/prompt/ActionPrompt/ActionPrompt.story.tsx +0 -43
  74. package/src/prompt/ActionPrompt/ActionPrompt.test.story.tsx +45 -1
  75. package/src/prompt/InfoPrompt/InfoPrompt.test.story.tsx +142 -5
  76. package/src/prompt/InfoPrompt/InfoPrompt.test.tsx +11 -6
  77. package/src/prompt/InfoPrompt/InfoPrompt.tsx +2 -1
  78. package/src/radioGroup/RadioGroup.test.story.tsx +1 -1
  79. package/src/stepper/Stepper.test.story.tsx +1 -1
  80. package/src/summary/Summary.test.story.tsx +1 -1
  81. package/src/tooltip/Tooltip.story.tsx +0 -21
  82. package/src/tooltip/Tooltip.test.story.tsx +42 -0
  83. package/src/typeahead/Typeahead.story.tsx +0 -52
  84. package/src/typeahead/Typeahead.test.story.tsx +73 -0
@@ -0,0 +1,49 @@
1
+ import { Meta, StoryObj } from '@storybook/react-webpack5';
2
+ import { Settings } from '@transferwise/icons';
3
+ import ActionButton from './ActionButton';
4
+ import { withVariantConfig } from '../../.storybook/helpers';
5
+
6
+ const meta: Meta<typeof ActionButton> = {
7
+ component: ActionButton,
8
+ tags: ['!autodocs', '!manifest', 'deprecated'],
9
+ title: 'Actions/ActionButton/Tests',
10
+ };
11
+ export default meta;
12
+
13
+ type Story = StoryObj<typeof ActionButton>;
14
+
15
+ export const DisabledVariants: Story = {
16
+ render: (args) => (
17
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '0.4rem' }}>
18
+ <div>
19
+ <ActionButton priority="primary" {...args}>
20
+ Primary label
21
+ </ActionButton>
22
+ <ActionButton priority="secondary" {...args}>
23
+ Secondary label
24
+ </ActionButton>
25
+ <ActionButton priority="tertiary" {...args}>
26
+ Tertiary label
27
+ </ActionButton>
28
+ </div>
29
+ <div>
30
+ <ActionButton priority="primary" {...args}>
31
+ <Settings />
32
+ Primary label
33
+ </ActionButton>
34
+ <ActionButton priority="secondary" {...args}>
35
+ <Settings />
36
+ Secondary label
37
+ </ActionButton>
38
+ <ActionButton priority="tertiary" {...args}>
39
+ <Settings />
40
+ Tertiary label
41
+ </ActionButton>
42
+ </div>
43
+ </div>
44
+ ),
45
+ args: {
46
+ disabled: true,
47
+ },
48
+ ...withVariantConfig(['default', 'dark', 'rtl', 'mobile']),
49
+ };
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable react/jsx-key */
2
2
  import { Meta, StoryObj } from '@storybook/react-webpack5';
3
3
  import AvatarLayout, { AvatarLayoutProps } from '.';
4
- import { Freeze, Graph, Plane, Rewards } from '@transferwise/icons';
4
+ import { Freeze } from '@transferwise/icons';
5
5
  import { Flag } from '@wise/art';
6
6
  import Body from '../body';
7
7
  import SentimentSurface from '../sentimentSurface';
@@ -181,110 +181,6 @@ export const Horizontal: Story = {
181
181
  ),
182
182
  };
183
183
 
184
- export const EdgeInstances: Story = {
185
- render: () => (
186
- <div
187
- style={{
188
- gap: '1em',
189
- display: 'grid',
190
- justifyContent: 'space-between',
191
- gridTemplate: `auto auto / repeat(2, min-content)`,
192
- }}
193
- >
194
- <AvatarLayout orientation="diagonal" avatars={[]} />
195
-
196
- <AvatarLayout orientation="diagonal" avatars={[{}]} />
197
-
198
- <AvatarLayout orientation="diagonal" avatars={[{ profileName: 'Jay Jay' }]} />
199
- <AvatarLayout orientation="diagonal" size={16} avatars={[{ profileName: 'Jay Jay' }]} />
200
-
201
- <AvatarLayout orientation="diagonal" avatars={[{ asset: <Flag code="gb" /> }]} />
202
- <AvatarLayout orientation="diagonal" size={24} avatars={[{ asset: <Flag code="gb" /> }]} />
203
-
204
- <AvatarLayout
205
- orientation="diagonal"
206
- avatars={[{ asset: <Flag code="gb" /> }, { asset: <Flag code="jp" /> }]}
207
- />
208
-
209
- <AvatarLayout
210
- orientation="horizontal"
211
- interactive
212
- avatars={[
213
- { imgSrc: '../avatar-squere-dude.webp' },
214
- { asset: null, style: { border: '1px dashed var(--color-border-neutral)' } },
215
- ]}
216
- />
217
-
218
- <AvatarLayout
219
- orientation="horizontal"
220
- interactive
221
- avatars={[
222
- { imgSrc: '../avatar-square-dude.webp' },
223
- {
224
- asset: <Plane />,
225
- style: { backgroundColor: 'var(--color-bright-pink)' },
226
- },
227
- ]}
228
- />
229
-
230
- <AvatarLayout
231
- orientation="horizontal"
232
- interactive
233
- avatars={[
234
- {
235
- asset: <Graph />,
236
- style: { color: 'rgb(22, 51, 0)', backgroundColor: 'rgb(203, 217, 195)' },
237
- },
238
- {
239
- asset: <Rewards />,
240
- style: { color: 'rgb(203, 217, 195)', backgroundColor: 'rgb(22, 51, 0)' },
241
- },
242
- ]}
243
- />
244
-
245
- <AvatarLayout
246
- orientation="horizontal"
247
- interactive
248
- avatars={[
249
- { asset: <Flag code="gb" /> },
250
- { asset: '3+', style: { border: '1px dashed var(--color-border-neutral)' } },
251
- ]}
252
- />
253
-
254
- <AvatarLayout
255
- orientation="horizontal"
256
- avatars={[{ imgSrc: '../avatar-rectangle-fox.webp' }, { profileName: 'Jay Jay' }]}
257
- />
258
-
259
- <AvatarLayout
260
- interactive
261
- orientation="horizontal"
262
- avatars={[
263
- { imgSrc: '../avatar-rectangle-fox.webp' },
264
- { imgSrc: '../avatar-square-dude.webp' },
265
- { asset: '7+' },
266
- ]}
267
- />
268
-
269
- <AvatarLayout
270
- interactive
271
- orientation="horizontal"
272
- avatars={[{ asset: <Flag code="gb" /> }, { asset: <Flag code="br" /> }, { asset: '3+' }]}
273
- />
274
-
275
- <AvatarLayout
276
- orientation="horizontal"
277
- avatars={[
278
- { asset: <Flag code="gb" /> },
279
- { asset: <Flag code="br" /> },
280
- { asset: <Flag code="jp" /> },
281
- { asset: '3+' },
282
- ]}
283
- />
284
- </div>
285
- ),
286
- };
287
-
288
184
  /**
289
185
  * Like [AvatarView](?path=/docs/content-avatarview--docs#sentiment-awareness), `AvatarLayout` is sentiment-aware (note: not all features are supported) and will automatically adjust its colours if wrapped inside the
290
186
  * [SentimentSurface](?path=/docs/content-sentimentsurface--docs) component.
@@ -0,0 +1,117 @@
1
+ import { Meta, StoryObj } from '@storybook/react-webpack5';
2
+ import AvatarLayout from '.';
3
+ import { Freeze, Plane } from '@transferwise/icons';
4
+ import { Flag } from '@wise/art';
5
+
6
+ const meta: Meta<typeof AvatarLayout> = {
7
+ component: AvatarLayout,
8
+ tags: ['!autodocs', '!manifest'],
9
+ title: 'Content/AvatarLayout/Tests',
10
+ };
11
+ export default meta;
12
+
13
+ type Story = StoryObj<typeof AvatarLayout>;
14
+
15
+ export const EdgeInstances: Story = {
16
+ render: () => (
17
+ <div
18
+ style={{
19
+ gap: '1em',
20
+ display: 'grid',
21
+ justifyContent: 'space-between',
22
+ gridTemplate: `auto auto / repeat(2, min-content)`,
23
+ }}
24
+ >
25
+ <AvatarLayout orientation="diagonal" avatars={[]} />
26
+
27
+ <AvatarLayout orientation="diagonal" avatars={[{}]} />
28
+
29
+ <AvatarLayout orientation="diagonal" avatars={[{ profileName: 'Jay Jay' }]} />
30
+ <AvatarLayout orientation="diagonal" size={16} avatars={[{ profileName: 'Jay Jay' }]} />
31
+
32
+ <AvatarLayout orientation="diagonal" avatars={[{ asset: <Flag code="gb" /> }]} />
33
+ <AvatarLayout orientation="diagonal" size={24} avatars={[{ asset: <Flag code="gb" /> }]} />
34
+
35
+ <AvatarLayout
36
+ orientation="diagonal"
37
+ avatars={[{ asset: <Flag code="gb" /> }, { asset: <Flag code="jp" /> }]}
38
+ />
39
+
40
+ <AvatarLayout
41
+ orientation="horizontal"
42
+ interactive
43
+ avatars={[
44
+ { imgSrc: '../avatar-squere-dude.webp' },
45
+ { asset: null, style: { border: '1px dashed var(--color-border-neutral)' } },
46
+ ]}
47
+ />
48
+
49
+ <AvatarLayout
50
+ orientation="horizontal"
51
+ interactive
52
+ avatars={[
53
+ { imgSrc: '../avatar-square-dude.webp' },
54
+ {
55
+ asset: <Plane />,
56
+ style: { backgroundColor: 'var(--color-bright-pink)' },
57
+ },
58
+ ]}
59
+ />
60
+
61
+ <AvatarLayout
62
+ orientation="horizontal"
63
+ interactive
64
+ avatars={[
65
+ {
66
+ asset: <Freeze />,
67
+ style: { color: 'rgb(22, 51, 0)', backgroundColor: 'rgb(203, 217, 195)' },
68
+ },
69
+ {
70
+ asset: <Freeze />,
71
+ style: { color: 'rgb(203, 217, 195)', backgroundColor: 'rgb(22, 51, 0)' },
72
+ },
73
+ ]}
74
+ />
75
+
76
+ <AvatarLayout
77
+ orientation="horizontal"
78
+ interactive
79
+ avatars={[
80
+ { asset: <Flag code="gb" /> },
81
+ { asset: '3+', style: { border: '1px dashed var(--color-border-neutral)' } },
82
+ ]}
83
+ />
84
+
85
+ <AvatarLayout
86
+ orientation="horizontal"
87
+ avatars={[{ imgSrc: '../avatar-rectangle-fox.webp' }, { profileName: 'Jay Jay' }]}
88
+ />
89
+
90
+ <AvatarLayout
91
+ interactive
92
+ orientation="horizontal"
93
+ avatars={[
94
+ { imgSrc: '../avatar-rectangle-fox.webp' },
95
+ { imgSrc: '../avatar-square-dude.webp' },
96
+ { asset: '7+' },
97
+ ]}
98
+ />
99
+
100
+ <AvatarLayout
101
+ interactive
102
+ orientation="horizontal"
103
+ avatars={[{ asset: <Flag code="gb" /> }, { asset: <Flag code="br" /> }, { asset: '3+' }]}
104
+ />
105
+
106
+ <AvatarLayout
107
+ orientation="horizontal"
108
+ avatars={[
109
+ { asset: <Flag code="gb" /> },
110
+ { asset: <Flag code="br" /> },
111
+ { asset: <Flag code="jp" /> },
112
+ { asset: '3+' },
113
+ ]}
114
+ />
115
+ </div>
116
+ ),
117
+ };
@@ -5,25 +5,19 @@ import {
5
5
  Convert,
6
6
  FastFlag,
7
7
  Freeze,
8
- Graph,
9
- Money,
10
8
  Leaf,
11
9
  Plane,
12
- PlusCircle,
13
10
  QrCode,
14
- Rewards,
15
11
  Target,
16
12
  Team,
17
13
  Transport,
18
14
  Wallet,
19
15
  Water,
20
16
  Bank,
21
- GiftBox,
22
17
  } from '@transferwise/icons';
23
18
  import AvatarView, { AvatarViewProps } from '.';
24
19
  import { Flag } from '@wise/art';
25
- import { getBrandColorFromSeed, getInitials, ProfileType } from '../common';
26
- import Display from '../display';
20
+ import { ProfileType } from '../common';
27
21
  import Body from '../body';
28
22
  import SentimentSurface from '../sentimentSurface';
29
23
 
@@ -490,100 +484,3 @@ export const SentimentAwareness: Story = {
490
484
  },
491
485
  decorators: [withComponentGrid],
492
486
  };
493
-
494
- export const ProfileBrokenImageFallback: Story = {
495
- parameters: {
496
- chromatic: {
497
- delay: 5000,
498
- },
499
- },
500
- render: () => {
501
- const assetUrl = 'https://test.com/img-wrong-url.test';
502
- return (
503
- <>
504
- <AvatarView />
505
- <AvatarView imgSrc={assetUrl} />
506
- <AvatarView imgSrc={assetUrl} profileType={ProfileType.BUSINESS} />
507
- <AvatarView imgSrc={assetUrl} profileType={ProfileType.BUSINESS} profileName="Test Name" />
508
- </>
509
- );
510
- },
511
- };
512
-
513
- export const EdgeInstaces: Story = {
514
- render: () => {
515
- const css = `.custom-variant {
516
- border: 1px dashed var(--color-border-neutral);
517
- }`;
518
- return (
519
- <div
520
- style={{
521
- gap: '1em',
522
- display: 'grid',
523
- justifyContent: 'space-between',
524
- gridTemplate: 'auto auto / repeat(2, min-content)',
525
- }}
526
- >
527
- <style>{css}</style>
528
- <AvatarView
529
- interactive
530
- badge={{ flagCode: 'EU' }}
531
- style={{ backgroundColor: 'var(--color-bright-orange)' }}
532
- >
533
- <Money />
534
- </AvatarView>
535
- <AvatarView
536
- badge={{ flagCode: 'EU' }}
537
- style={{ backgroundColor: 'var(--color-bright-orange)', border: 'none' }}
538
- >
539
- <Money />
540
- </AvatarView>
541
- <AvatarView interactive className="custom-variant">
542
- <PlusCircle />
543
- </AvatarView>
544
- <AvatarView interactive className="custom-variant">
545
- {null}
546
- </AvatarView>
547
- <AvatarView style={{ color: 'rgb(22, 51, 0)', backgroundColor: 'rgb(203, 217, 195)' }}>
548
- <Graph />
549
- </AvatarView>
550
- <AvatarView
551
- interactive
552
- style={{ color: 'rgb(22, 51, 0)', backgroundColor: 'rgb(203, 217, 195)' }}
553
- >
554
- <Graph />
555
- </AvatarView>
556
- <AvatarView style={{ color: 'rgb(203, 217, 195)', backgroundColor: 'rgb(22, 51, 0)' }}>
557
- <Rewards />
558
- </AvatarView>
559
- <AvatarView
560
- interactive
561
- style={{ color: 'rgb(203, 217, 195)', backgroundColor: 'rgb(22, 51, 0)' }}
562
- >
563
- <Rewards />
564
- </AvatarView>
565
- <AvatarView
566
- badge={{ flagCode: 'EU' }}
567
- style={{ backgroundColor: getBrandColorFromSeed(profileName1) }}
568
- >
569
- <Display>{getInitials(profileName1)}</Display>
570
- </AvatarView>
571
- <AvatarView style={{ backgroundColor: getBrandColorFromSeed(profileName1) }}>
572
- <Display>{getInitials(profileName1)}</Display>
573
- </AvatarView>
574
- <AvatarView interactive style={{ backgroundColor: getBrandColorFromSeed(profileName2) }}>
575
- <Display>{getInitials(profileName1)}</Display>
576
- </AvatarView>
577
- <AvatarView
578
- interactive
579
- badge={{ flagCode: 'EU' }}
580
- style={{ backgroundColor: getBrandColorFromSeed(profileName2) }}
581
- >
582
- <Display>{getInitials(profileName1)}</Display>
583
- </AvatarView>
584
- <AvatarView>9+</AvatarView>
585
- <AvatarView interactive>5+</AvatarView>
586
- </div>
587
- );
588
- },
589
- };
@@ -0,0 +1,114 @@
1
+ import { Meta, StoryObj } from '@storybook/react-webpack5';
2
+ import { Graph, Money, PlusCircle, Rewards } from '@transferwise/icons';
3
+ import AvatarView from '.';
4
+ import { getBrandColorFromSeed, getInitials, ProfileType } from '../common';
5
+ import Display from '../display';
6
+
7
+ const meta: Meta<typeof AvatarView> = {
8
+ component: AvatarView,
9
+ tags: ['!autodocs', '!manifest'],
10
+ title: 'Content/AvatarView/Tests',
11
+ };
12
+ export default meta;
13
+
14
+ type Story = StoryObj<typeof AvatarView>;
15
+
16
+ const profileName1 = 'Wolter White';
17
+ const profileName2 = 'Tyler Durden';
18
+
19
+ export const EdgeInstances: Story = {
20
+ render: () => {
21
+ const css = `.custom-variant {
22
+ border: 1px dashed var(--color-border-neutral);
23
+ }`;
24
+ return (
25
+ <div
26
+ style={{
27
+ gap: '1em',
28
+ display: 'grid',
29
+ justifyContent: 'space-between',
30
+ gridTemplate: 'auto auto / repeat(2, min-content)',
31
+ }}
32
+ >
33
+ <style>{css}</style>
34
+ <AvatarView
35
+ interactive
36
+ badge={{ flagCode: 'EU' }}
37
+ style={{ backgroundColor: 'var(--color-bright-orange)' }}
38
+ >
39
+ <Money />
40
+ </AvatarView>
41
+ <AvatarView
42
+ badge={{ flagCode: 'EU' }}
43
+ style={{ backgroundColor: 'var(--color-bright-orange)', border: 'none' }}
44
+ >
45
+ <Money />
46
+ </AvatarView>
47
+ <AvatarView interactive className="custom-variant">
48
+ <PlusCircle />
49
+ </AvatarView>
50
+ <AvatarView interactive className="custom-variant">
51
+ {null}
52
+ </AvatarView>
53
+ <AvatarView style={{ color: 'rgb(22, 51, 0)', backgroundColor: 'rgb(203, 217, 195)' }}>
54
+ <Graph />
55
+ </AvatarView>
56
+ <AvatarView
57
+ interactive
58
+ style={{ color: 'rgb(22, 51, 0)', backgroundColor: 'rgb(203, 217, 195)' }}
59
+ >
60
+ <Graph />
61
+ </AvatarView>
62
+ <AvatarView style={{ color: 'rgb(203, 217, 195)', backgroundColor: 'rgb(22, 51, 0)' }}>
63
+ <Rewards />
64
+ </AvatarView>
65
+ <AvatarView
66
+ interactive
67
+ style={{ color: 'rgb(203, 217, 195)', backgroundColor: 'rgb(22, 51, 0)' }}
68
+ >
69
+ <Rewards />
70
+ </AvatarView>
71
+ <AvatarView
72
+ badge={{ flagCode: 'EU' }}
73
+ style={{ backgroundColor: getBrandColorFromSeed(profileName1) }}
74
+ >
75
+ <Display>{getInitials(profileName1)}</Display>
76
+ </AvatarView>
77
+ <AvatarView style={{ backgroundColor: getBrandColorFromSeed(profileName1) }}>
78
+ <Display>{getInitials(profileName1)}</Display>
79
+ </AvatarView>
80
+ <AvatarView interactive style={{ backgroundColor: getBrandColorFromSeed(profileName2) }}>
81
+ <Display>{getInitials(profileName1)}</Display>
82
+ </AvatarView>
83
+ <AvatarView
84
+ interactive
85
+ badge={{ flagCode: 'EU' }}
86
+ style={{ backgroundColor: getBrandColorFromSeed(profileName2) }}
87
+ >
88
+ <Display>{getInitials(profileName1)}</Display>
89
+ </AvatarView>
90
+ <AvatarView>9+</AvatarView>
91
+ <AvatarView interactive>5+</AvatarView>
92
+ </div>
93
+ );
94
+ },
95
+ };
96
+
97
+ export const ProfileBrokenImageFallback: Story = {
98
+ parameters: {
99
+ chromatic: {
100
+ delay: 5000,
101
+ },
102
+ },
103
+ render: () => {
104
+ const assetUrl = 'https://test.com/img-wrong-url.test';
105
+ return (
106
+ <>
107
+ <AvatarView />
108
+ <AvatarView imgSrc={assetUrl} />
109
+ <AvatarView imgSrc={assetUrl} profileType={ProfileType.BUSINESS} />
110
+ <AvatarView imgSrc={assetUrl} profileType={ProfileType.BUSINESS} profileName="Test Name" />
111
+ </>
112
+ );
113
+ },
114
+ };
@@ -1,6 +1,5 @@
1
1
  import { Meta, StoryObj } from '@storybook/react-webpack5';
2
- import { userEvent, within, fn, expect } from 'storybook/test';
3
- import { useState } from 'react';
2
+ import { fn } from 'storybook/test';
4
3
 
5
4
  import Button from '.';
6
5
  import LegacyButton from './LegacyButton';
@@ -170,30 +169,6 @@ export const Variants: Story = {
170
169
  },
171
170
  };
172
171
 
173
- const wait = async (duration = 500) =>
174
- new Promise<void>((resolve) => {
175
- setTimeout(resolve, duration);
176
- });
177
-
178
- export const Focused: Story = {
179
- play: async ({ canvasElement }: { canvasElement: HTMLElement }) => {
180
- const canvas = within(canvasElement);
181
- const button = canvas.getByRole('button');
182
- await userEvent.tab();
183
- await expect(button).toHaveFocus();
184
- await expect(button).toHaveTextContent('Focused!');
185
- },
186
- render: function Render(args: React.ComponentProps<typeof Button>) {
187
- const [focused, setFocused] = useState(false);
188
-
189
- return (
190
- <Button {...args} onFocus={() => setFocused(true)}>
191
- {focused ? 'Focused!' : 'Button text'}
192
- </Button>
193
- );
194
- },
195
- };
196
-
197
172
  export const SocialMedia: Story = {
198
173
  render: () => {
199
174
  return (
@@ -0,0 +1,37 @@
1
+ import { Meta, StoryObj } from '@storybook/react-webpack5';
2
+ import { userEvent, within, expect } from 'storybook/test';
3
+ import { useState } from 'react';
4
+
5
+ import Button from '.';
6
+ import LegacyButton from './LegacyButton';
7
+
8
+ LegacyButton.displayName = 'Button';
9
+
10
+ const meta: Meta<typeof LegacyButton> = {
11
+ component: LegacyButton,
12
+ title: 'Actions/Button/Legacy Button/Tests',
13
+ tags: ['!autodocs', '!manifest', 'deprecated'],
14
+ };
15
+
16
+ export default meta;
17
+
18
+ type Story = StoryObj<typeof Button>;
19
+
20
+ export const Focused: Story = {
21
+ play: async ({ canvasElement }: { canvasElement: HTMLElement }) => {
22
+ const canvas = within(canvasElement);
23
+ const button = canvas.getByRole('button');
24
+ await userEvent.tab();
25
+ await expect(button).toHaveFocus();
26
+ await expect(button).toHaveTextContent('Focused!');
27
+ },
28
+ render: function Render(args: React.ComponentProps<typeof Button>) {
29
+ const [focused, setFocused] = useState(false);
30
+
31
+ return (
32
+ <Button {...args} onFocus={() => setFocused(true)}>
33
+ {focused ? 'Focused!' : 'Button text'}
34
+ </Button>
35
+ );
36
+ },
37
+ };
@@ -455,46 +455,36 @@ export const AsAnchor: StoryObj<PreviewStoryArgs> = {
455
455
  },
456
456
  };
457
457
 
458
- export const Disabled: StoryObj<PreviewStoryArgs> = {
459
- render: function Render(args: PreviewStoryArgs) {
460
- const [props, previewProps] = getPropsForPreview(args);
461
-
462
- return (
463
- <Button {...props} {...previewProps}>
464
- Disabled button
465
- </Button>
466
- );
467
- },
468
- argTypes: {
469
- ...hideControls(['block']),
470
- ...previewArgTypes,
471
- },
472
- args: {
473
- disabled: true,
474
- previewAddonStart: false,
475
- previewAddonEnd: false,
476
- },
477
- };
478
-
479
- export const Loading: StoryObj<PreviewStoryArgs> = {
458
+ /**
459
+ * Buttons can be in `disabled` or `loading` states to indicate they're not currently actionable.
460
+ */
461
+ export const States: StoryObj<PreviewStoryArgs> = {
480
462
  render: function Render(args: PreviewStoryArgs) {
481
463
  const [props, previewProps] = getPropsForPreview(args);
482
464
 
483
465
  return (
484
- <Button {...props} {...previewProps}>
485
- Button as anchor
486
- </Button>
466
+ <>
467
+ <Button {...props} {...previewProps} v2>
468
+ Default
469
+ </Button>
470
+ <Button {...props} {...previewProps} v2 disabled>
471
+ Disabled
472
+ </Button>
473
+ <Button {...props} {...previewProps} v2 loading>
474
+ Loading
475
+ </Button>
476
+ </>
487
477
  );
488
478
  },
489
479
  argTypes: {
490
- ...hideControls(['block']),
480
+ ...hideControls(['disabled', 'loading', 'block']),
491
481
  ...previewArgTypes,
492
482
  },
493
483
  args: {
494
- loading: true,
495
484
  previewAddonStart: false,
496
485
  previewAddonEnd: false,
497
486
  },
487
+ decorators: [withComponentGrid()],
498
488
  };
499
489
 
500
490
  /**
@@ -786,20 +776,6 @@ export const DealingWithLongText: StoryObj<PreviewStoryArgs> = {
786
776
  },
787
777
  };
788
778
 
789
- export const AccessibilityAddons: Story = {
790
- args: {
791
- v2: true,
792
- addonStart: {
793
- type: 'avatar',
794
- value: [{ asset: <Flag code="br" /> }, { asset: <Flag code="jp" /> }],
795
- },
796
- 'aria-label': 'Convert Real to Yen',
797
- children: 'Convert',
798
- size: 'md',
799
- },
800
- tags: ['!autodocs', '!dev'],
801
- };
802
-
803
779
  /**
804
780
  * `Button` is sentiment-aware and will automatically adjust its colours if wrapped inside
805
781
  * the [SentimentSurface](?path=/docs/foundations-sentimentsurface--docs) component