@transferwise/components 0.0.0-experimental-8d0974a → 0.0.0-experimental-53b8447

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 (207) 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 +187 -0
  6. package/build/avatarView/AvatarView.js.map +1 -0
  7. package/build/avatarView/AvatarView.mjs +185 -0
  8. package/build/avatarView/AvatarView.mjs.map +1 -0
  9. package/build/avatarView/NotificationDot.js +56 -0
  10. package/build/avatarView/NotificationDot.js.map +1 -0
  11. package/build/avatarView/NotificationDot.mjs +54 -0
  12. package/build/avatarView/NotificationDot.mjs.map +1 -0
  13. package/build/avatarWrapper/AvatarWrapper.js +6 -1
  14. package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
  15. package/build/avatarWrapper/AvatarWrapper.mjs +6 -1
  16. package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
  17. package/build/badge/Badge.js +8 -1
  18. package/build/badge/Badge.js.map +1 -1
  19. package/build/badge/Badge.mjs +8 -1
  20. package/build/badge/Badge.mjs.map +1 -1
  21. package/build/badge/BadgeAssets.js +63 -0
  22. package/build/badge/BadgeAssets.js.map +1 -0
  23. package/build/badge/BadgeAssets.mjs +61 -0
  24. package/build/badge/BadgeAssets.mjs.map +1 -0
  25. package/build/common/circle/Circle.js +29 -3
  26. package/build/common/circle/Circle.js.map +1 -1
  27. package/build/common/circle/Circle.mjs +29 -3
  28. package/build/common/circle/Circle.mjs.map +1 -1
  29. package/build/dateLookup/DateLookup.js +6 -6
  30. package/build/dateLookup/DateLookup.js.map +1 -1
  31. package/build/dateLookup/DateLookup.mjs +6 -6
  32. package/build/dateLookup/DateLookup.mjs.map +1 -1
  33. package/build/dateLookup/dayCalendar/table/DayCalendarTable.js +1 -4
  34. package/build/dateLookup/dayCalendar/table/DayCalendarTable.js.map +1 -1
  35. package/build/dateLookup/dayCalendar/table/DayCalendarTable.mjs +1 -4
  36. package/build/dateLookup/dayCalendar/table/DayCalendarTable.mjs.map +1 -1
  37. package/build/i18n/de.json +5 -0
  38. package/build/i18n/de.json.js +5 -0
  39. package/build/i18n/de.json.js.map +1 -1
  40. package/build/i18n/de.json.mjs +5 -0
  41. package/build/i18n/de.json.mjs.map +1 -1
  42. package/build/i18n/es.json +5 -0
  43. package/build/i18n/es.json.js +5 -0
  44. package/build/i18n/es.json.js.map +1 -1
  45. package/build/i18n/es.json.mjs +5 -0
  46. package/build/i18n/es.json.mjs.map +1 -1
  47. package/build/i18n/fr.json +5 -0
  48. package/build/i18n/fr.json.js +5 -0
  49. package/build/i18n/fr.json.js.map +1 -1
  50. package/build/i18n/fr.json.mjs +5 -0
  51. package/build/i18n/fr.json.mjs.map +1 -1
  52. package/build/i18n/hu.json +5 -0
  53. package/build/i18n/hu.json.js +5 -0
  54. package/build/i18n/hu.json.js.map +1 -1
  55. package/build/i18n/hu.json.mjs +5 -0
  56. package/build/i18n/hu.json.mjs.map +1 -1
  57. package/build/i18n/id.json +5 -0
  58. package/build/i18n/id.json.js +5 -0
  59. package/build/i18n/id.json.js.map +1 -1
  60. package/build/i18n/id.json.mjs +5 -0
  61. package/build/i18n/id.json.mjs.map +1 -1
  62. package/build/i18n/it.json +5 -0
  63. package/build/i18n/it.json.js +5 -0
  64. package/build/i18n/it.json.js.map +1 -1
  65. package/build/i18n/it.json.mjs +5 -0
  66. package/build/i18n/it.json.mjs.map +1 -1
  67. package/build/i18n/ja.json +5 -0
  68. package/build/i18n/ja.json.js +5 -0
  69. package/build/i18n/ja.json.js.map +1 -1
  70. package/build/i18n/ja.json.mjs +5 -0
  71. package/build/i18n/ja.json.mjs.map +1 -1
  72. package/build/i18n/pl.json +5 -0
  73. package/build/i18n/pl.json.js +5 -0
  74. package/build/i18n/pl.json.js.map +1 -1
  75. package/build/i18n/pl.json.mjs +5 -0
  76. package/build/i18n/pl.json.mjs.map +1 -1
  77. package/build/i18n/pt.json +5 -0
  78. package/build/i18n/pt.json.js +5 -0
  79. package/build/i18n/pt.json.js.map +1 -1
  80. package/build/i18n/pt.json.mjs +5 -0
  81. package/build/i18n/pt.json.mjs.map +1 -1
  82. package/build/i18n/ro.json +5 -0
  83. package/build/i18n/ro.json.js +5 -0
  84. package/build/i18n/ro.json.js.map +1 -1
  85. package/build/i18n/ro.json.mjs +5 -0
  86. package/build/i18n/ro.json.mjs.map +1 -1
  87. package/build/i18n/ru.json +5 -0
  88. package/build/i18n/ru.json.js +5 -0
  89. package/build/i18n/ru.json.js.map +1 -1
  90. package/build/i18n/ru.json.mjs +5 -0
  91. package/build/i18n/ru.json.mjs.map +1 -1
  92. package/build/i18n/tr.json +5 -0
  93. package/build/i18n/tr.json.js +5 -0
  94. package/build/i18n/tr.json.js.map +1 -1
  95. package/build/i18n/tr.json.mjs +5 -0
  96. package/build/i18n/tr.json.mjs.map +1 -1
  97. package/build/index.js +15 -4
  98. package/build/index.js.map +1 -1
  99. package/build/index.mjs +10 -2
  100. package/build/index.mjs.map +1 -1
  101. package/build/main.css +98 -25
  102. package/build/statusIcon/StatusIcon.js +2 -2
  103. package/build/statusIcon/StatusIcon.js.map +1 -1
  104. package/build/statusIcon/StatusIcon.mjs +2 -2
  105. package/build/statusIcon/StatusIcon.mjs.map +1 -1
  106. package/build/styles/avatarGroup/AvatarGroup.css +28 -0
  107. package/build/styles/avatarView/AvatarView.css +28 -0
  108. package/build/styles/avatarView/NotificationDot.css +20 -0
  109. package/build/styles/badge/Badge.css +6 -5
  110. package/build/styles/common/circle/Circle.css +36 -0
  111. package/build/styles/main.css +98 -25
  112. package/build/styles/statusIcon/StatusIcon.css +0 -20
  113. package/build/types/avatar/Avatar.d.ts +3 -0
  114. package/build/types/avatar/Avatar.d.ts.map +1 -1
  115. package/build/types/avatarGroup/AvatarGroup.d.ts +18 -0
  116. package/build/types/avatarGroup/AvatarGroup.d.ts.map +1 -0
  117. package/build/types/avatarGroup/index.d.ts +3 -0
  118. package/build/types/avatarGroup/index.d.ts.map +1 -0
  119. package/build/types/avatarView/AvatarView.d.ts +25 -0
  120. package/build/types/avatarView/AvatarView.d.ts.map +1 -0
  121. package/build/types/avatarView/NotificationDot.d.ts +8 -0
  122. package/build/types/avatarView/NotificationDot.d.ts.map +1 -0
  123. package/build/types/avatarView/index.d.ts +3 -0
  124. package/build/types/avatarView/index.d.ts.map +1 -0
  125. package/build/types/avatarWrapper/AvatarWrapper.d.ts +3 -0
  126. package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
  127. package/build/types/badge/Badge.d.ts +5 -1
  128. package/build/types/badge/Badge.d.ts.map +1 -1
  129. package/build/types/badge/BadgeAssets.d.ts +15 -0
  130. package/build/types/badge/BadgeAssets.d.ts.map +1 -0
  131. package/build/types/badge/index.d.ts +2 -0
  132. package/build/types/badge/index.d.ts.map +1 -1
  133. package/build/types/common/circle/Circle.d.ts +3 -1
  134. package/build/types/common/circle/Circle.d.ts.map +1 -1
  135. package/build/types/common/dateUtils/index.d.ts +0 -1
  136. package/build/types/common/dateUtils/index.d.ts.map +1 -1
  137. package/build/types/dateLookup/DateLookup.d.ts +1 -1
  138. package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
  139. package/build/types/dateLookup/dayCalendar/table/DayCalendarTable.d.ts +1 -1
  140. package/build/types/dateLookup/dayCalendar/table/DayCalendarTable.d.ts.map +1 -1
  141. package/build/types/index.d.ts +3 -1
  142. package/build/types/index.d.ts.map +1 -1
  143. package/build/types/statusIcon/StatusIcon.d.ts +6 -2
  144. package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
  145. package/package.json +3 -3
  146. package/src/avatar/Avatar.tsx +3 -0
  147. package/src/avatarGroup/AvatarGroup.css +28 -0
  148. package/src/avatarGroup/AvatarGroup.less +32 -0
  149. package/src/avatarGroup/AvatarGroup.story.tsx +195 -0
  150. package/src/avatarGroup/AvatarGroup.tsx +80 -0
  151. package/src/avatarGroup/index.ts +2 -0
  152. package/src/avatarView/AvatarView.css +28 -0
  153. package/src/avatarView/AvatarView.less +16 -0
  154. package/src/avatarView/AvatarView.story.tsx +573 -0
  155. package/src/avatarView/AvatarView.tsx +184 -0
  156. package/src/avatarView/NotificationDot.css +20 -0
  157. package/src/avatarView/NotificationDot.less +24 -0
  158. package/src/avatarView/NotificationDot.tsx +32 -0
  159. package/src/avatarView/index.ts +2 -0
  160. package/src/avatarWrapper/AvatarWrapper.story.tsx +6 -0
  161. package/src/avatarWrapper/AvatarWrapper.tsx +3 -0
  162. package/src/badge/Badge.css +6 -5
  163. package/src/badge/Badge.less +4 -3
  164. package/src/badge/Badge.tsx +8 -1
  165. package/src/badge/BadgeAssets.tsx +65 -0
  166. package/src/badge/index.ts +3 -0
  167. package/src/common/circle/Circle.css +36 -0
  168. package/src/common/circle/Circle.less +42 -1
  169. package/src/common/circle/Circle.tsx +41 -3
  170. package/src/common/dateUtils/index.ts +0 -1
  171. package/src/dateLookup/DateLookup.tests.story.tsx +5 -40
  172. package/src/dateLookup/DateLookup.tsx +11 -9
  173. package/src/dateLookup/dayCalendar/table/DayCalendarTable.tsx +2 -5
  174. package/src/decision/Decision.story.tsx +10 -46
  175. package/src/flowNavigation/FlowNavigation.story.js +10 -39
  176. package/src/i18n/de.json +5 -0
  177. package/src/i18n/es.json +5 -0
  178. package/src/i18n/fr.json +5 -0
  179. package/src/i18n/hu.json +5 -0
  180. package/src/i18n/id.json +5 -0
  181. package/src/i18n/it.json +5 -0
  182. package/src/i18n/ja.json +5 -0
  183. package/src/i18n/pl.json +5 -0
  184. package/src/i18n/pt.json +5 -0
  185. package/src/i18n/ro.json +5 -0
  186. package/src/i18n/ru.json +5 -0
  187. package/src/i18n/tr.json +5 -0
  188. package/src/index.ts +4 -0
  189. package/src/listItem/ListItem.story.tsx +6 -43
  190. package/src/main.css +98 -25
  191. package/src/main.less +2 -0
  192. package/src/navigationOption/NavigationOption.story.js +14 -65
  193. package/src/overlayHeader/OverlayHeader.story.tsx +5 -10
  194. package/src/radio/Radio.story.tsx +5 -5
  195. package/src/radioGroup/RadioGroup.story.tsx +3 -3
  196. package/src/selectOption/SelectOption.story.tsx +31 -30
  197. package/src/statusIcon/StatusIcon.css +0 -20
  198. package/src/statusIcon/StatusIcon.less +0 -17
  199. package/src/statusIcon/StatusIcon.tsx +14 -4
  200. package/src/tile/Tile.story.tsx +2 -6
  201. package/build/common/dateUtils/getDateView/getDateView.js +0 -10
  202. package/build/common/dateUtils/getDateView/getDateView.js.map +0 -1
  203. package/build/common/dateUtils/getDateView/getDateView.mjs +0 -8
  204. package/build/common/dateUtils/getDateView/getDateView.mjs.map +0 -1
  205. package/build/types/common/dateUtils/getDateView/getDateView.d.ts +0 -2
  206. package/build/types/common/dateUtils/getDateView/getDateView.d.ts.map +0 -1
  207. package/src/common/dateUtils/getDateView/getDateView.ts +0 -5
