@transferwise/components 0.0.0-experimental-37d8e2c → 0.0.0-experimental-dabe7c7

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 (144) hide show
  1. package/build/actionButton/ActionButton.js +1 -1
  2. package/build/actionButton/ActionButton.js.map +1 -1
  3. package/build/actionButton/ActionButton.mjs +1 -1
  4. package/build/actionButton/ActionButton.mjs.map +1 -1
  5. package/build/actionOption/ActionOption.js +7 -2
  6. package/build/actionOption/ActionOption.js.map +1 -1
  7. package/build/actionOption/ActionOption.mjs +8 -3
  8. package/build/actionOption/ActionOption.mjs.map +1 -1
  9. package/build/avatar/Avatar.js +1 -4
  10. package/build/avatar/Avatar.js.map +1 -1
  11. package/build/avatar/Avatar.mjs +1 -4
  12. package/build/avatar/Avatar.mjs.map +1 -1
  13. package/build/avatar/colors/colors.js +1 -1
  14. package/build/avatar/colors/colors.js.map +1 -1
  15. package/build/avatar/colors/colors.mjs +1 -1
  16. package/build/avatar/colors/colors.mjs.map +1 -1
  17. package/build/avatarWrapper/AvatarWrapper.js +9 -6
  18. package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
  19. package/build/avatarWrapper/AvatarWrapper.mjs +8 -5
  20. package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
  21. package/build/badge/Badge.js +1 -6
  22. package/build/badge/Badge.js.map +1 -1
  23. package/build/badge/Badge.mjs +1 -6
  24. package/build/badge/Badge.mjs.map +1 -1
  25. package/build/circularButton/CircularButton.js +7 -4
  26. package/build/circularButton/CircularButton.js.map +1 -1
  27. package/build/circularButton/CircularButton.mjs +7 -4
  28. package/build/circularButton/CircularButton.mjs.map +1 -1
  29. package/build/common/circle/Circle.js +1 -24
  30. package/build/common/circle/Circle.js.map +1 -1
  31. package/build/common/circle/Circle.mjs +1 -24
  32. package/build/common/circle/Circle.mjs.map +1 -1
  33. package/build/display/Display.js +1 -1
  34. package/build/display/Display.js.map +1 -1
  35. package/build/display/Display.mjs +1 -1
  36. package/build/display/Display.mjs.map +1 -1
  37. package/build/index.js +0 -6
  38. package/build/index.js.map +1 -1
  39. package/build/index.mjs +0 -3
  40. package/build/index.mjs.map +1 -1
  41. package/build/main.css +56 -82
  42. package/build/statusIcon/StatusIcon.js +2 -4
  43. package/build/statusIcon/StatusIcon.js.map +1 -1
  44. package/build/statusIcon/StatusIcon.mjs +2 -4
  45. package/build/statusIcon/StatusIcon.mjs.map +1 -1
  46. package/build/styles/actionButton/ActionButton.css +11 -0
  47. package/build/styles/actionOption/ActionOption.css +4 -0
  48. package/build/styles/badge/Badge.css +5 -5
  49. package/build/styles/circularButton/CircularButton.css +24 -0
  50. package/build/styles/common/circle/Circle.css +0 -17
  51. package/build/styles/main.css +56 -82
  52. package/build/styles/statusIcon/StatusIcon.css +12 -0
  53. package/build/types/actionButton/ActionButton.d.ts +3 -3
  54. package/build/types/actionButton/ActionButton.d.ts.map +1 -1
  55. package/build/types/actionOption/ActionOption.d.ts +2 -2
  56. package/build/types/actionOption/ActionOption.d.ts.map +1 -1
  57. package/build/types/avatar/Avatar.d.ts +0 -3
  58. package/build/types/avatar/Avatar.d.ts.map +1 -1
  59. package/build/types/avatar/colors/colors.d.ts +1 -1
  60. package/build/types/avatar/colors/colors.d.ts.map +1 -1
  61. package/build/types/avatarWrapper/AvatarWrapper.d.ts +0 -3
  62. package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
  63. package/build/types/badge/Badge.d.ts +1 -2
  64. package/build/types/badge/Badge.d.ts.map +1 -1
  65. package/build/types/circularButton/CircularButton.d.ts.map +1 -1
  66. package/build/types/common/circle/Circle.d.ts +1 -1
  67. package/build/types/common/circle/Circle.d.ts.map +1 -1
  68. package/build/types/common/index.d.ts +0 -1
  69. package/build/types/index.d.ts +1 -4
  70. package/build/types/index.d.ts.map +1 -1
  71. package/build/types/statusIcon/StatusIcon.d.ts +2 -6
  72. package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
  73. package/package.json +3 -3
  74. package/src/actionButton/ActionButton.css +11 -0
  75. package/src/actionButton/ActionButton.less +14 -0
  76. package/src/actionButton/ActionButton.story.tsx +7 -0
  77. package/src/actionButton/ActionButton.tsx +7 -3
  78. package/src/actionOption/ActionOption.css +4 -0
  79. package/src/actionOption/ActionOption.less +3 -0
  80. package/src/actionOption/ActionOption.story.tsx +4 -0
  81. package/src/actionOption/ActionOption.tsx +15 -2
  82. package/src/avatar/Avatar.tsx +1 -4
  83. package/src/avatar/colors/colors.ts +4 -4
  84. package/src/avatarWrapper/AvatarWrapper.tsx +16 -12
  85. package/src/badge/Badge.css +5 -5
  86. package/src/badge/Badge.less +3 -3
  87. package/src/badge/Badge.tsx +1 -10
  88. package/src/circularButton/CircularButton.css +24 -0
  89. package/src/circularButton/CircularButton.less +15 -15
  90. package/src/circularButton/CircularButton.tsx +5 -4
  91. package/src/common/circle/Circle.css +0 -17
  92. package/src/common/circle/Circle.less +0 -22
  93. package/src/common/circle/Circle.tsx +2 -33
  94. package/src/common/index.js +0 -1
  95. package/src/display/Display.tsx +1 -1
  96. package/src/index.ts +0 -4
  97. package/src/main.css +56 -82
  98. package/src/main.less +1 -3
  99. package/src/statusIcon/StatusIcon.css +12 -0
  100. package/src/statusIcon/StatusIcon.less +6 -6
  101. package/src/statusIcon/StatusIcon.story.tsx +28 -32
  102. package/src/statusIcon/StatusIcon.tsx +4 -18
  103. package/build/avatarView/AvatarView.js +0 -207
  104. package/build/avatarView/AvatarView.js.map +0 -1
  105. package/build/avatarView/AvatarView.mjs +0 -205
  106. package/build/avatarView/AvatarView.mjs.map +0 -1
  107. package/build/common/initials.js +0 -12
  108. package/build/common/initials.js.map +0 -1
  109. package/build/common/initials.mjs +0 -10
  110. package/build/common/initials.mjs.map +0 -1
  111. package/build/common/notificationDot/NotificationDot.js +0 -16
  112. package/build/common/notificationDot/NotificationDot.js.map +0 -1
  113. package/build/common/notificationDot/NotificationDot.mjs +0 -14
  114. package/build/common/notificationDot/NotificationDot.mjs.map +0 -1
  115. package/build/styles/avatarGroup/AvatarGroup.css +0 -28
  116. package/build/styles/avatarView/AvatarView.css +0 -22
  117. package/build/styles/common/notificationDot/NotificationDot.css +0 -10
  118. package/build/types/avatarGroup/AvatarGroup.d.ts +0 -19
  119. package/build/types/avatarGroup/AvatarGroup.d.ts.map +0 -1
  120. package/build/types/avatarGroup/index.d.ts +0 -3
  121. package/build/types/avatarGroup/index.d.ts.map +0 -1
  122. package/build/types/avatarView/AvatarView.d.ts +0 -25
  123. package/build/types/avatarView/AvatarView.d.ts.map +0 -1
  124. package/build/types/avatarView/index.d.ts +0 -3
  125. package/build/types/avatarView/index.d.ts.map +0 -1
  126. package/build/types/common/initials.d.ts +0 -2
  127. package/build/types/common/initials.d.ts.map +0 -1
  128. package/build/types/common/notificationDot/NotificationDot.d.ts +0 -8
  129. package/build/types/common/notificationDot/NotificationDot.d.ts.map +0 -1
  130. package/src/avatarGroup/AvatarGroup.css +0 -28
  131. package/src/avatarGroup/AvatarGroup.less +0 -32
  132. package/src/avatarGroup/AvatarGroup.story.tsx +0 -249
  133. package/src/avatarGroup/AvatarGroup.tsx +0 -78
  134. package/src/avatarGroup/index.ts +0 -2
  135. package/src/avatarView/AvatarView.css +0 -22
  136. package/src/avatarView/AvatarView.less +0 -24
  137. package/src/avatarView/AvatarView.story.tsx +0 -425
  138. package/src/avatarView/AvatarView.tsx +0 -217
  139. package/src/avatarView/index.ts +0 -2
  140. package/src/common/initials.ts +0 -13
  141. package/src/common/notificationDot/NotificationDot.css +0 -10
  142. package/src/common/notificationDot/NotificationDot.less +0 -7
  143. package/src/common/notificationDot/NotificationDot.tsx +0 -10
  144. package/src/test-utils/avatar-img.webp +0 -0
