@transferwise/components 0.0.0-experimental-76bb7cd → 0.0.0-experimental-9f17c52

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 (96) hide show
  1. package/build/avatar/Avatar.js +3 -0
  2. package/build/avatar/Avatar.js.map +1 -1
  3. package/build/avatar/Avatar.mjs +3 -0
  4. package/build/avatar/Avatar.mjs.map +1 -1
  5. package/build/avatarView/AvatarView.js +175 -0
  6. package/build/avatarView/AvatarView.js.map +1 -0
  7. package/build/avatarView/AvatarView.mjs +173 -0
  8. package/build/avatarView/AvatarView.mjs.map +1 -0
  9. package/build/avatarView/NotificationDot.js +59 -0
  10. package/build/avatarView/NotificationDot.js.map +1 -0
  11. package/build/avatarView/NotificationDot.mjs +57 -0
  12. package/build/avatarView/NotificationDot.mjs.map +1 -0
  13. package/build/avatarWrapper/AvatarWrapper.js +10 -4
  14. package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
  15. package/build/avatarWrapper/AvatarWrapper.mjs +10 -4
  16. package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
  17. package/build/badge/Badge.js +16 -4
  18. package/build/badge/Badge.js.map +1 -1
  19. package/build/badge/Badge.mjs +15 -3
  20. package/build/badge/Badge.mjs.map +1 -1
  21. package/build/badge/BadgeAssets.js +60 -0
  22. package/build/badge/BadgeAssets.js.map +1 -0
  23. package/build/badge/BadgeAssets.mjs +58 -0
  24. package/build/badge/BadgeAssets.mjs.map +1 -0
  25. package/build/common/circle/Circle.js +17 -1
  26. package/build/common/circle/Circle.js.map +1 -1
  27. package/build/common/circle/Circle.mjs +17 -1
  28. package/build/common/circle/Circle.mjs.map +1 -1
  29. package/build/index.js +20 -13
  30. package/build/index.js.map +1 -1
  31. package/build/index.mjs +11 -7
  32. package/build/index.mjs.map +1 -1
  33. package/build/main.css +109 -5
  34. package/build/styles/avatarGroup/AvatarGroup.css +29 -0
  35. package/build/styles/avatarView/AvatarView.css +42 -0
  36. package/build/styles/avatarView/NotificationDot.css +20 -0
  37. package/build/styles/badge/Badge.css +6 -5
  38. package/build/styles/common/circle/Circle.css +32 -0
  39. package/build/styles/main.css +109 -5
  40. package/build/types/avatar/Avatar.d.ts +3 -0
  41. package/build/types/avatar/Avatar.d.ts.map +1 -1
  42. package/build/types/avatarGroup/AvatarGroup.d.ts +18 -0
  43. package/build/types/avatarGroup/AvatarGroup.d.ts.map +1 -0
  44. package/build/types/avatarGroup/index.d.ts +3 -0
  45. package/build/types/avatarGroup/index.d.ts.map +1 -0
  46. package/build/types/avatarView/AvatarView.d.ts +26 -0
  47. package/build/types/avatarView/AvatarView.d.ts.map +1 -0
  48. package/build/types/avatarView/NotificationDot.d.ts +8 -0
  49. package/build/types/avatarView/NotificationDot.d.ts.map +1 -0
  50. package/build/types/avatarView/index.d.ts +3 -0
  51. package/build/types/avatarView/index.d.ts.map +1 -0
  52. package/build/types/avatarWrapper/AvatarWrapper.d.ts +3 -0
  53. package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
  54. package/build/types/badge/Badge.d.ts +9 -4
  55. package/build/types/badge/Badge.d.ts.map +1 -1
  56. package/build/types/badge/BadgeAssets.d.ts +14 -0
  57. package/build/types/badge/BadgeAssets.d.ts.map +1 -0
  58. package/build/types/badge/index.d.ts +2 -0
  59. package/build/types/badge/index.d.ts.map +1 -1
  60. package/build/types/common/circle/Circle.d.ts +2 -0
  61. package/build/types/common/circle/Circle.d.ts.map +1 -1
  62. package/build/types/index.d.ts +3 -1
  63. package/build/types/index.d.ts.map +1 -1
  64. package/package.json +3 -3
  65. package/src/avatar/Avatar.tsx +3 -0
  66. package/src/avatarGroup/AvatarGroup.css +29 -0
  67. package/src/avatarGroup/AvatarGroup.less +42 -0
  68. package/src/avatarGroup/AvatarGroup.story.tsx +284 -0
  69. package/src/avatarGroup/AvatarGroup.tsx +117 -0
  70. package/src/avatarGroup/index.ts +2 -0
  71. package/src/avatarView/AvatarView.css +42 -0
  72. package/src/avatarView/AvatarView.less +33 -0
  73. package/src/avatarView/AvatarView.story.tsx +480 -0
  74. package/src/avatarView/AvatarView.tsx +171 -0
  75. package/src/avatarView/NotificationDot.css +20 -0
  76. package/src/avatarView/NotificationDot.less +24 -0
  77. package/src/avatarView/NotificationDot.tsx +35 -0
  78. package/src/avatarView/index.ts +2 -0
  79. package/src/avatarWrapper/AvatarWrapper.tsx +3 -0
  80. package/src/badge/Badge.css +6 -5
  81. package/src/badge/Badge.less +4 -3
  82. package/src/badge/Badge.tsx +20 -6
  83. package/src/badge/BadgeAssets.tsx +61 -0
  84. package/src/badge/index.ts +3 -0
  85. package/src/common/circle/Circle.css +32 -0
  86. package/src/common/circle/Circle.less +35 -0
  87. package/src/common/circle/Circle.tsx +22 -1
  88. package/src/flowNavigation/FlowNavigation.story.tsx +10 -48
  89. package/src/index.ts +4 -0
  90. package/src/listItem/ListItem.story.tsx +5 -47
  91. package/src/main.css +109 -5
  92. package/src/main.less +2 -0
  93. package/src/overlayHeader/OverlayHeader.story.tsx +5 -10
  94. package/src/radio/Radio.story.tsx +5 -5
  95. package/src/radioGroup/RadioGroup.story.tsx +3 -3
  96. package/src/selectOption/SelectOption.story.tsx +31 -30
