@transferwise/components 0.0.0-experimental-d11e9c5 → 0.0.0-experimental-76bb7cd

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 (124) hide show
  1. package/build/avatar/Avatar.js +0 -3
  2. package/build/avatar/Avatar.js.map +1 -1
  3. package/build/avatar/Avatar.mjs +0 -3
  4. package/build/avatar/Avatar.mjs.map +1 -1
  5. package/build/avatarWrapper/AvatarWrapper.js +4 -10
  6. package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
  7. package/build/avatarWrapper/AvatarWrapper.mjs +4 -10
  8. package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
  9. package/build/badge/Badge.js +1 -3
  10. package/build/badge/Badge.js.map +1 -1
  11. package/build/badge/Badge.mjs +1 -3
  12. package/build/badge/Badge.mjs.map +1 -1
  13. package/build/button/Button.js.map +1 -1
  14. package/build/button/Button.mjs.map +1 -1
  15. package/build/button/legacyUtils/legacyUtils.js.map +1 -1
  16. package/build/button/legacyUtils/legacyUtils.mjs.map +1 -1
  17. package/build/common/circle/Circle.js +1 -17
  18. package/build/common/circle/Circle.js.map +1 -1
  19. package/build/common/circle/Circle.mjs +1 -17
  20. package/build/common/circle/Circle.mjs.map +1 -1
  21. package/build/index.js +121 -128
  22. package/build/index.js.map +1 -1
  23. package/build/index.mjs +29 -33
  24. package/build/index.mjs.map +1 -1
  25. package/build/main.css +5 -109
  26. package/build/styles/badge/Badge.css +5 -6
  27. package/build/styles/common/circle/Circle.css +0 -32
  28. package/build/styles/main.css +5 -109
  29. package/build/types/avatar/Avatar.d.ts +0 -3
  30. package/build/types/avatar/Avatar.d.ts.map +1 -1
  31. package/build/types/avatarWrapper/AvatarWrapper.d.ts +0 -3
  32. package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
  33. package/build/types/badge/Badge.d.ts +1 -5
  34. package/build/types/badge/Badge.d.ts.map +1 -1
  35. package/build/types/badge/index.d.ts +0 -2
  36. package/build/types/badge/index.d.ts.map +1 -1
  37. package/build/types/button/Button.d.ts +1 -1
  38. package/build/types/button/Button.d.ts.map +1 -1
  39. package/build/types/button/legacyUtils/legacyUtils.d.ts +2 -2
  40. package/build/types/button/legacyUtils/legacyUtils.d.ts.map +1 -1
  41. package/build/types/common/circle/Circle.d.ts +0 -2
  42. package/build/types/common/circle/Circle.d.ts.map +1 -1
  43. package/build/types/index.d.ts +1 -3
  44. package/build/types/index.d.ts.map +1 -1
  45. package/build/types/test-utils/index.d.ts +158 -0
  46. package/build/types/test-utils/index.d.ts.map +1 -0
  47. package/build/types/test-utils/jest.setup.d.ts +2 -0
  48. package/build/types/test-utils/jest.setup.d.ts.map +1 -0
  49. package/package.json +4 -3
  50. package/src/avatar/Avatar.tsx +0 -3
  51. package/src/avatarWrapper/AvatarWrapper.tsx +0 -3
  52. package/src/badge/Badge.css +5 -6
  53. package/src/badge/Badge.less +3 -4
  54. package/src/badge/Badge.tsx +1 -8
  55. package/src/badge/index.ts +0 -3
  56. package/src/button/{Button.spec.js → Button.spec.tsx} +3 -2
  57. package/src/button/Button.tsx +1 -1
  58. package/src/button/legacyUtils/{legacyUtils.spec.js → legacyUtils.spec.tsx} +1 -1
  59. package/src/button/legacyUtils/legacyUtils.ts +2 -2
  60. package/src/common/circle/Circle.css +0 -32
  61. package/src/common/circle/Circle.less +0 -35
  62. package/src/common/circle/Circle.tsx +1 -22
  63. package/src/decision/Decision.story.tsx +46 -10
  64. package/src/flowNavigation/FlowNavigation.story.tsx +48 -10
  65. package/src/index.ts +0 -4
  66. package/src/listItem/ListItem.story.tsx +43 -5
  67. package/src/main.css +5 -109
  68. package/src/main.less +0 -2
  69. package/src/modal/{Modal.rtl.spec.js → Modal.rtl.spec.tsx} +8 -7
  70. package/src/navigationOption/NavigationOption.story.tsx +65 -14
  71. package/src/overlayHeader/OverlayHeader.story.tsx +10 -5
  72. package/src/radio/Radio.story.tsx +5 -5
  73. package/src/radioGroup/RadioGroup.story.tsx +3 -3
  74. package/src/selectOption/SelectOption.story.tsx +30 -31
  75. package/src/slidingPanel/SlidingPanel.spec.js +1 -1
  76. package/src/ssr.spec.tsx +264 -0
  77. package/src/test-utils/{index.js → index.tsx} +11 -6
  78. package/src/test-utils/{jest.setup.js → jest.setup.ts} +13 -8
  79. package/src/tile/Tile.story.tsx +6 -2
  80. package/build/avatarView/AvatarView.js +0 -163
  81. package/build/avatarView/AvatarView.js.map +0 -1
  82. package/build/avatarView/AvatarView.mjs +0 -161
  83. package/build/avatarView/AvatarView.mjs.map +0 -1
  84. package/build/avatarView/NotificationDot.js +0 -59
  85. package/build/avatarView/NotificationDot.js.map +0 -1
  86. package/build/avatarView/NotificationDot.mjs +0 -57
  87. package/build/avatarView/NotificationDot.mjs.map +0 -1
  88. package/build/badge/BadgeAssets.js +0 -85
  89. package/build/badge/BadgeAssets.js.map +0 -1
  90. package/build/badge/BadgeAssets.mjs +0 -83
  91. package/build/badge/BadgeAssets.mjs.map +0 -1
  92. package/build/styles/avatarGroup/AvatarGroup.css +0 -29
  93. package/build/styles/avatarView/AvatarView.css +0 -42
  94. package/build/styles/avatarView/NotificationDot.css +0 -20
  95. package/build/types/avatarGroup/AvatarGroup.d.ts +0 -18
  96. package/build/types/avatarGroup/AvatarGroup.d.ts.map +0 -1
  97. package/build/types/avatarGroup/index.d.ts +0 -3
  98. package/build/types/avatarGroup/index.d.ts.map +0 -1
  99. package/build/types/avatarView/AvatarView.d.ts +0 -19
  100. package/build/types/avatarView/AvatarView.d.ts.map +0 -1
  101. package/build/types/avatarView/NotificationDot.d.ts +0 -8
  102. package/build/types/avatarView/NotificationDot.d.ts.map +0 -1
  103. package/build/types/avatarView/index.d.ts +0 -3
  104. package/build/types/avatarView/index.d.ts.map +0 -1
  105. package/build/types/badge/BadgeAssets.d.ts +0 -15
  106. package/build/types/badge/BadgeAssets.d.ts.map +0 -1
  107. package/src/avatarGroup/AvatarGroup.css +0 -29
  108. package/src/avatarGroup/AvatarGroup.less +0 -42
  109. package/src/avatarGroup/AvatarGroup.story.tsx +0 -284
  110. package/src/avatarGroup/AvatarGroup.tsx +0 -117
  111. package/src/avatarGroup/index.ts +0 -2
  112. package/src/avatarView/AvatarView.css +0 -42
  113. package/src/avatarView/AvatarView.less +0 -33
  114. package/src/avatarView/AvatarView.story.tsx +0 -425
  115. package/src/avatarView/AvatarView.tsx +0 -141
  116. package/src/avatarView/NotificationDot.css +0 -20
  117. package/src/avatarView/NotificationDot.less +0 -24
  118. package/src/avatarView/NotificationDot.tsx +0 -35
  119. package/src/avatarView/index.ts +0 -2
  120. package/src/badge/BadgeAssets.tsx +0 -65
  121. package/src/ssr.spec.js +0 -256
  122. /package/src/button/__snapshots__/{Button.spec.js.snap → Button.spec.tsx.snap} +0 -0
  123. /package/src/dimmer/{Dimmer.rtl.spec.js → Dimmer.rtl.spec.tsx} +0 -0
  124. /package/src/info/{Info.spec.js → Info.spec.jsx} +0 -0