@@ -1,249 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import AvatarGroup from './AvatarGroup';
3
- import { Bank, Briefcase } from '@transferwise/icons';
4
- import Title from '../title';
5
- import { Flag } from '@wise/art';
6
- import { storyConfig } from '../test-utils';
7
- import RadioOption from '../radioOption';
8
-
9
- export default {
10
- title: 'Content/AvatarGroup',
11
- } satisfies Meta<typeof AvatarGroup>;
12
-
13
- type Story = StoryObj<typeof AvatarGroup>;
14
-
15
- export const Basic: Story = storyConfig(
16
- {
17
- render: () => (
18
- <>
19
- <RadioOption
20
- id="test"
21
- name="foo"
22
- title="Personal account"
23
- showMediaCircle={false}
24
- media={
25
- <AvatarGroup
26
- size={48}
27
- orientation="diagonal"
28
- avatars={[
29
- { asset: 'AA', type: 'text' },
30
- { asset: 'BB', type: 'text' },
31
- ]}
32
- />
33
- }
34
- onChange={() => {}}
35
- />
36
- <Title type="title-subsection">Diagonal</Title>
37
- <table border="0" cellPadding="0" cellSpacing="0">
38
- <tr>
39
- <td>24</td>
40
- <td>48</td>
41
- <td>72</td>
42
- </tr>
43
- <tr>
44
- <td>
45
- <AvatarGroup
46
- size={24}
47
- orientation="diagonal"
48
- avatars={[
49
- { asset: 'JJ', type: 'text' },
50
- { asset: 'AA', type: 'text' },
51
- ]}
52
- />
53
- </td>
54
- <td>
55
- <AvatarGroup
56
- orientation="diagonal"
57
- avatars={[
58
- { asset: 'JJ', type: 'text' },
59
- { asset: 'AA', type: 'text' },
60
- ]}
61
- />
62
- </td>
63
- <td>
64
- <AvatarGroup
65
- size={72}
66
- orientation="diagonal"
67
- avatars={[
68
- { asset: 'JJ', type: 'text' },
69
- { asset: 'AA', type: 'text' },
70
- ]}
71
- />
72
- </td>
73
- </tr>
74
- <tr>
75
- <td>
76
- <AvatarGroup
77
- size={24}
78
- orientation="diagonal"
79
- avatars={[
80
- { asset: <Briefcase size="16" />, type: 'icon' },
81
- { asset: <Bank size="16" />, type: 'icon' },
82
- ]}
83
- />
84
- </td>
85
- <td>
86
- <AvatarGroup
87
- size={48}
88
- orientation="diagonal"
89
- avatars={[
90
- { asset: <Briefcase size="24" />, type: 'icon' },
91
- { asset: <Bank size="24" />, type: 'icon' },
92
- ]}
93
- />
94
- </td>
95
- <td>
96
- <AvatarGroup
97
- size={72}
98
- orientation="diagonal"
99
- avatars={[
100
- { asset: <Briefcase size="24" />, type: 'icon' },
101
- { asset: <Bank size="24" />, type: 'icon' },
102
- ]}
103
- />
104
- </td>
105
- </tr>
106
- <tr>
107
- <td>
108
- <AvatarGroup
109
- size={24}
110
- orientation="diagonal"
111
- avatars={[
112
- { asset: <Flag code="gb" />, type: 'image' },
113
- { asset: <Flag code="jp" />, type: 'image' },
114
- ]}
115
- />
116
- </td>
117
- <td>
118
- <AvatarGroup
119
- size={48}
120
- orientation="diagonal"
121
- avatars={[
122
- { asset: <Flag code="gb" />, type: 'image' },
123
- { asset: <Flag code="jp" />, type: 'image' },
124
- ]}
125
- />
126
- </td>
127
- <td>
128
- <AvatarGroup
129
- size={72}
130
- orientation="diagonal"
131
- avatars={[
132
- { asset: <Flag code="gb" />, type: 'image' },
133
- { asset: <Flag code="jp" />, type: 'image' },
134
- ]}
135
- />
136
- </td>
137
- </tr>
138
- </table>
139
-
140
- <Title type="title-subsection" className="m-t-3">
141
- Horizontal
142
- </Title>
143
- <table border="0" cellPadding="0" cellSpacing="0">
144
- <tr>
145
- <td>24</td>
146
- <td>48</td>
147
- <td>72</td>
148
- </tr>
149
- <tr>
150
- <td>
151
- <AvatarGroup
152
- size={24}
153
- orientation="horizontal"
154
- avatars={[
155
- { asset: 'JJ', type: 'text' },
156
- { asset: 'AA', type: 'text' },
157
- ]}
158
- />
159
- </td>
160
- <td>
161
- <AvatarGroup
162
- orientation="horizontal"
163
- avatars={[
164
- { asset: 'JJ', type: 'text' },
165
- { asset: 'AA', type: 'text' },
166
- ]}
167
- />
168
- </td>
169
- <td>
170
- <AvatarGroup
171
- size={72}
172
- orientation="horizontal"
173
- avatars={[
174
- { asset: 'JJ', type: 'text' },
175
- { asset: 'AA', type: 'text' },
176
- ]}
177
- />
178
- </td>
179
- </tr>
180
- <tr>
181
- <td>
182
- <AvatarGroup
183
- size={24}
184
- orientation="horizontal"
185
- avatars={[
186
- { asset: <Briefcase size="16" />, type: 'icon' },
187
- { asset: <Bank size="16" />, type: 'icon' },
188
- ]}
189
- />
190
- </td>
191
- <td>
192
- <AvatarGroup
193
- size={48}
194
- orientation="horizontal"
195
- avatars={[
196
- { asset: <Briefcase size="24" />, type: 'icon' },
197
- { asset: <Bank size="24" />, type: 'icon' },
198
- ]}
199
- />
200
- </td>
201
- <td>
202
- <AvatarGroup
203
- size={72}
204
- orientation="horizontal"
205
- avatars={[
206
- { asset: <Briefcase size="24" />, type: 'icon' },
207
- { asset: <Bank size="24" />, type: 'icon' },
208
- ]}
209
- />
210
- </td>
211
- </tr>
212
- <tr>
213
- <td>
214
- <AvatarGroup
215
- size={24}
216
- orientation="horizontal"
217
- avatars={[
218
- { asset: <Flag code="gb" />, type: 'image' },
219
- { asset: <Flag code="jp" />, type: 'image' },
220
- ]}
221
- />
222
- </td>
223
- <td>
224
- <AvatarGroup
225
- size={48}
226
- orientation="horizontal"
227
- avatars={[
228
- { asset: <Flag code="gb" />, type: 'image' },
229
- { asset: <Flag code="jp" />, type: 'image' },
230
- ]}
231
- />
232
- </td>
233
- <td>
234
- <AvatarGroup
235
- size={72}
236
- orientation="horizontal"
237
- avatars={[
238
- { asset: <Flag code="gb" />, type: 'image' },
239
- { asset: <Flag code="jp" />, type: 'image' },
240
- ]}
241
- />
242
- </td>
243
- </tr>
244
- </table>
245
- </>
246
- ),
247
- },
248
- { variants: ['light', 'dark'] },
249
- );
@@ -1,78 +0,0 @@
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 { ReactNode } from 'react';
6
- import AvatarView, { AvatarViewProps } from '../avatarView';
7
-
8
- type AvatarType = { asset: ReactNode } & Pick<
9
- AvatarViewProps,
10
- 'type' | 'backgroundColor' | 'borderColor' | 'className'
11
- >;
12
- type AvatarGroupOrientation = 'horizontal' | 'diagonal';
13
- type AvatarGroupDiagonalSize = 24 | 32 | 40 | 48 | 56 | 72;
14
- type AvatarGroupSize = 16 | AvatarGroupDiagonalSize;
15
-
16
- /**
17
- * Diagonal orientation uses custom sizes for avatars
18
- */
19
- const avatarGroupDiagonalSizeMap: Record<AvatarGroupDiagonalSize, number> = {
20
- 24: 15,
21
- 32: 20,
22
- 40: 24,
23
- 48: 30,
24
- 56: 34,
25
- 72: 44,
26
- };
27
-
28
- export type Props = {
29
- 'aria-label'?: string;
30
- avatars: AvatarType[];
31
- orientation?: AvatarGroupOrientation;
32
- size?: AvatarGroupSize;
33
- interactive?: boolean;
34
- } & CommonProps;
35
-
36
- export default function AvatarGroup({
37
- avatars,
38
- orientation: orientationProp = 'horizontal',
39
- size = 48,
40
- 'aria-label': ariaLabel,
41
- className,
42
- interactive,
43
- }: Props) {
44
- const orientation =
45
- orientationProp === 'diagonal' && size === 16 ? 'horizontal' : orientationProp;
46
- const avatarSize = orientation === 'diagonal' ? avatarGroupDiagonalSizeMap[size] : size;
47
- return (
48
- <div
49
- className={clsx('np-avatar-group', `np-avatar-group-${orientation}`, className)}
50
- // @ts-expect-error `--np-avatar-group-size` exsits in styles of AvatarGroup
51
- style={{ '--np-avatar-group-size': `${size}px`, '--np-avatar-size': `${avatarSize}px` }}
52
- aria-label={ariaLabel}
53
- >
54
- {avatars.length > 1
55
- ? avatars.map((avatar, index) => (
56
- <AvatarView
57
- key={index}
58
- {...avatar}
59
- className={clsx(
60
- { [`np-avatar-group-${orientation}-child`]: index !== 0 },
61
- { [`np-avatar-group-${orientation}-mask`]: index !== avatars.length - 1 },
62
- avatar.className,
63
- )}
64
- style={{
65
- // @ts-expect-error CSS custom props allowed
66
- '--np-avatar-group-index': index,
67
- '--circle-size': `${avatarSize}px`,
68
- }}
69
- size={avatarSize}
70
- interactive={interactive}
71
- >
72
- {avatar.asset}
73
- </AvatarView>
74
- ))
75
- : null}
76
- </div>
77
- );
78
- }
@@ -1,2 +0,0 @@
1
- export type { Props as AvatarGroupProps } from './AvatarGroup';
2
- export { default } from './AvatarGroup';
@@ -1,22 +0,0 @@
1
- .np-avatar-view {
2
- border-radius: 9999px;
3
- border-radius: var(--radius-full);
4
- color: var(--color-interactive-primary);
5
- height: -moz-fit-content;
6
- height: fit-content;
7
- width: -moz-fit-content;
8
- width: fit-content;
9
- }
10
- .np-avatar-view .np-circle {
11
- background-color: transparent;
12
- border: var(--avatar-view-non-interactive-border-width) solid rgba(0,0,0,0.10196);
13
- border: var(--avatar-view-non-interactive-border-width) solid var(--color-border-neutral);
14
- }
15
- .np-avatar-view-selected .np-circle {
16
- border: var(--avatar-view-selected-border-width) solid var(--color-interactive-primary) !important;
17
- }
18
- .np-avatar-view-interactive .np-circle {
19
- background-color: rgba(134,167,189,0.10196);
20
- background-color: var(--color-background-neutral);
21
- border: none;
22
- }
@@ -1,24 +0,0 @@
1
- .np-avatar-view {
2
- border-radius: var(--radius-full);
3
- color: var(--color-interactive-primary);
4
- height: fit-content;
5
- width: fit-content;
6
-
7
- .np-circle {
8
- background-color: transparent;
9
- border: var(--avatar-view-non-interactive-border-width) solid var(--color-border-neutral);
10
- }
11
-
12
- &-selected {
13
- .np-circle {
14
- border: var(--avatar-view-selected-border-width) solid var(--color-interactive-primary) !important;
15
- }
16
- }
17
-
18
- &-interactive {
19
- .np-circle {
20
- background-color: var(--color-background-neutral);
21
- border: none;
22
- }
23
- }
24
- }