@transferwise/components 46.123.1 → 46.124.0
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.
- package/build/main.css +1 -1
- package/build/styles/avatarView/AvatarView.css +1 -1
- package/build/styles/main.css +1 -1
- package/package.json +3 -3
- package/src/avatarLayout/AvatarLayout.story.tsx +53 -0
- package/src/avatarView/AvatarView.css +1 -1
- package/src/avatarView/AvatarView.less +1 -1
- package/src/avatarView/AvatarView.story.tsx +66 -0
- package/src/main.css +1 -1
package/build/main.css
CHANGED
|
@@ -948,7 +948,7 @@
|
|
|
948
948
|
}
|
|
949
949
|
.np-avatar-view .np-avatar-view-content {
|
|
950
950
|
color: #37517e;
|
|
951
|
-
color: var(--color-content-primary);
|
|
951
|
+
color: var(--color-sentiment-content-primary, var(--color-content-primary));
|
|
952
952
|
}
|
|
953
953
|
.np-avatar-view-interactive {
|
|
954
954
|
cursor: pointer;
|
package/build/styles/main.css
CHANGED
|
@@ -948,7 +948,7 @@
|
|
|
948
948
|
}
|
|
949
949
|
.np-avatar-view .np-avatar-view-content {
|
|
950
950
|
color: #37517e;
|
|
951
|
-
color: var(--color-content-primary);
|
|
951
|
+
color: var(--color-sentiment-content-primary, var(--color-content-primary));
|
|
952
952
|
}
|
|
953
953
|
.np-avatar-view-interactive {
|
|
954
954
|
cursor: pointer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "46.
|
|
3
|
+
"version": "46.124.0",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -86,9 +86,9 @@
|
|
|
86
86
|
"storybook-addon-tag-badges": "^3.0.4",
|
|
87
87
|
"storybook-addon-test-codegen": "^3.0.1",
|
|
88
88
|
"@transferwise/less-config": "3.1.2",
|
|
89
|
+
"@transferwise/neptune-css": "14.26.1",
|
|
89
90
|
"@wise/components-theming": "1.10.1",
|
|
90
|
-
"@wise/wds-configs": "0.0.0"
|
|
91
|
-
"@transferwise/neptune-css": "14.26.1"
|
|
91
|
+
"@wise/wds-configs": "0.0.0"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
94
|
"@transferwise/icons": "^3 || ^4",
|
|
@@ -4,6 +4,7 @@ import AvatarLayout, { AvatarLayoutProps } from '.';
|
|
|
4
4
|
import { Freeze, Graph, Plane, Rewards } from '@transferwise/icons';
|
|
5
5
|
import { Flag } from '@wise/art';
|
|
6
6
|
import Body from '../body';
|
|
7
|
+
import SentimentSurface from '../sentimentSurface';
|
|
7
8
|
|
|
8
9
|
export default {
|
|
9
10
|
title: 'Content/AvatarLayout',
|
|
@@ -283,3 +284,55 @@ export const EdgeInstances: Story = {
|
|
|
283
284
|
</div>
|
|
284
285
|
),
|
|
285
286
|
};
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Like [AvatarView](?path=/docs/content-avatarview--docs#sentiment-awareness), `AvatarLayout` is sentiment-aware (note: not all features are supported) and will automatically adjust its colours if wrapped inside the
|
|
290
|
+
* [SentimentSurface](?path=/docs/content-sentimentsurface--docs) component.
|
|
291
|
+
*
|
|
292
|
+
* Features like: `interactive` are not supported.
|
|
293
|
+
* Also `AvatarLayout` isn't supported on `"elevated"` state of `SentimentSurface`.
|
|
294
|
+
*/
|
|
295
|
+
export const SentimentAwareness: Story = {
|
|
296
|
+
parameters: {
|
|
297
|
+
docs: {
|
|
298
|
+
canvas: {
|
|
299
|
+
sourceState: 'hidden',
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
render: (args) => (
|
|
304
|
+
<>
|
|
305
|
+
{(['success', 'warning', 'negative', 'neutral', 'proposition'] as const).map((sentiment) =>
|
|
306
|
+
<SentimentSurface
|
|
307
|
+
key={`${sentiment}-base`}
|
|
308
|
+
sentiment={sentiment}
|
|
309
|
+
emphasis="base"
|
|
310
|
+
className="p-a-1 d-flex"
|
|
311
|
+
style={{ gap: 'var(--size-16)' }}
|
|
312
|
+
>
|
|
313
|
+
<AvatarLayout avatars={[{ asset: <Freeze /> }, { asset: <Freeze /> }]} />
|
|
314
|
+
<AvatarLayout
|
|
315
|
+
orientation="diagonal"
|
|
316
|
+
avatars={[{ asset: <Freeze /> }, { asset: <Freeze /> }]}
|
|
317
|
+
/>
|
|
318
|
+
</SentimentSurface>
|
|
319
|
+
)}
|
|
320
|
+
</>
|
|
321
|
+
),
|
|
322
|
+
decorators: [
|
|
323
|
+
(Story: () => JSX.Element) => (
|
|
324
|
+
<div
|
|
325
|
+
style={{
|
|
326
|
+
width: '100%',
|
|
327
|
+
display: 'grid',
|
|
328
|
+
gridTemplateColumns: 'min-content min-content',
|
|
329
|
+
justifyContent: 'center',
|
|
330
|
+
gap: '1rem',
|
|
331
|
+
maxWidth: '800px',
|
|
332
|
+
}}
|
|
333
|
+
>
|
|
334
|
+
<Story />
|
|
335
|
+
</div>
|
|
336
|
+
),
|
|
337
|
+
],
|
|
338
|
+
};
|
|
@@ -17,12 +17,15 @@ import {
|
|
|
17
17
|
Transport,
|
|
18
18
|
Wallet,
|
|
19
19
|
Water,
|
|
20
|
+
Bank,
|
|
21
|
+
GiftBox,
|
|
20
22
|
} from '@transferwise/icons';
|
|
21
23
|
import AvatarView, { AvatarViewProps } from '.';
|
|
22
24
|
import { Flag } from '@wise/art';
|
|
23
25
|
import { getBrandColorFromSeed, getInitials, ProfileType } from '../common';
|
|
24
26
|
import Display from '../display';
|
|
25
27
|
import Body from '../body';
|
|
28
|
+
import SentimentSurface from '../sentimentSurface';
|
|
26
29
|
|
|
27
30
|
export default {
|
|
28
31
|
title: 'Content/AvatarView',
|
|
@@ -35,6 +38,20 @@ const profileName1 = 'Wolter White';
|
|
|
35
38
|
const profileName2 = 'Tyler Durden';
|
|
36
39
|
const sizes: AvatarViewProps['size'][] = [16, 24, 32, 40, 48, 56, 72];
|
|
37
40
|
|
|
41
|
+
const withComponentGrid = (Story: () => JSX.Element) => (
|
|
42
|
+
<div
|
|
43
|
+
style={{
|
|
44
|
+
width: '100%',
|
|
45
|
+
display: 'flex',
|
|
46
|
+
flexDirection: 'column',
|
|
47
|
+
gap: '1rem',
|
|
48
|
+
maxWidth: '800px',
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
<Story />
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
|
|
38
55
|
export const Selected: Story = {
|
|
39
56
|
render: () => {
|
|
40
57
|
return (
|
|
@@ -420,6 +437,55 @@ export const Profiles: Story = {
|
|
|
420
437
|
},
|
|
421
438
|
};
|
|
422
439
|
|
|
440
|
+
/**
|
|
441
|
+
* `AvatarView` is sentiment-aware (note: not all features are supported) and will automatically adjust its colours if wrapped inside the
|
|
442
|
+
* [SentimentSurface](?path=/docs/content-sentimentsurface--docs) component.
|
|
443
|
+
*
|
|
444
|
+
* Features like `online`, `notification`, `selected`, and `interactive` are not supported.
|
|
445
|
+
* For badge (`<AvatarView badge={}>`) only `flagCode` is supported.
|
|
446
|
+
* Also `AvatarView` isn't supported on `"elevated"` state of `SentimentSurface`.
|
|
447
|
+
*/
|
|
448
|
+
export const SentimentAwareness: Story = {
|
|
449
|
+
parameters: {
|
|
450
|
+
docs: {
|
|
451
|
+
canvas: {
|
|
452
|
+
sourceState: 'hidden',
|
|
453
|
+
},
|
|
454
|
+
source: { type: 'code' },
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
render: () => {
|
|
458
|
+
return (
|
|
459
|
+
<>
|
|
460
|
+
{(['success', 'warning', 'negative', 'neutral', 'proposition'] as const).map((sentiment) => (
|
|
461
|
+
<SentimentSurface
|
|
462
|
+
key={`${sentiment}-base`}
|
|
463
|
+
sentiment={sentiment}
|
|
464
|
+
emphasis="base"
|
|
465
|
+
className="p-a-1 d-flex"
|
|
466
|
+
style={{ gap: 'var(--size-16)' }}
|
|
467
|
+
>
|
|
468
|
+
<AvatarView size={32}>
|
|
469
|
+
<Bank />
|
|
470
|
+
</AvatarView>
|
|
471
|
+
<AvatarView size={32} profileName="John Doe" />
|
|
472
|
+
<AvatarView size={32}>
|
|
473
|
+
<Flag code="JPY" intrinsicSize={32} />
|
|
474
|
+
</AvatarView>
|
|
475
|
+
<AvatarView size={32} badge={sentiment === 'proposition' ? undefined : { status: sentiment }}>
|
|
476
|
+
<Bank />
|
|
477
|
+
</AvatarView>
|
|
478
|
+
<AvatarView size={32} badge={{ flagCode: 'eu' }}>
|
|
479
|
+
<Bank />
|
|
480
|
+
</AvatarView>
|
|
481
|
+
</SentimentSurface>
|
|
482
|
+
))}
|
|
483
|
+
</>
|
|
484
|
+
);
|
|
485
|
+
},
|
|
486
|
+
decorators: [withComponentGrid],
|
|
487
|
+
};
|
|
488
|
+
|
|
423
489
|
export const ProfileBrokenImageFallback: Story = {
|
|
424
490
|
parameters: {
|
|
425
491
|
chromatic: {
|
package/src/main.css
CHANGED
|
@@ -948,7 +948,7 @@
|
|
|
948
948
|
}
|
|
949
949
|
.np-avatar-view .np-avatar-view-content {
|
|
950
950
|
color: #37517e;
|
|
951
|
-
color: var(--color-content-primary);
|
|
951
|
+
color: var(--color-sentiment-content-primary, var(--color-content-primary));
|
|
952
952
|
}
|
|
953
953
|
.np-avatar-view-interactive {
|
|
954
954
|
cursor: pointer;
|