@@ -1,8 +0,0 @@
1
- import { HTMLAttributes } from 'react';
2
- import { Props as AvatarViewProps } from './AvatarView';
3
- type Props = Pick<HTMLAttributes<HTMLDivElement>, 'children'> & {
4
- avatarSize?: AvatarViewProps['size'];
5
- };
6
- export default function NotificationDot({ children, avatarSize }: Props): import("react").JSX.Element;
7
- export {};
8
- //# sourceMappingURL=NotificationDot.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotificationDot.d.ts","sourceRoot":"","sources":["../../../src/avatarView/NotificationDot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,KAAK,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAExD,KAAK,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,GAAG;IAC9D,UAAU,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;CACtC,CAAC;AAeF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,QAAQ,EAAE,UAAe,EAAE,EAAE,KAAK,+BAc3E"}
@@ -1,3 +0,0 @@
1
- export type { Props as AvatarViewProps } from './AvatarView';
2
- export { default } from './AvatarView';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/avatarView/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,KAAK,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
@@ -1,15 +0,0 @@
1
- import { StatusIconProps } from '../statusIcon';
2
- import type { BadgeProps } from './Badge';
3
- export type Props = {
4
- status?: StatusIconProps['sentiment'];
5
- flagCode?: string;
6
- imgSrc?: string;
7
- icon?: React.ReactNode;
8
- type?: 'action' | 'reference';
9
- size?: BadgeProps['size'];
10
- };
11
- /**
12
- * Common pre-built badge variants.
13
- */
14
- export default function BadgeAssets({ status, flagCode, imgSrc, icon, type, size: sizeProp, }: Props): import("react").JSX.Element | null;
15
- //# sourceMappingURL=BadgeAssets.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BadgeAssets.d.ts","sourceRoot":"","sources":["../../../src/badge/BadgeAssets.tsx"],"names":[],"mappings":"AAAA,OAAmB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAI5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,MAAM,MAAM,KAAK,GAAG;IAClB,MAAM,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,IAAI,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAC;IAC9B,IAAI,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,MAAM,EACN,QAAQ,EACR,MAAM,EACN,IAAW,EACX,IAAe,EACf,IAAI,EAAE,QAAQ,GACf,EAAE,KAAK,sCAqCP"}
@@ -1,29 +0,0 @@
1
- .np-avatar-group {
2
- display: inline-flex;
3
- position: relative;
4
- }
5
- .np-avatar-group-diagonal {
6
- width: var(--np-avatar-group-size);
7
- height: var(--np-avatar-group-size);
8
- }
9
- .np-avatar-group-diagonal-mask {
10
- -webkit-mask-image: radial-gradient(circle at bottom calc(100% - var(--np-avatar-group-size) / 1.5) right calc(100% - var(--np-avatar-group-size) / 1.5), transparent 0, transparent calc(var(--np-avatar-group-single-size) / 2 + 0.5px), black 0);
11
- mask-image: radial-gradient(circle at bottom calc(100% - var(--np-avatar-group-size) / 1.5) right calc(100% - var(--np-avatar-group-size) / 1.5), transparent 0, transparent calc(var(--np-avatar-group-single-size) / 2 + 0.5px), black 0);
12
- }
13
- .np-avatar-group-diagonal-child {
14
- position: absolute;
15
- top: var(--np-avatar-group-diagonal-child-position);
16
- right: 0;
17
- }
18
- .np-avatar-group-horizontal {
19
- height: var(--np-avatar-group-size);
20
- }
21
- .np-avatar-group-horizontal-mask {
22
- -webkit-mask-image: radial-gradient(circle at top calc(100% - var(--np-avatar-group-single-size) / 2) right calc((100% - var(--np-avatar-group-single-size) / 1.5) * -1), transparent 0, transparent calc((var(--np-avatar-group-single-size) / 2.5) + var(--np-avatar-group-horizontal-child-position)), black 0);
23
- mask-image: radial-gradient(circle at top calc(100% - var(--np-avatar-group-single-size) / 2) right calc((100% - var(--np-avatar-group-single-size) / 1.5) * -1), transparent 0, transparent calc((var(--np-avatar-group-single-size) / 2.5) + var(--np-avatar-group-horizontal-child-position)), black 0);
24
- -webkit-mask-image: radial-gradient(circle at top calc(100% - var(--np-avatar-group-single-size) / 2) right calc(calc(100% - var(--np-avatar-group-single-size) / 1.5) * -1), transparent 0, transparent calc(calc(var(--np-avatar-group-single-size) / 2.5) + var(--np-avatar-group-horizontal-child-position)), black 0);
25
- mask-image: radial-gradient(circle at top calc(100% - var(--np-avatar-group-single-size) / 2) right calc(calc(100% - var(--np-avatar-group-single-size) / 1.5) * -1), transparent 0, transparent calc(calc(var(--np-avatar-group-single-size) / 2.5) + var(--np-avatar-group-horizontal-child-position)), black 0);
26
- }
27
- .np-avatar-group-horizontal-child {
28
- margin-left: calc(var(--np-avatar-group-horizontal-child-position) * -1);
29
- }
@@ -1,42 +0,0 @@
1
- .np-avatar-group {
2
- display: inline-flex;
3
- position: relative;
4
-
5
- &-diagonal {
6
- width: var(--np-avatar-group-size);
7
- height: var(--np-avatar-group-size);
8
-
9
- &-mask {
10
- mask-image: radial-gradient(
11
- circle at bottom calc(100% - var(--np-avatar-group-size) / 1.5)
12
- right calc(100% - var(--np-avatar-group-size) / 1.5),
13
- transparent 0,
14
- transparent calc(var(--np-avatar-group-single-size) / 2 + 0.5px),
15
- black 0
16
- );
17
- }
18
-
19
- &-child {
20
- position: absolute;
21
- top: var(--np-avatar-group-diagonal-child-position);
22
- right: 0;
23
- }
24
- }
25
-
26
- &-horizontal {
27
- height: var(--np-avatar-group-size);
28
-
29
- &-mask {
30
- mask-image: radial-gradient(
31
- circle at top calc(100% - var(--np-avatar-group-single-size) / 2)
32
- right calc(calc(100% - var(--np-avatar-group-single-size) / 1.5) * -1),
33
- transparent 0,
34
- transparent calc(calc(var(--np-avatar-group-single-size) / 2.5) + var(--np-avatar-group-horizontal-child-position)),
35
- black 0);
36
- }
37
-
38
- &-child {
39
- margin-left: calc(var(--np-avatar-group-horizontal-child-position) * -1);
40
- }
41
- }
42
- }
@@ -1,284 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import AvatarGroup, { AvatarGroupProps } from '.';
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
- const sizes: AvatarGroupProps['size'][] = [16, 24, 32, 40, 48, 56, 72];
16
-
17
- export const Diagonal: Story = storyConfig(
18
- {
19
- render: () => (
20
- <div
21
- style={{
22
- gap: '1em',
23
- display: 'grid',
24
- justifyContent: 'space-between',
25
- gridTemplate: `auto auto / repeat(${sizes.length}, min-content)`,
26
- }}
27
- >
28
- {sizes.map((size) => (
29
- <div key={size}>{size}</div>
30
- ))}
31
-
32
- {sizes.map((size) => (
33
- <AvatarGroup
34
- key={size}
35
- size={size}
36
- orientation="diagonal"
37
- avatars={[{ name: 'Jay Jay' }, { name: 'Amy Amy' }]}
38
- />
39
- ))}
40
-
41
- {sizes.map((size) => (
42
- <AvatarGroup
43
- key={size}
44
- size={size}
45
- orientation="diagonal"
46
- interactive
47
- avatars={[{ name: 'Jay Jay' }, { name: 'Amy Amy' }]}
48
- />
49
- ))}
50
-
51
- {sizes.map((size) => (
52
- <AvatarGroup
53
- key={size}
54
- size={size}
55
- orientation="diagonal"
56
- avatars={[{ asset: <Briefcase size="16" /> }, { asset: <Bank size="16" /> }]}
57
- />
58
- ))}
59
-
60
- {sizes.map((size) => (
61
- <AvatarGroup
62
- key={size}
63
- size={size}
64
- orientation="diagonal"
65
- interactive
66
- avatars={[{ asset: <Briefcase size="16" /> }, { asset: <Bank size="16" /> }]}
67
- />
68
- ))}
69
-
70
- {sizes.map((size) => (
71
- <AvatarGroup
72
- key={size}
73
- size={size}
74
- orientation="diagonal"
75
- avatars={[{ asset: <Flag code="EU" /> }, { asset: <Flag code="GB" /> }]}
76
- />
77
- ))}
78
-
79
- {sizes.map((size) => (
80
- <AvatarGroup
81
- key={size}
82
- size={size}
83
- orientation="diagonal"
84
- interactive
85
- avatars={[{ asset: <Flag code="EU" /> }, { asset: <Flag code="GB" /> }]}
86
- />
87
- ))}
88
-
89
- {sizes.map((size) => (
90
- <AvatarGroup
91
- key={size}
92
- size={size}
93
- orientation="diagonal"
94
- avatars={[{ imgSrc: './avatar-square-dude.webp' }, { imgSrc: './tapestry-01.png' }]}
95
- />
96
- ))}
97
-
98
- {sizes.map((size) => (
99
- <AvatarGroup
100
- key={size}
101
- size={size}
102
- orientation="diagonal"
103
- interactive
104
- avatars={[{ imgSrc: './avatar-square-dude.webp' }, { imgSrc: './tapestry-01.png' }]}
105
- />
106
- ))}
107
- </div>
108
- ),
109
- },
110
- { variants: ['light', 'dark'] },
111
- );
112
-
113
- export const Horizontal: Story = storyConfig(
114
- {
115
- render: () => (
116
- <div
117
- style={{
118
- gap: '1em',
119
- display: 'grid',
120
- justifyContent: 'space-between',
121
- gridTemplate: `auto auto / repeat(${sizes.length}, min-content)`,
122
- }}
123
- >
124
- {sizes.map((size) => (
125
- <div key={size}>{size}</div>
126
- ))}
127
-
128
- {sizes.map((size) => (
129
- <AvatarGroup
130
- key={size}
131
- size={size}
132
- orientation="horizontal"
133
- avatars={[{ name: 'Jay Jay' }, { name: 'Amy Amy' }]}
134
- />
135
- ))}
136
-
137
- {sizes.map((size) => (
138
- <AvatarGroup
139
- key={size}
140
- size={size}
141
- orientation="horizontal"
142
- interactive
143
- avatars={[{ name: 'Jay Jay' }, { name: 'Amy Amy' }]}
144
- />
145
- ))}
146
-
147
- {sizes.map((size) => (
148
- <AvatarGroup
149
- key={size}
150
- size={size}
151
- orientation="horizontal"
152
- avatars={[{ asset: <Briefcase size="16" /> }, { asset: <Bank size="16" /> }]}
153
- />
154
- ))}
155
-
156
- {sizes.map((size) => (
157
- <AvatarGroup
158
- key={size}
159
- size={size}
160
- orientation="horizontal"
161
- interactive
162
- avatars={[{ asset: <Briefcase size="16" /> }, { asset: <Bank size="16" /> }]}
163
- />
164
- ))}
165
-
166
- {sizes.map((size) => (
167
- <AvatarGroup
168
- key={size}
169
- size={size}
170
- orientation="horizontal"
171
- avatars={[{ asset: <Flag code="EU" /> }, { asset: <Flag code="GB" /> }]}
172
- />
173
- ))}
174
-
175
- {sizes.map((size) => (
176
- <AvatarGroup
177
- key={size}
178
- size={size}
179
- orientation="horizontal"
180
- interactive
181
- avatars={[{ asset: <Flag code="EU" /> }, { asset: <Flag code="GB" /> }]}
182
- />
183
- ))}
184
-
185
- {sizes.map((size) => (
186
- <AvatarGroup
187
- key={size}
188
- size={size}
189
- orientation="horizontal"
190
- avatars={[{ imgSrc: './avatar-square-dude.webp' }, { imgSrc: './tapestry-01.png' }]}
191
- />
192
- ))}
193
-
194
- {sizes.map((size) => (
195
- <AvatarGroup
196
- key={size}
197
- size={size}
198
- orientation="horizontal"
199
- interactive
200
- avatars={[{ imgSrc: './avatar-square-dude.webp' }, { imgSrc: './tapestry-01.png' }]}
201
- />
202
- ))}
203
- </div>
204
- ),
205
- },
206
- { variants: ['light', 'dark'] },
207
- );
208
-
209
- export const Option: Story = storyConfig(
210
- {
211
- render: () => (
212
- <RadioOption
213
- id="test"
214
- name="foo"
215
- title="Personal account"
216
- showMediaCircle={false}
217
- media={
218
- <AvatarGroup
219
- size={48}
220
- orientation="diagonal"
221
- avatars={[{ asset: 'AA' }, { asset: 'BB' }]}
222
- />
223
- }
224
- onChange={() => {}}
225
- />
226
- ),
227
- },
228
- { variants: ['light', 'dark'] },
229
- );
230
-
231
- export const EdgeInstances: Story = storyConfig(
232
- {
233
- render: () => (
234
- <>
235
- <AvatarGroup
236
- size={72}
237
- orientation="horizontal"
238
- avatars={[
239
- { asset: <Flag code="br" /> },
240
- { asset: <Flag code="eu" /> },
241
- { asset: <Flag code="us" /> },
242
- { asset: '5+' },
243
- ]}
244
- />
245
-
246
- <br />
247
-
248
- <AvatarGroup
249
- size={72}
250
- orientation="horizontal"
251
- avatars={[{ asset: <Flag code="gb" /> }, { asset: <Flag code="jp" /> }, { asset: '9+' }]}
252
- />
253
-
254
- <br />
255
-
256
- <AvatarGroup
257
- orientation="horizontal"
258
- interactive
259
- avatars={[
260
- { asset: <Flag code="eu" /> },
261
- { asset: '9+', style: { border: '1px dashed var(--color-border-neutral)' } },
262
- ]}
263
- />
264
-
265
- <br />
266
-
267
- <AvatarGroup
268
- orientation="horizontal"
269
- interactive
270
- avatars={[
271
- { imgSrc: '../avatar-squere-dude.webp' },
272
- { asset: null, style: { border: '1px dashed var(--color-border-neutral)' } },
273
- ]}
274
- />
275
- </>
276
- ),
277
- },
278
- {
279
- variants: [
280
- 'light',
281
- // 'dark'
282
- ],
283
- },
284
- );
@@ -1,117 +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 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
- }
@@ -1,2 +0,0 @@
1
- export type { Props as AvatarGroupProps } from './AvatarGroup';
2
- export { default } from './AvatarGroup';
@@ -1,42 +0,0 @@
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
- }
@@ -1,33 +0,0 @@
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
- }