@@ -0,0 +1,117 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
2
+ /* eslint-disable react/jsx-key */
3
+ import { clsx } from 'clsx';
4
+ import { CommonProps } from '../common';
5
+ import AvatarView, { AvatarViewProps } from '../avatarView';
6
+
7
+ type AvatarType = { asset?: AvatarViewProps['children'] } & Omit<
8
+ AvatarViewProps,
9
+ 'notification' | 'selected' | 'size' | 'badge' | 'action' | 'children'
10
+ >;
11
+ type AvatarGroupOrientation = 'horizontal' | 'diagonal';
12
+ type AvatarGroupDiagonalSize = 24 | 32 | 40 | 48 | 56 | 72;
13
+ type AvatarGroupSize = 16 | AvatarGroupDiagonalSize;
14
+
15
+ /**
16
+ * Diagonal avatar groups have custom styles for avatars, icons, and fonts
17
+ */
18
+ const MAP_DIAGONAL_AVATAR_STYLE = {
19
+ 16: { avatar: 0, icon: 0, font: 0 },
20
+ 24: { avatar: 15, icon: 11.25, font: 8 },
21
+ 32: { avatar: 20, icon: 15, font: 12 },
22
+ 40: { avatar: 24, icon: 18, font: 12 },
23
+ 48: { avatar: 30, icon: 16.88, font: 14 },
24
+ 56: { avatar: 34, icon: 19.13, font: 14 },
25
+ 72: { avatar: 44, icon: 22, font: 22 },
26
+ };
27
+
28
+ const MAP_DIAGONAL_AVATAR_POSITION = {
29
+ 24: 9,
30
+ 32: 12,
31
+ 40: 16,
32
+ 48: 18,
33
+ 56: 22,
34
+ 72: 28,
35
+ };
36
+
37
+ /**
38
+ * AvatarGroup size: Avatar position (px)
39
+ */
40
+ const MAP_HORIZONTAL_AVATAR_POSITION = {
41
+ 16: 2,
42
+ 24: 2,
43
+ 32: 7,
44
+ 40: 4,
45
+ 48: 4,
46
+ 56: 6,
47
+ 72: 8,
48
+ };
49
+
50
+ export type Props = {
51
+ 'aria-label'?: string;
52
+ avatars: AvatarType[];
53
+ orientation?: AvatarGroupOrientation;
54
+ size?: AvatarGroupSize;
55
+ interactive?: boolean;
56
+ } & CommonProps;
57
+
58
+ export default function AvatarGroup({
59
+ avatars,
60
+ orientation = 'horizontal',
61
+ size: groupSize = 48,
62
+ 'aria-label': ariaLabel,
63
+ className,
64
+ interactive,
65
+ }: Props) {
66
+ const isDiagonal = orientation === 'diagonal';
67
+ const singleAvatarSize = isDiagonal ? MAP_DIAGONAL_AVATAR_STYLE[groupSize]?.avatar : groupSize;
68
+ return (
69
+ <div
70
+ className={clsx('np-avatar-group', `np-avatar-group-${orientation}`, className)}
71
+ style={{
72
+ // @ts-expect-error `--np-avatar-group-size` exsits in styles of AvatarGroup
73
+ '--np-avatar-group-size': `${groupSize}px`,
74
+ '--np-avatar-group-single-size': `${singleAvatarSize}px`,
75
+ }}
76
+ aria-label={ariaLabel}
77
+ >
78
+ {avatars.length < 2 ||
79
+ ((groupSize === 16 || avatars.length > 2) && orientation === 'diagonal')
80
+ ? null
81
+ : avatars.map((avatar, index) => (
82
+ <div
83
+ className={clsx(
84
+ { [`np-avatar-group-${orientation}-child`]: index !== 0 },
85
+ { [`np-avatar-group-${orientation}-mask`]: index !== avatars.length - 1 },
86
+ )}
87
+ style={{
88
+ // @ts-expect-error CSS custom props allowed
89
+ '--np-avatar-group-diagonal-child-position': `${MAP_DIAGONAL_AVATAR_POSITION[groupSize]}px`,
90
+ '--np-avatar-group-horizontal-child-position': `${MAP_HORIZONTAL_AVATAR_POSITION[groupSize]}px`,
91
+ }}
92
+ >
93
+ <AvatarView
94
+ {...avatar}
95
+ // @ts-expect-error AvatarGroup has custom sizes for it's avatars
96
+ size={singleAvatarSize}
97
+ style={{
98
+ ...(interactive && {
99
+ '--circle-border-width': 0,
100
+ backgroundColor: 'var(--color-background-neutral)',
101
+ }),
102
+ // diagonal AvatarGroup variant uses custom sizes for it's avatars, icons, and font
103
+ ...(isDiagonal && {
104
+ '--circle-size': `${singleAvatarSize}px`,
105
+ '--circle-icon-size': `${MAP_DIAGONAL_AVATAR_STYLE[groupSize].icon}px`,
106
+ '--circle-font-size': `${MAP_DIAGONAL_AVATAR_STYLE[groupSize].font}px`,
107
+ }),
108
+ ...avatar.style,
109
+ }}
110
+ >
111
+ {avatar.asset}
112
+ </AvatarView>
113
+ </div>
114
+ ))}
115
+ </div>
116
+ );
117
+ }
@@ -0,0 +1,2 @@
1
+ export type { Props as AvatarGroupProps } from './AvatarGroup';
2
+ export { default } from './AvatarGroup';
@@ -0,0 +1,42 @@
1
+ .np-notification-dot {
2
+ --np-notification-dot-size: 14px;
3
+ position: relative;
4
+ display: inline-block;
5
+ }
6
+ .np-notification-dot-mask {
7
+ -webkit-mask-image: radial-gradient(circle at bottom calc(100% - (var(--np-notification-dot-size) / 2)) left calc(100% - (var(--np-notification-dot-size) / 2)), transparent 0, transparent calc(var(--np-notification-dot-size) / 2 + var(--np-notification-dot-offset)), black 0);
8
+ mask-image: radial-gradient(circle at bottom calc(100% - (var(--np-notification-dot-size) / 2)) left calc(100% - (var(--np-notification-dot-size) / 2)), transparent 0, transparent calc(var(--np-notification-dot-size) / 2 + var(--np-notification-dot-offset)), black 0);
9
+ -webkit-mask-image: radial-gradient(circle at bottom calc(100% - calc(var(--np-notification-dot-size) / 2)) left calc(100% - calc(var(--np-notification-dot-size) / 2)), transparent 0, transparent calc(var(--np-notification-dot-size) / 2 + var(--np-notification-dot-offset)), black 0);
10
+ mask-image: radial-gradient(circle at bottom calc(100% - calc(var(--np-notification-dot-size) / 2)) left calc(100% - calc(var(--np-notification-dot-size) / 2)), transparent 0, transparent calc(var(--np-notification-dot-size) / 2 + var(--np-notification-dot-offset)), black 0);
11
+ }
12
+ .np-notification-dot-badge {
13
+ position: absolute;
14
+ width: var(--np-notification-dot-size);
15
+ height: var(--np-notification-dot-size);
16
+ background-color: var(--color-sentiment-negative);
17
+ border-radius: 9999px;
18
+ border-radius: var(--radius-full);
19
+ right: 0;
20
+ }
21
+ .np-avatar-view .np-avatar-view-content {
22
+ color: var(--color-interactive-primary);
23
+ }
24
+ .np-avatar-view-interactive {
25
+ cursor: pointer;
26
+ }
27
+ .np-avatar-view-interactive .np-circle {
28
+ background-color: rgba(134,167,189,0.10196);
29
+ background-color: var(--color-background-neutral);
30
+ }
31
+ .np-avatar-view-interactive:hover {
32
+ background-color: var(--color-background-neutral-hover);
33
+ }
34
+ .np-avatar-view-interactive:active {
35
+ background-color: var(--color-background-neutral-active);
36
+ }
37
+ .np-avatar-view-non-interactive .np-circle {
38
+ background-color: transparent;
39
+ }
40
+ .np-avatar-view-non-interactive .np-avatar-view-content .wds-flag {
41
+ box-shadow: none;
42
+ }
@@ -0,0 +1,33 @@
1
+ @import './NotificationDot.less';
2
+
3
+ .np-avatar-view {
4
+ .np-avatar-view-content {
5
+ color: var(--color-interactive-primary);
6
+ }
7
+
8
+ &-interactive {
9
+ cursor: pointer;
10
+ .np-circle {
11
+ background-color: var(--color-background-neutral);
12
+ }
13
+ &:hover {
14
+ background-color: var(--color-background-neutral-hover);
15
+ }
16
+ &:active {
17
+ background-color: var(--color-background-neutral-active);
18
+ }
19
+ }
20
+
21
+ &-non-interactive {
22
+ .np-circle {
23
+ background-color: transparent;
24
+ }
25
+ .np-avatar-view-content {
26
+ // dismiss broken shadow on Flag component (DS-6309)
27
+ // https://github.com/transferwise/web-art/blob/main/src/flags/Flag.css#L2
28
+ .wds-flag {
29
+ box-shadow: none;
30
+ }
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,480 @@
1
+ /* eslint-disable react/jsx-key */
2
+ import { Meta, StoryObj } from '@storybook/react';
3
+ import {
4
+ Camera,
5
+ Convert,
6
+ FastFlag,
7
+ Freeze,
8
+ Graph,
9
+ Money,
10
+ Leaf,
11
+ Plane,
12
+ PlusCircle,
13
+ QrCode,
14
+ Rewards,
15
+ Target,
16
+ Team,
17
+ Transport,
18
+ Wallet,
19
+ Water,
20
+ } from '@transferwise/icons';
21
+ import AvatarView, { AvatarViewProps } from '.';
22
+ import { Flag } from '@wise/art';
23
+ import { getBrandColorFromSeed, getInitials } from '../common';
24
+ import Display from '../display';
25
+
26
+ export default {
27
+ title: 'Content/AvatarView',
28
+ } satisfies Meta<typeof AvatarView>;
29
+
30
+ type Story = StoryObj<typeof AvatarView>;
31
+
32
+ const profileName1 = 'Wolter White';
33
+ const profileName2 = 'Tyler Durden';
34
+ const sizes: AvatarViewProps['size'][] = [16, 24, 32, 40, 48, 56, 72];
35
+
36
+ export const Selected: Story = {
37
+ tags: ['autodocs'],
38
+ render: () => {
39
+ return (
40
+ <div
41
+ style={{
42
+ gap: '1em',
43
+ display: 'grid',
44
+ justifyContent: 'space-between',
45
+ gridTemplate: `auto auto / repeat(${sizes.length}, min-content)`,
46
+ }}
47
+ >
48
+ {sizes.map((size) => (
49
+ <AvatarView key={size} size={size} selected interactive>
50
+ <Freeze />
51
+ </AvatarView>
52
+ ))}
53
+ {sizes.map((size) => (
54
+ <AvatarView
55
+ key={size}
56
+ size={size}
57
+ imgSrc="../avatar-square-dude.webp"
58
+ selected
59
+ interactive
60
+ />
61
+ ))}
62
+ </div>
63
+ );
64
+ },
65
+ };
66
+
67
+ export const Notification: Story = {
68
+ tags: ['autodocs'],
69
+ render: () => (
70
+ <div
71
+ style={{
72
+ gap: '1em',
73
+ display: 'grid',
74
+ justifyContent: 'space-between',
75
+ gridTemplate: `auto auto / repeat(${sizes.length}, min-content)`,
76
+ }}
77
+ >
78
+ {sizes.map((size) => (
79
+ <AvatarView key={size} size={size} notification>
80
+ <Freeze />
81
+ </AvatarView>
82
+ ))}
83
+ {sizes.map((size) => (
84
+ <AvatarView key={size} size={size} notification interactive>
85
+ <Freeze />
86
+ </AvatarView>
87
+ ))}
88
+ {sizes.map((size) => (
89
+ <AvatarView
90
+ key={size}
91
+ size={size}
92
+ imgSrc="../avatar-rectangle-fox.webp"
93
+ notification
94
+ interactive
95
+ />
96
+ ))}
97
+ </div>
98
+ ),
99
+ };
100
+
101
+ export const Test: Story = {
102
+ // tags: ['autodocs'],
103
+ render: () => (
104
+ <div>
105
+ <AvatarView
106
+ imgSrc="../avatar-square-dude.webp"
107
+ size={72}
108
+ badge={{
109
+ flagCode: 'EU',
110
+ }}
111
+ />
112
+ <AvatarView
113
+ imgSrc="../avatar-square-dude.webp"
114
+ size={72}
115
+ badge={{
116
+ asset: (
117
+ <div
118
+ className="d-flex align-items-center justify-content-center"
119
+ style={{
120
+ backgroundColor: 'var(--color-bright-pink)',
121
+ color: 'var(--color-interactive-primary)',
122
+ width: '100%',
123
+ height: '100%',
124
+ }}
125
+ >
126
+ <Leaf />
127
+ </div>
128
+ ),
129
+ }}
130
+ />
131
+ </div>
132
+ ),
133
+ };
134
+
135
+ export const Badge: Story = {
136
+ tags: ['autodocs'],
137
+ render: () => {
138
+ const currencies = ['USD', 'EUR', 'GBP', 'AUD', 'CAD', 'JPY', 'CNY'];
139
+ const icons = [
140
+ <Plane />,
141
+ <QrCode />,
142
+ <Target />,
143
+ <Transport />,
144
+ <Wallet />,
145
+ <Water />,
146
+ <Team />,
147
+ ];
148
+ return (
149
+ <div
150
+ style={{
151
+ gap: '1em',
152
+ display: 'grid',
153
+ justifyContent: 'space-between',
154
+ gridTemplate: 'auto auto / repeat(7, min-content)',
155
+ }}
156
+ >
157
+ {sizes.map((size, index) => (
158
+ <AvatarView key={size} size={size} badge={{ flagCode: currencies[index] }}>
159
+ {icons[index]}
160
+ </AvatarView>
161
+ ))}
162
+
163
+ {sizes.map((size, index) => (
164
+ <AvatarView
165
+ key={size}
166
+ size={size}
167
+ imgSrc="../avatar-rectangle-fox.webp"
168
+ badge={{ imgSrc: '../tapestry-01.png' }}
169
+ />
170
+ ))}
171
+
172
+ {sizes.map((size, index) => (
173
+ <AvatarView
174
+ key={size}
175
+ size={size}
176
+ imgSrc="../avatar-square-dude.webp"
177
+ badge={{ imgSrc: '../tapestry-01.png' }}
178
+ />
179
+ ))}
180
+
181
+ {sizes.map((size, index) => (
182
+ <AvatarView key={size} size={size} badge={{ imgSrc: '../tapestry-01.png' }}>
183
+ {icons[index]}
184
+ </AvatarView>
185
+ ))}
186
+
187
+ {sizes.map((size, index) => (
188
+ <AvatarView key={size} size={size} badge={{ status: 'warning' }}>
189
+ {icons[index]}
190
+ </AvatarView>
191
+ ))}
192
+
193
+ {sizes.map((size, index) => (
194
+ <AvatarView key={size} size={size} badge={{ status: 'neutral' }}>
195
+ {icons[index]}
196
+ </AvatarView>
197
+ ))}
198
+
199
+ {sizes.map((size, index) => (
200
+ <AvatarView key={size} size={size} badge={{ status: 'negative' }}>
201
+ {icons[index]}
202
+ </AvatarView>
203
+ ))}
204
+
205
+ {sizes.map((size, index) => (
206
+ <AvatarView key={size} size={size} badge={{ icon: <FastFlag /> }}>
207
+ {icons[index]}
208
+ </AvatarView>
209
+ ))}
210
+
211
+ {sizes.map((size, index) => (
212
+ <AvatarView key={size} size={size} badge={{ type: 'reference' }}>
213
+ {icons[index]}
214
+ </AvatarView>
215
+ ))}
216
+
217
+ {sizes.map((size, index) => (
218
+ <AvatarView key={size} size={size} badge={{ type: 'action' }}>
219
+ {icons[index]}
220
+ </AvatarView>
221
+ ))}
222
+
223
+ {sizes.map((size) => (
224
+ <AvatarView
225
+ key={size}
226
+ size={size}
227
+ imgSrc="../avatar-square-dude.webp"
228
+ badge={{ type: 'action', icon: <Camera /> }}
229
+ />
230
+ ))}
231
+
232
+ {sizes.map((size) => (
233
+ <AvatarView
234
+ key={size}
235
+ size={size}
236
+ imgSrc="../avatar-square-dude.webp"
237
+ badge={{ type: 'reference', icon: <Convert /> }}
238
+ />
239
+ ))}
240
+
241
+ {sizes.map((size) => (
242
+ <AvatarView
243
+ key={size}
244
+ size={size}
245
+ imgSrc="../avatar-square-dude.webp"
246
+ badge={{ icon: <Convert /> }}
247
+ />
248
+ ))}
249
+ {sizes.map((size) => (
250
+ <AvatarView
251
+ key={size}
252
+ size={size}
253
+ imgSrc="../avatar-square-dude.webp"
254
+ badge={{
255
+ asset: (
256
+ <div
257
+ className="d-flex align-items-center justify-content-center"
258
+ style={{
259
+ backgroundColor: 'var(--color-bright-pink)',
260
+ color: 'var(--color-interactive-primary)',
261
+ width: '100%',
262
+ height: '100%',
263
+ }}
264
+ >
265
+ <Leaf />
266
+ </div>
267
+ ),
268
+ }}
269
+ />
270
+ ))}
271
+ </div>
272
+ );
273
+ },
274
+ };
275
+
276
+ export const Images: Story = {
277
+ tags: ['autodocs'],
278
+ render: () => {
279
+ return (
280
+ <div
281
+ style={{
282
+ gap: '1em',
283
+ display: 'grid',
284
+ justifyContent: 'space-between',
285
+ gridTemplate: 'auto auto / repeat(7, min-content)',
286
+ }}
287
+ >
288
+ {sizes.map((size) => (
289
+ <AvatarView
290
+ key={size}
291
+ size={size}
292
+ interactive
293
+ imgSrc="../avatar-square-dude.webp"
294
+ profileName="Test Name"
295
+ profileType="business"
296
+ />
297
+ ))}
298
+ {sizes.map((size) => (
299
+ <AvatarView
300
+ key={size}
301
+ size={size}
302
+ imgSrc="../avatar-square-dude.webp"
303
+ profileName="Test Name"
304
+ profileType="business"
305
+ />
306
+ ))}
307
+ {sizes.map((size) => (
308
+ <AvatarView key={size} size={size} interactive>
309
+ <Flag code="JPY" intrinsicSize={size} />
310
+ </AvatarView>
311
+ ))}
312
+ {sizes.map((size) => (
313
+ <AvatarView key={size} size={size}>
314
+ <Flag code="JPY" intrinsicSize={size} />
315
+ </AvatarView>
316
+ ))}
317
+ {sizes.map((size) => (
318
+ <AvatarView key={size} interactive imgSrc="../avatar-rectangle-fox.webp" size={size} />
319
+ ))}
320
+ {sizes.map((size) => (
321
+ <AvatarView key={size} size={size} imgSrc="../avatar-rectangle-fox.webp" />
322
+ ))}
323
+ </div>
324
+ );
325
+ },
326
+ };
327
+
328
+ export const Profiles: Story = {
329
+ tags: ['autodocs'],
330
+ render: () => {
331
+ return (
332
+ <div
333
+ style={{
334
+ gap: '1em',
335
+ display: 'grid',
336
+ justifyContent: 'space-between',
337
+ gridTemplate: 'auto auto / repeat(7, min-content)',
338
+ }}
339
+ >
340
+ {sizes.map((size) => (
341
+ <AvatarView
342
+ key={size}
343
+ size={size}
344
+ imgSrc="../avatar-square-dude.webp"
345
+ profileName="Test Name"
346
+ profileType="business"
347
+ />
348
+ ))}
349
+
350
+ {sizes.map((size) => (
351
+ <AvatarView
352
+ key={size}
353
+ size={size}
354
+ interactive
355
+ imgSrc="../avatar-square-dude.webp"
356
+ profileName="Test Name"
357
+ profileType="business"
358
+ />
359
+ ))}
360
+
361
+ {sizes.map((size) => (
362
+ <AvatarView key={size} size={size} profileName="Test Name" />
363
+ ))}
364
+
365
+ {sizes.map((size) => (
366
+ <AvatarView key={size} size={size} interactive profileName="Test Name" />
367
+ ))}
368
+
369
+ {sizes.map((size) => (
370
+ <AvatarView key={size} size={size} profileType="business" />
371
+ ))}
372
+
373
+ {sizes.map((size) => (
374
+ <AvatarView key={size} size={size} interactive profileType="business" />
375
+ ))}
376
+
377
+ {sizes.map((size) => (
378
+ <AvatarView key={size} size={size} />
379
+ ))}
380
+
381
+ {sizes.map((size) => (
382
+ <AvatarView key={size} size={size} interactive />
383
+ ))}
384
+ </div>
385
+ );
386
+ },
387
+ };
388
+
389
+ export const ProfileBrokenImageFallback: Story = {
390
+ render: () => (
391
+ <>
392
+ <AvatarView imgSrc="../img-wrong-url.lol" />
393
+ <AvatarView imgSrc="../img-wrong-url.lol" profileType="business" />
394
+ <AvatarView imgSrc="../img-wrong-url.lol" profileType="business" profileName="D D" />
395
+ </>
396
+ ),
397
+ };
398
+
399
+ export const EdgeInstaces: Story = {
400
+ tags: ['autodocs'],
401
+ render: () => {
402
+ const css = `.custom-variant {
403
+ border: 1px dashed var(--color-border-neutral);
404
+ }`;
405
+ return (
406
+ <div
407
+ style={{
408
+ gap: '1em',
409
+ display: 'grid',
410
+ justifyContent: 'space-between',
411
+ gridTemplate: 'auto auto / repeat(2, min-content)',
412
+ }}
413
+ >
414
+ <style>{css}</style>
415
+ {/* <Body>- Custom colors</Body> */}
416
+ <AvatarView
417
+ interactive
418
+ badge={{ flagCode: 'EU' }}
419
+ style={{ backgroundColor: 'var(--color-bright-orange)' }}
420
+ >
421
+ <Money />
422
+ </AvatarView>
423
+ <AvatarView
424
+ badge={{ flagCode: 'EU' }}
425
+ style={{ backgroundColor: 'var(--color-bright-orange)', border: 'none' }}
426
+ >
427
+ <Money />
428
+ </AvatarView>
429
+ {/* <Body>- Add example with dashed avatar as in shared balances</Body> */}
430
+ <AvatarView interactive className="custom-variant">
431
+ <PlusCircle />
432
+ </AvatarView>
433
+ <AvatarView interactive className="custom-variant">
434
+ {null}
435
+ </AvatarView>
436
+ {/* <Body> - Add example custom backgrounds as in account summary (https://wise.com/account-summary)</Body> */}
437
+ <AvatarView style={{ color: 'rgb(22, 51, 0)', backgroundColor: 'rgb(203, 217, 195)' }}>
438
+ <Graph />
439
+ </AvatarView>
440
+ <AvatarView
441
+ interactive
442
+ style={{ color: 'rgb(22, 51, 0)', backgroundColor: 'rgb(203, 217, 195)' }}
443
+ >
444
+ <Graph />
445
+ </AvatarView>
446
+ <AvatarView style={{ color: 'rgb(203, 217, 195)', backgroundColor: 'rgb(22, 51, 0)' }}>
447
+ <Rewards />
448
+ </AvatarView>
449
+ <AvatarView
450
+ interactive
451
+ style={{ color: 'rgb(203, 217, 195)', backgroundColor: 'rgb(22, 51, 0)' }}
452
+ >
453
+ <Rewards />
454
+ </AvatarView>
455
+ {/* <Body>- Add example Wise Sand + custom background from hash</Body> */}
456
+ <AvatarView
457
+ badge={{ flagCode: 'EU' }}
458
+ style={{ backgroundColor: getBrandColorFromSeed(profileName1) }}
459
+ >
460
+ <Display>{getInitials(profileName1)}</Display>
461
+ </AvatarView>
462
+ <AvatarView style={{ backgroundColor: getBrandColorFromSeed(profileName1) }}>
463
+ <Display>{getInitials(profileName1)}</Display>
464
+ </AvatarView>
465
+ <AvatarView interactive style={{ backgroundColor: getBrandColorFromSeed(profileName2) }}>
466
+ <Display>{getInitials(profileName1)}</Display>
467
+ </AvatarView>
468
+ <AvatarView
469
+ interactive
470
+ badge={{ flagCode: 'EU' }}
471
+ style={{ backgroundColor: getBrandColorFromSeed(profileName2) }}
472
+ >
473
+ <Display>{getInitials(profileName1)}</Display>
474
+ </AvatarView>
475
+ <AvatarView>9+</AvatarView>
476
+ <AvatarView interactive>5+</AvatarView>
477
+ </div>
478
+ );
479
+ },
480
+ };