@@ -0,0 +1,80 @@
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 orientation sets custom sizes for avatars
17
+ */
18
+ const avatarGroupDiagonalSizeMap: Record<AvatarGroupDiagonalSize, number> = {
19
+ 24: 15,
20
+ 32: 20,
21
+ 40: 24,
22
+ 48: 30,
23
+ 56: 34,
24
+ 72: 44,
25
+ };
26
+
27
+ export type Props = {
28
+ 'aria-label'?: string;
29
+ avatars: AvatarType[];
30
+ orientation?: AvatarGroupOrientation;
31
+ size?: AvatarGroupSize;
32
+ interactive?: boolean;
33
+ } & CommonProps;
34
+
35
+ export default function AvatarGroup({
36
+ avatars,
37
+ orientation: orientationProp = 'horizontal',
38
+ size = 48,
39
+ 'aria-label': ariaLabel,
40
+ className,
41
+ interactive,
42
+ }: Props) {
43
+ const orientation =
44
+ orientationProp === 'diagonal' && size === 16 ? 'horizontal' : orientationProp;
45
+ const avatarSize = orientation === 'diagonal' ? avatarGroupDiagonalSizeMap[size] : size;
46
+ return (
47
+ <div
48
+ className={clsx('np-avatar-group', `np-avatar-group-${orientation}`, className)}
49
+ // @ts-expect-error `--np-avatar-group-size` exsits in styles of AvatarGroup
50
+ style={{ '--np-avatar-group-size': `${size}px`, '--np-avatar-size': `${avatarSize}px` }}
51
+ aria-label={ariaLabel}
52
+ >
53
+ {avatars.length < 2 || (size === 16 && orientationProp === 'diagonal')
54
+ ? null
55
+ : avatars.map((avatar, index) => (
56
+ <div
57
+ className={clsx(
58
+ { [`np-avatar-group-${orientation}-child`]: index !== 0 },
59
+ { [`np-avatar-group-${orientation}-mask`]: index !== avatars.length - 1 },
60
+ )}
61
+ style={{
62
+ // @ts-expect-error CSS custom props allowed
63
+ '--np-avatar-group-index': index,
64
+ }}
65
+ >
66
+ <AvatarView
67
+ key={index}
68
+ {...avatar}
69
+ size={avatarSize}
70
+ // @ts-expect-error CSS custom props allowed
71
+ style={{ '--circle-size': `${avatarSize}px`, ...avatar.style }}
72
+ interactive={interactive}
73
+ >
74
+ {avatar.asset}
75
+ </AvatarView>
76
+ </div>
77
+ ))}
78
+ </div>
79
+ );
80
+ }
@@ -0,0 +1,2 @@
1
+ export type { Props as AvatarGroupProps } from './AvatarGroup';
2
+ export { default } from './AvatarGroup';
@@ -0,0 +1,28 @@
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 {
22
+ border-radius: 9999px;
23
+ border-radius: var(--radius-full);
24
+ color: var(--color-interactive-primary);
25
+ }
26
+ .np-avatar-view-non-interactive .np-avatar-view-content .wds-flag {
27
+ box-shadow: none;
28
+ }
@@ -0,0 +1,16 @@
1
+ @import './NotificationDot.less';
2
+
3
+ .np-avatar-view {
4
+ border-radius: var(--radius-full);
5
+ color: var(--color-interactive-primary);
6
+
7
+ &-non-interactive {
8
+ .np-avatar-view-content {
9
+ // dismiss broken shadow (DS-6309) on Flag component
10
+ // https://github.com/transferwise/web-art/blob/main/src/flags/Flag.css#L2
11
+ .wds-flag {
12
+ box-shadow: none;
13
+ }
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,573 @@
1
+ /* eslint-disable react/jsx-key */
2
+ import { Meta, StoryObj } from '@storybook/react';
3
+ import { storyConfig } from '../test-utils';
4
+ import {
5
+ Camera,
6
+ Convert,
7
+ FastFlag,
8
+ Freeze,
9
+ Graph,
10
+ Leaf,
11
+ MassPayout,
12
+ Money,
13
+ Plane,
14
+ PlusCircle,
15
+ QrCode,
16
+ Rewards,
17
+ Target,
18
+ Team,
19
+ Transport,
20
+ Wallet,
21
+ Water,
22
+ } from '@transferwise/icons';
23
+ import { action } from '@storybook/addon-actions';
24
+ import { useState } from 'react';
25
+ import AvatarView, { AvatarViewProps } from '.';
26
+ import { Flag } from '@wise/art';
27
+ import Body from '../body';
28
+ import { getBrandColorFromSeed, getInitials } from '../common';
29
+ import Display from '../display';
30
+ import Image from '../image';
31
+
32
+ export default {
33
+ title: 'Content/AvatarView',
34
+ } satisfies Meta<typeof AvatarView>;
35
+
36
+ type Story = StoryObj<typeof AvatarView>;
37
+
38
+ const profileName1 = 'Wolter White';
39
+ const profileName2 = 'Tyler Durden';
40
+ const sizes: AvatarViewProps['size'][] = [16, 24, 32, 40, 48, 56, 72];
41
+
42
+ export const Selected: Story = storyConfig(
43
+ {
44
+ render: () => {
45
+ // eslint-disable-next-line react-hooks/rules-of-hooks
46
+ const [selected, setSelected] = useState(true);
47
+ return (
48
+ <div
49
+ style={{
50
+ gap: '1em',
51
+ display: 'grid',
52
+ justifyContent: 'space-between',
53
+ gridTemplate: `auto auto / repeat(${sizes.length}, min-content)`,
54
+ }}
55
+ >
56
+ {sizes.map((size) => (
57
+ <AvatarView key={size} size={size} selected={selected}>
58
+ <Freeze />
59
+ </AvatarView>
60
+ ))}
61
+ {sizes.map((size) => (
62
+ <AvatarView
63
+ key={size}
64
+ size={size}
65
+ selected={selected}
66
+ action={{
67
+ onClick: () => {
68
+ action('interactive avatar');
69
+ setSelected(!selected);
70
+ },
71
+ }}
72
+ >
73
+ <Freeze />
74
+ </AvatarView>
75
+ ))}
76
+
77
+ {sizes.map((size) => (
78
+ <AvatarView key={size} size={size} selected={selected}>
79
+ <Image src="../avatar-square-dude.webp" alt="avatar" />
80
+ </AvatarView>
81
+ ))}
82
+ {sizes.map((size) => (
83
+ <AvatarView
84
+ key={size}
85
+ size={size}
86
+ imgSrc="../avatar-square-dude.webp"
87
+ selected={selected}
88
+ action={{
89
+ onClick: () => {
90
+ action('interactive avatar');
91
+ setSelected(!selected);
92
+ },
93
+ }}
94
+ />
95
+ ))}
96
+ </div>
97
+ );
98
+ },
99
+ },
100
+ { variants: ['light', 'dark'] },
101
+ );
102
+
103
+ export const Notification: Story = storyConfig(
104
+ {
105
+ render: () => (
106
+ <div
107
+ style={{
108
+ gap: '1em',
109
+ display: 'grid',
110
+ justifyContent: 'space-between',
111
+ gridTemplate: `auto auto / repeat(${sizes.length}, min-content)`,
112
+ }}
113
+ >
114
+ {sizes.map((size) => (
115
+ <AvatarView key={size} size={size} notification>
116
+ <Freeze />
117
+ </AvatarView>
118
+ ))}
119
+ {sizes.map((size) => (
120
+ <AvatarView
121
+ key={size}
122
+ size={size}
123
+ notification
124
+ action={{
125
+ onClick: () => action('interactive avatar'),
126
+ }}
127
+ >
128
+ <Freeze />
129
+ </AvatarView>
130
+ ))}
131
+
132
+ {sizes.map((size) => (
133
+ <AvatarView key={size} size={size} notification action={{ href: '#' }}>
134
+ <Freeze />
135
+ </AvatarView>
136
+ ))}
137
+ </div>
138
+ ),
139
+ },
140
+ { variants: ['light', 'dark'] },
141
+ );
142
+
143
+ export const Badge: Story = storyConfig(
144
+ {
145
+ render: () => {
146
+ const currencies = ['USD', 'EUR', 'GBP', 'AUD', 'CAD', 'JPY', 'CNY'];
147
+ const icons = [
148
+ <Plane />,
149
+ <QrCode />,
150
+ <Target />,
151
+ <Transport />,
152
+ <Wallet />,
153
+ <Water />,
154
+ <Team />,
155
+ ];
156
+ return (
157
+ <div
158
+ style={{
159
+ gap: '1em',
160
+ display: 'grid',
161
+ justifyContent: 'space-between',
162
+ gridTemplate: 'auto auto / repeat(7, min-content)',
163
+ }}
164
+ >
165
+ {sizes.map((size, index) => (
166
+ <AvatarView key={size} size={size} badge={{ flagCode: currencies[index] }}>
167
+ {icons[index]}
168
+ </AvatarView>
169
+ ))}
170
+
171
+ {sizes.map((size, index) => (
172
+ <AvatarView
173
+ key={size}
174
+ size={size}
175
+ imgSrc="../avatar-rectangle-fox.webp"
176
+ badge={{ imgSrc: '../tapestry-01.png' }}
177
+ />
178
+ ))}
179
+
180
+ {sizes.map((size, index) => (
181
+ <AvatarView
182
+ key={size}
183
+ size={size}
184
+ imgSrc="../avatar-square-dude.webp"
185
+ badge={{ imgSrc: '../tapestry-01.png' }}
186
+ />
187
+ ))}
188
+
189
+ {sizes.map((size, index) => (
190
+ <AvatarView key={size} size={size} badge={{ imgSrc: '../tapestry-01.png' }}>
191
+ {icons[index]}
192
+ </AvatarView>
193
+ ))}
194
+
195
+ {sizes.map((size, index) => (
196
+ <AvatarView key={size} size={size} badge={{ status: 'warning' }}>
197
+ {icons[index]}
198
+ </AvatarView>
199
+ ))}
200
+
201
+ {sizes.map((size, index) => (
202
+ <AvatarView key={size} size={size} badge={{ status: 'neutral' }}>
203
+ {icons[index]}
204
+ </AvatarView>
205
+ ))}
206
+
207
+ {sizes.map((size, index) => (
208
+ <AvatarView key={size} size={size} badge={{ status: 'negative' }}>
209
+ {icons[index]}
210
+ </AvatarView>
211
+ ))}
212
+
213
+ {sizes.map((size, index) => (
214
+ <AvatarView key={size} size={size} badge={{ icon: <FastFlag /> }}>
215
+ {icons[index]}
216
+ </AvatarView>
217
+ ))}
218
+
219
+ {sizes.map((size, index) => (
220
+ <AvatarView key={size} size={size} badge={{ type: 'reference' }}>
221
+ {icons[index]}
222
+ </AvatarView>
223
+ ))}
224
+
225
+ {sizes.map((size, index) => (
226
+ <AvatarView key={size} size={size} badge={{ type: 'action' }}>
227
+ {icons[index]}
228
+ </AvatarView>
229
+ ))}
230
+
231
+ {sizes.map((size) => (
232
+ <AvatarView
233
+ key={size}
234
+ size={size}
235
+ imgSrc="../avatar-square-dude.webp"
236
+ badge={{ type: 'action', icon: <Camera /> }}
237
+ />
238
+ ))}
239
+
240
+ {sizes.map((size) => (
241
+ <AvatarView
242
+ key={size}
243
+ size={size}
244
+ imgSrc="../avatar-square-dude.webp"
245
+ badge={{ type: 'reference', icon: <Convert /> }}
246
+ />
247
+ ))}
248
+
249
+ {sizes.map((size) => (
250
+ <AvatarView
251
+ key={size}
252
+ size={size}
253
+ imgSrc="../avatar-square-dude.webp"
254
+ badge={{ icon: <Convert /> }}
255
+ />
256
+ ))}
257
+ </div>
258
+ );
259
+ },
260
+ },
261
+ { variants: ['light', 'dark'] },
262
+ );
263
+
264
+ export const Interactive: Story = storyConfig(
265
+ {
266
+ render: () => {
267
+ return (
268
+ <div
269
+ style={{
270
+ gap: '1em',
271
+ display: 'grid',
272
+ justifyContent: 'space-between',
273
+ gridTemplate: 'auto auto / repeat(2, min-content)',
274
+ }}
275
+ >
276
+ <Body type="body-large-bold">Button</Body>
277
+ <Body type="body-large-bold">Link</Body>
278
+
279
+ <AvatarView action={{ onClick: action('onClick') }} imgSrc="../avatar-square-dude.webp" />
280
+
281
+ <AvatarView action={{ href: '#' }} imgSrc="../avatar-square-dude.webp" />
282
+
283
+ <AvatarView
284
+ action={{ onClick: action('onClick') }}
285
+ badge={{ flagCode: 'EU' }}
286
+ imgSrc="../avatar-square-dude.webp"
287
+ name="Test Name"
288
+ />
289
+
290
+ <AvatarView
291
+ action={{ href: '#' }}
292
+ badge={{ flagCode: 'EU' }}
293
+ imgSrc="../avatar-square-dude.webp"
294
+ name="Test Name"
295
+ />
296
+
297
+ <AvatarView action={{ onClick: action('onClick') }} name="Test Name" />
298
+
299
+ <AvatarView action={{ href: '#' }} name="Test Name" />
300
+
301
+ <AvatarView
302
+ action={{ onClick: action('onClick') }}
303
+ badge={{ flagCode: 'EU' }}
304
+ name="Test Name"
305
+ />
306
+
307
+ <AvatarView action={{ href: '#' }} badge={{ flagCode: 'EU' }} name="Test Name" />
308
+
309
+ <AvatarView action={{ onClick: action('onClick') }}>
310
+ <Leaf />
311
+ </AvatarView>
312
+
313
+ <AvatarView action={{ href: '#' }}>
314
+ <Leaf />
315
+ </AvatarView>
316
+
317
+ <AvatarView action={{ onClick: action('onClick') }} badge={{ flagCode: 'EU' }}>
318
+ <Leaf />
319
+ </AvatarView>
320
+
321
+ <AvatarView action={{ href: '#' }} badge={{ flagCode: 'EU' }}>
322
+ <Leaf />
323
+ </AvatarView>
324
+ </div>
325
+ );
326
+ },
327
+ },
328
+ { variants: ['light', 'dark'] },
329
+ );
330
+
331
+ export const Images: Story = storyConfig(
332
+ {
333
+ render: () => {
334
+ return (
335
+ <div
336
+ style={{
337
+ gap: '1em',
338
+ display: 'grid',
339
+ justifyContent: 'space-between',
340
+ gridTemplate: 'auto auto / repeat(7, min-content)',
341
+ }}
342
+ >
343
+ {/* interactive image */}
344
+ {sizes.map((size) => (
345
+ <AvatarView
346
+ key={size}
347
+ size={size}
348
+ action={{ onClick: action('onClick') }}
349
+ imgSrc="../avatar-square-dude.webp"
350
+ name="Test Name"
351
+ type="business"
352
+ />
353
+ ))}
354
+ {/* non interactive image */}
355
+ {sizes.map((size) => (
356
+ <AvatarView
357
+ key={size}
358
+ size={size}
359
+ imgSrc="../avatar-square-dude.webp"
360
+ name="Test Name"
361
+ type="business"
362
+ />
363
+ ))}
364
+ {/* Flag as an image + interactive */}
365
+ {sizes.map((size) => (
366
+ <AvatarView key={size} size={size} action={{ onClick: action('onClick') }}>
367
+ <Flag code="JPY" intrinsicSize={size} />
368
+ </AvatarView>
369
+ ))}
370
+ {/* Flag as an image + non interactive */}
371
+ {sizes.map((size) => (
372
+ <AvatarView key={size} size={size}>
373
+ <Flag code="JPY" intrinsicSize={size} />
374
+ </AvatarView>
375
+ ))}
376
+ {/* Custom image + interactive */}
377
+ {sizes.map((size) => (
378
+ <AvatarView
379
+ key={size}
380
+ imgSrc="../avatar-rectangle-fox.webp"
381
+ size={size}
382
+ action={{ onClick: action('onClick') }}
383
+ />
384
+ ))}
385
+ {/* Custom image + non interactive */}
386
+ {sizes.map((size) => (
387
+ <AvatarView key={size} size={size} imgSrc="../avatar-rectangle-fox.webp" />
388
+ ))}
389
+ </div>
390
+ );
391
+ },
392
+ },
393
+ { variants: ['light', 'dark'] },
394
+ );
395
+
396
+ export const Profiles: Story = storyConfig(
397
+ {
398
+ render: () => {
399
+ return (
400
+ <div
401
+ style={{
402
+ gap: '1em',
403
+ display: 'grid',
404
+ justifyContent: 'space-between',
405
+ gridTemplate: 'auto auto / repeat(7, min-content)',
406
+ }}
407
+ >
408
+ {sizes.map((size) => (
409
+ <AvatarView
410
+ key={size}
411
+ size={size}
412
+ imgSrc="../avatar-square-dude.webp"
413
+ name="Test Name"
414
+ type="business"
415
+ />
416
+ ))}
417
+
418
+ {sizes.map((size) => (
419
+ <AvatarView
420
+ key={size}
421
+ size={size}
422
+ action={{ onClick: action('onClick') }}
423
+ imgSrc="../avatar-square-dude.webp"
424
+ name="Test Name"
425
+ type="business"
426
+ />
427
+ ))}
428
+
429
+ {sizes.map((size) => (
430
+ <AvatarView key={size} size={size} name="Test Name" />
431
+ ))}
432
+
433
+ {sizes.map((size) => (
434
+ <AvatarView
435
+ key={size}
436
+ size={size}
437
+ action={{ onClick: action('onClick') }}
438
+ name="Test Name"
439
+ />
440
+ ))}
441
+
442
+ {sizes.map((size) => (
443
+ <AvatarView key={size} size={size} type="business" />
444
+ ))}
445
+
446
+ {sizes.map((size) => (
447
+ <AvatarView
448
+ key={size}
449
+ size={size}
450
+ action={{ onClick: action('onClick') }}
451
+ type="business"
452
+ />
453
+ ))}
454
+
455
+ {sizes.map((size) => (
456
+ <AvatarView key={size} size={size} />
457
+ ))}
458
+
459
+ {sizes.map((size) => (
460
+ <AvatarView key={size} size={size} action={{ onClick: action('onClick') }} />
461
+ ))}
462
+ </div>
463
+ );
464
+ },
465
+ },
466
+ { variants: ['light', 'dark'] },
467
+ );
468
+
469
+ export const ProfileBrokenImageFallback: Story = {
470
+ render: () => (
471
+ <>
472
+ <AvatarView imgSrc="../img-wrong-url.lol" />
473
+ <AvatarView imgSrc="../img-wrong-url.lol" type="business" />
474
+ <AvatarView imgSrc="../img-wrong-url.lol" type="business" name="D D" />
475
+ </>
476
+ ),
477
+ };
478
+
479
+ export const EdgeInstaces: Story = {
480
+ render: () => {
481
+ const css = `.custom-variant {
482
+ border: 1px dashed var(--color-border-neutral);
483
+ }`;
484
+ return (
485
+ <div
486
+ style={{
487
+ gap: '1em',
488
+ display: 'grid',
489
+ justifyContent: 'space-between',
490
+ gridTemplate: 'auto auto / repeat(2, min-content)',
491
+ }}
492
+ >
493
+ <style>{css}</style>
494
+ {/* <Body>- Custom colors</Body> */}
495
+ <AvatarView
496
+ action={{ onClick: action('onClick') }}
497
+ badge={{ flagCode: 'EU' }}
498
+ style={{ backgroundColor: 'var(--color-bright-orange)' }}
499
+ >
500
+ <Money />
501
+ </AvatarView>
502
+ <AvatarView
503
+ badge={{ flagCode: 'EU' }}
504
+ style={{ backgroundColor: 'var(--color-bright-orange)', border: 'none' }}
505
+ >
506
+ <Money />
507
+ </AvatarView>
508
+ {/* <Body>- Add example with dashed avatar as in shared balances</Body> */}
509
+ <AvatarView action={{ onClick: action('onClick') }} className="custom-variant">
510
+ <PlusCircle />
511
+ </AvatarView>
512
+ <AvatarView action={{ href: '#' }} className="custom-variant">
513
+ <PlusCircle />
514
+ </AvatarView>
515
+ <AvatarView action={{ href: '#' }} className="custom-variant">
516
+ {null}
517
+ </AvatarView>
518
+ {/* <Body> - Add example custom backgrounds as in account summary (https://wise.com/account-summary)</Body> */}
519
+ <AvatarView style={{ backgroundColor: 'rgb(203, 217, 195)' }}>
520
+ <span style={{ color: 'rgb(22, 51, 0)' }}>
521
+ <Graph />
522
+ </span>
523
+ </AvatarView>
524
+ <AvatarView
525
+ action={{ onClick: action('onClikc') }}
526
+ style={{ backgroundColor: 'rgb(203, 217, 195)' }}
527
+ >
528
+ <span style={{ color: 'rgb(22, 51, 0)' }}>
529
+ <Graph />
530
+ </span>
531
+ </AvatarView>
532
+ <AvatarView style={{ backgroundColor: 'rgb(22, 51, 0)' }}>
533
+ <span style={{ color: 'rgb(203, 217, 195)' }}>
534
+ <Rewards />
535
+ </span>
536
+ </AvatarView>
537
+ <AvatarView
538
+ action={{ onClick: action('onClikc') }}
539
+ style={{ backgroundColor: 'rgb(22, 51, 0)' }}
540
+ >
541
+ <span style={{ color: 'rgb(203, 217, 195)' }}>
542
+ <Rewards />
543
+ </span>
544
+ </AvatarView>
545
+ {/* <Body>- Add example Wise Sand + custom background from hash</Body> */}
546
+ <AvatarView
547
+ badge={{ flagCode: 'EU' }}
548
+ style={{ backgroundColor: getBrandColorFromSeed(profileName1) }}
549
+ >
550
+ <Display>{getInitials(profileName1)}</Display>
551
+ </AvatarView>
552
+ <AvatarView style={{ backgroundColor: getBrandColorFromSeed(profileName1) }}>
553
+ <Display>{getInitials(profileName1)}</Display>
554
+ </AvatarView>
555
+ <AvatarView
556
+ action={{ onClick: action('onClick') }}
557
+ style={{ backgroundColor: getBrandColorFromSeed(profileName2) }}
558
+ >
559
+ <Display>{getInitials(profileName1)}</Display>
560
+ </AvatarView>
561
+ <AvatarView
562
+ action={{ href: '#' }}
563
+ badge={{ flagCode: 'EU' }}
564
+ style={{ backgroundColor: getBrandColorFromSeed(profileName2) }}
565
+ >
566
+ <Display>{getInitials(profileName1)}</Display>
567
+ </AvatarView>
568
+ <AvatarView>9+</AvatarView>
569
+ <AvatarView action={{ href: '#' }}>5+</AvatarView>
570
+ </div>
571
+ );
572
+ },
573
+ };