@transferwise/components 0.0.0-experimental-bb32303 → 0.0.0-experimental-d11e9c5

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 (130) 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 +163 -0
  6. package/build/avatarView/AvatarView.js.map +1 -0
  7. package/build/avatarView/AvatarView.mjs +161 -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 +3 -1
  18. package/build/badge/Badge.js.map +1 -1
  19. package/build/badge/Badge.mjs +3 -1
  20. package/build/badge/Badge.mjs.map +1 -1
  21. package/build/badge/BadgeAssets.js +85 -0
  22. package/build/badge/BadgeAssets.js.map +1 -0
  23. package/build/badge/BadgeAssets.mjs +83 -0
  24. package/build/badge/BadgeAssets.mjs.map +1 -0
  25. package/build/button/Button.js.map +1 -1
  26. package/build/button/Button.mjs.map +1 -1
  27. package/build/button/legacyUtils/legacyUtils.js.map +1 -1
  28. package/build/button/legacyUtils/legacyUtils.mjs.map +1 -1
  29. package/build/common/circle/Circle.js +17 -1
  30. package/build/common/circle/Circle.js.map +1 -1
  31. package/build/common/circle/Circle.mjs +17 -1
  32. package/build/common/circle/Circle.mjs.map +1 -1
  33. package/build/i18n/th.json +5 -0
  34. package/build/i18n/th.json.js +5 -0
  35. package/build/i18n/th.json.js.map +1 -1
  36. package/build/i18n/th.json.mjs +5 -0
  37. package/build/i18n/th.json.mjs.map +1 -1
  38. package/build/index.js +128 -121
  39. package/build/index.js.map +1 -1
  40. package/build/index.mjs +33 -29
  41. package/build/index.mjs.map +1 -1
  42. package/build/main.css +109 -5
  43. package/build/styles/avatarGroup/AvatarGroup.css +29 -0
  44. package/build/styles/avatarView/AvatarView.css +42 -0
  45. package/build/styles/avatarView/NotificationDot.css +20 -0
  46. package/build/styles/badge/Badge.css +6 -5
  47. package/build/styles/common/circle/Circle.css +32 -0
  48. package/build/styles/main.css +109 -5
  49. package/build/types/avatar/Avatar.d.ts +3 -0
  50. package/build/types/avatar/Avatar.d.ts.map +1 -1
  51. package/build/types/avatarGroup/AvatarGroup.d.ts +18 -0
  52. package/build/types/avatarGroup/AvatarGroup.d.ts.map +1 -0
  53. package/build/types/avatarGroup/index.d.ts +3 -0
  54. package/build/types/avatarGroup/index.d.ts.map +1 -0
  55. package/build/types/avatarView/AvatarView.d.ts +19 -0
  56. package/build/types/avatarView/AvatarView.d.ts.map +1 -0
  57. package/build/types/avatarView/NotificationDot.d.ts +8 -0
  58. package/build/types/avatarView/NotificationDot.d.ts.map +1 -0
  59. package/build/types/avatarView/index.d.ts +3 -0
  60. package/build/types/avatarView/index.d.ts.map +1 -0
  61. package/build/types/avatarWrapper/AvatarWrapper.d.ts +3 -0
  62. package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
  63. package/build/types/badge/Badge.d.ts +5 -1
  64. package/build/types/badge/Badge.d.ts.map +1 -1
  65. package/build/types/badge/BadgeAssets.d.ts +15 -0
  66. package/build/types/badge/BadgeAssets.d.ts.map +1 -0
  67. package/build/types/badge/index.d.ts +2 -0
  68. package/build/types/badge/index.d.ts.map +1 -1
  69. package/build/types/button/Button.d.ts +1 -1
  70. package/build/types/button/Button.d.ts.map +1 -1
  71. package/build/types/button/legacyUtils/legacyUtils.d.ts +2 -2
  72. package/build/types/button/legacyUtils/legacyUtils.d.ts.map +1 -1
  73. package/build/types/common/circle/Circle.d.ts +2 -0
  74. package/build/types/common/circle/Circle.d.ts.map +1 -1
  75. package/build/types/index.d.ts +3 -1
  76. package/build/types/index.d.ts.map +1 -1
  77. package/package.json +3 -4
  78. package/src/avatar/Avatar.tsx +3 -0
  79. package/src/avatarGroup/AvatarGroup.css +29 -0
  80. package/src/avatarGroup/AvatarGroup.less +42 -0
  81. package/src/avatarGroup/AvatarGroup.story.tsx +284 -0
  82. package/src/avatarGroup/AvatarGroup.tsx +117 -0
  83. package/src/avatarGroup/index.ts +2 -0
  84. package/src/avatarView/AvatarView.css +42 -0
  85. package/src/avatarView/AvatarView.less +33 -0
  86. package/src/avatarView/AvatarView.story.tsx +425 -0
  87. package/src/avatarView/AvatarView.tsx +141 -0
  88. package/src/avatarView/NotificationDot.css +20 -0
  89. package/src/avatarView/NotificationDot.less +24 -0
  90. package/src/avatarView/NotificationDot.tsx +35 -0
  91. package/src/avatarView/index.ts +2 -0
  92. package/src/avatarWrapper/AvatarWrapper.tsx +3 -0
  93. package/src/badge/Badge.css +6 -5
  94. package/src/badge/Badge.less +4 -3
  95. package/src/badge/Badge.tsx +8 -1
  96. package/src/badge/BadgeAssets.tsx +65 -0
  97. package/src/badge/index.ts +3 -0
  98. package/src/button/{Button.spec.tsx → Button.spec.js} +2 -3
  99. package/src/button/Button.tsx +1 -1
  100. package/src/button/legacyUtils/{legacyUtils.spec.tsx → legacyUtils.spec.js} +1 -1
  101. package/src/button/legacyUtils/legacyUtils.ts +2 -2
  102. package/src/common/circle/Circle.css +32 -0
  103. package/src/common/circle/Circle.less +35 -0
  104. package/src/common/circle/Circle.tsx +22 -1
  105. package/src/decision/Decision.story.tsx +10 -46
  106. package/src/flowNavigation/FlowNavigation.story.tsx +10 -48
  107. package/src/i18n/th.json +5 -0
  108. package/src/index.ts +4 -0
  109. package/src/listItem/ListItem.story.tsx +5 -43
  110. package/src/main.css +109 -5
  111. package/src/main.less +2 -0
  112. package/src/modal/{Modal.rtl.spec.tsx → Modal.rtl.spec.js} +7 -8
  113. package/src/navigationOption/NavigationOption.story.tsx +14 -65
  114. package/src/overlayHeader/OverlayHeader.story.tsx +5 -10
  115. package/src/radio/Radio.story.tsx +5 -5
  116. package/src/radioGroup/RadioGroup.story.tsx +3 -3
  117. package/src/selectOption/SelectOption.story.tsx +31 -30
  118. package/src/slidingPanel/SlidingPanel.spec.js +1 -1
  119. package/src/ssr.spec.js +256 -0
  120. package/src/test-utils/{index.tsx → index.js} +6 -11
  121. package/src/test-utils/{jest.setup.ts → jest.setup.js} +8 -13
  122. package/src/tile/Tile.story.tsx +2 -6
  123. package/build/types/test-utils/index.d.ts +0 -158
  124. package/build/types/test-utils/index.d.ts.map +0 -1
  125. package/build/types/test-utils/jest.setup.d.ts +0 -2
  126. package/build/types/test-utils/jest.setup.d.ts.map +0 -1
  127. package/src/ssr.spec.tsx +0 -264
  128. /package/src/button/__snapshots__/{Button.spec.tsx.snap → Button.spec.js.snap} +0 -0
  129. /package/src/dimmer/{Dimmer.rtl.spec.tsx → Dimmer.rtl.spec.js} +0 -0
  130. /package/src/info/{Info.spec.jsx → Info.spec.js} +0 -0
@@ -1,15 +1,13 @@
1
1
  /* eslint-disable react/jsx-child-element-spacing */
2
2
 
3
3
  import { action } from '@storybook/addon-actions';
4
- import { Documents } from '@transferwise/icons';
4
+ import { Documents, FastFlag } from '@transferwise/icons';
5
5
  import { ComponentProps } from 'react';
6
6
 
7
7
  import ActionButton from '../actionButton/ActionButton';
8
- import Avatar from '../avatar';
9
- import Badge from '../badge';
8
+ import AvatarView from '../avatarView';
10
9
  import Info from '../info';
11
10
  import Title from '../title/Title';
12
-
13
11
  import ListItem, { List } from '.';
14
12
 
15
13
  export default {
@@ -42,13 +40,7 @@ export const Variants = () => {
42
40
  <List>
43
41
  <Template
44
42
  media={
45
- <Avatar>
46
- <img
47
- style={{ width: 32, height: 32 }}
48
- src="https://wise.com/public-resources/assets/balances/savings-emoji/google/✈️.png"
49
- alt=""
50
- />
51
- </Avatar>
43
+ <AvatarView imgSrc="https://wise.com/web-art/assets/illustrations/heart-small@2x.webp" />
52
44
  }
53
45
  />
54
46
  </List>
@@ -59,22 +51,7 @@ export const Variants = () => {
59
51
  <Template
60
52
  title="Sandra Pepper"
61
53
  value="Personal account"
62
- media={
63
- <Badge
64
- badge={
65
- <img
66
- src="https://wise.com/public-resources/assets/brand/fast_flag_badge_personal.svg"
67
- alt=""
68
- height="24px"
69
- width="24px"
70
- />
71
- }
72
- >
73
- <Avatar type="initials" size="md">
74
- <span aria-hidden>SP</span>
75
- </Avatar>
76
- </Badge>
77
- }
54
+ media={<AvatarView name="Super Pepa" badge={{ icon: <FastFlag /> }} />}
78
55
  />
79
56
  </List>
80
57
  </div>
@@ -84,22 +61,7 @@ export const Variants = () => {
84
61
  <Template
85
62
  title="Account holder"
86
63
  value="Sandra Pepper"
87
- media={
88
- <Badge
89
- badge={
90
- <img
91
- src="https://wise.com/public-resources/assets/brand/fast_flag_badge_personal.svg"
92
- alt=""
93
- height="24px"
94
- width="24px"
95
- />
96
- }
97
- >
98
- <Avatar type="initials" size="md">
99
- <span aria-hidden>SP</span>
100
- </Avatar>
101
- </Badge>
102
- }
64
+ media={<AvatarView name="Super Pepa" badge={{ icon: <FastFlag /> }} />}
103
65
  action={<ActionButton>Share details</ActionButton>}
104
66
  />
105
67
  </List>
package/src/main.css CHANGED
@@ -469,6 +469,77 @@ div.critical-comms .critical-comms-body {
469
469
  .np-theme-personal .tw-avatar--outlined:not(.disabled):not(:disabled):hover {
470
470
  border-color: var(--color-interactive-primary-hover);
471
471
  }
472
+ .np-notification-dot {
473
+ --np-notification-dot-size: 14px;
474
+ position: relative;
475
+ display: inline-block;
476
+ }
477
+ .np-notification-dot-mask {
478
+ -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);
479
+ 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);
480
+ -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);
481
+ 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);
482
+ }
483
+ .np-notification-dot-badge {
484
+ position: absolute;
485
+ width: var(--np-notification-dot-size);
486
+ height: var(--np-notification-dot-size);
487
+ background-color: var(--color-sentiment-negative);
488
+ border-radius: 9999px;
489
+ border-radius: var(--radius-full);
490
+ right: 0;
491
+ }
492
+ .np-avatar-view .np-avatar-view-content {
493
+ color: var(--color-interactive-primary);
494
+ }
495
+ .np-avatar-view-interactive {
496
+ cursor: pointer;
497
+ }
498
+ .np-avatar-view-interactive .np-circle {
499
+ background-color: rgba(134,167,189,0.10196);
500
+ background-color: var(--color-background-neutral);
501
+ }
502
+ .np-avatar-view-interactive:hover {
503
+ background-color: var(--color-background-neutral-hover);
504
+ }
505
+ .np-avatar-view-interactive:active {
506
+ background-color: var(--color-background-neutral-active);
507
+ }
508
+ .np-avatar-view-non-interactive .np-circle {
509
+ background-color: transparent;
510
+ }
511
+ .np-avatar-view-non-interactive .np-avatar-view-content .wds-flag {
512
+ box-shadow: none;
513
+ }
514
+ .np-avatar-group {
515
+ display: inline-flex;
516
+ position: relative;
517
+ }
518
+ .np-avatar-group-diagonal {
519
+ width: var(--np-avatar-group-size);
520
+ height: var(--np-avatar-group-size);
521
+ }
522
+ .np-avatar-group-diagonal-mask {
523
+ -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);
524
+ 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);
525
+ }
526
+ .np-avatar-group-diagonal-child {
527
+ position: absolute;
528
+ top: var(--np-avatar-group-diagonal-child-position);
529
+ right: 0;
530
+ }
531
+ .np-avatar-group-horizontal {
532
+ height: var(--np-avatar-group-size);
533
+ }
534
+ .np-avatar-group-horizontal-mask {
535
+ -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);
536
+ 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);
537
+ -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);
538
+ 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);
539
+ }
540
+ .np-avatar-group-horizontal-child {
541
+ margin-left: calc(var(--np-avatar-group-horizontal-child-position) * -1);
542
+ }
472
543
  .tw-badge {
473
544
  position: relative;
474
545
  display: inline-block;
@@ -476,6 +547,7 @@ div.critical-comms .critical-comms-body {
476
547
  --badge-mask: 2px;
477
548
  --badge-mask-offset: calc(var(--badge-size) / 2);
478
549
  --badge-border-color: rgba(255, 255, 255, 0.08);
550
+ --badge-content-position: 0px;
479
551
  }
480
552
  .tw-badge.tw-badge-lg {
481
553
  --badge-size: 24px;
@@ -485,8 +557,8 @@ div.critical-comms .critical-comms-body {
485
557
  --badge-border-color: rgba(0, 0, 0, 0.08);
486
558
  }
487
559
  .tw-badge > .tw-badge__children {
488
- -webkit-mask-image: radial-gradient(circle at top calc(100% - var(--badge-mask-offset)) left calc(100% - var(--badge-mask-offset)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
489
- mask-image: radial-gradient(circle at top calc(100% - var(--badge-mask-offset)) left calc(100% - var(--badge-mask-offset)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
560
+ -webkit-mask-image: radial-gradient(circle at top calc(100% - var(--badge-mask-offset) - var(--badge-content-position)) left calc(100% - var(--badge-mask-offset) - var(--badge-content-position)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
561
+ mask-image: radial-gradient(circle at top calc(100% - var(--badge-mask-offset) - var(--badge-content-position)) left calc(100% - var(--badge-mask-offset) - var(--badge-content-position)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
490
562
  }
491
563
  [dir="rtl"] .tw-badge > .tw-badge__children {
492
564
  -webkit-mask-image: radial-gradient(circle at top calc(100% - var(--badge-mask-offset)) right calc(100% - var(--badge-mask-offset)), transparent 0, transparent calc(var(--badge-size) / 2 + var(--badge-mask)), black calc(var(--badge-size) / 2 + var(--badge-mask) + 0.5px));
@@ -496,8 +568,8 @@ div.critical-comms .critical-comms-body {
496
568
  position: absolute;
497
569
  width: var(--badge-size);
498
570
  height: var(--badge-size);
499
- bottom: 0;
500
- right: 0;
571
+ bottom: var(--badge-content-position);
572
+ right: var(--badge-content-position);
501
573
  box-sizing: border-box;
502
574
  border-radius: 50%;
503
575
  text-align: center;
@@ -510,7 +582,7 @@ div.critical-comms .critical-comms-body {
510
582
  user-select: none;
511
583
  }
512
584
  [dir="rtl"] .tw-badge > .tw-badge__content {
513
- left: 0;
585
+ left: var(--badge-content-position);
514
586
  right: auto;
515
587
  right: initial;
516
588
  }
@@ -1211,11 +1283,43 @@ div.critical-comms .critical-comms-body {
1211
1283
  width: var(--circle-size);
1212
1284
  height: var(--circle-size);
1213
1285
  flex-shrink: 0;
1286
+ --circle-border-color: var(--color-border-neutral);
1287
+ --circle-border-width: 1px;
1288
+ font-size: var(--circle-font-size);
1289
+ font-weight: 600;
1290
+ font-weight: var(--font-weight-semi-bold);
1291
+ line-height: 1;
1292
+ }
1293
+ .np-circle .np-display {
1294
+ font-size: var(--circle-font-size);
1214
1295
  }
1215
1296
  .np-circle .tw-icon > svg {
1216
1297
  height: var(--circle-icon-size);
1217
1298
  width: var(--circle-icon-size);
1218
1299
  }
1300
+ .np-circle img,
1301
+ .np-circle .wds-flag {
1302
+ border-radius: 9999px;
1303
+ border-radius: var(--radius-full);
1304
+ width: 100%;
1305
+ height: 100%;
1306
+ -o-object-fit: cover;
1307
+ object-fit: cover;
1308
+ }
1309
+ .np-circle-border {
1310
+ position: relative;
1311
+ }
1312
+ .np-circle-border::after {
1313
+ content: "";
1314
+ position: absolute;
1315
+ top: 0;
1316
+ left: 0;
1317
+ width: 100%;
1318
+ height: 100%;
1319
+ border-radius: 9999px;
1320
+ border-radius: var(--radius-full);
1321
+ box-shadow: inset 0 0 0 var(--circle-border-width) var(--circle-border-color);
1322
+ }
1219
1323
  .np-bottom-sheet {
1220
1324
  border-radius: 10px 10px 0 0;
1221
1325
  }
package/src/main.less CHANGED
@@ -3,6 +3,8 @@
3
3
  @import "./actionButton/ActionButton.less";
4
4
  @import "./alert/Alert.less";
5
5
  @import "./avatar/Avatar.less";
6
+ @import "./avatarView/AvatarView.less";
7
+ @import "./avatarGroup/AvatarGroup.less";
6
8
  @import "./badge/Badge.less";
7
9
  @import "./button/Button.less";
8
10
  @import "./card/Card.less";
@@ -1,16 +1,15 @@
1
1
  import { Position } from '../common';
2
2
  import { render, fireEvent, screen, mockMatchMedia } from '../test-utils';
3
3
 
4
- import Modal, { ModalProps } from './Modal';
4
+ import Modal from './Modal';
5
5
 
6
6
  mockMatchMedia();
7
7
 
8
8
  describe('Modal', () => {
9
- const props: ModalProps = {
9
+ const props = {
10
10
  onClose: jest.fn(),
11
11
  body: 'Some body',
12
12
  position: Position.TOP,
13
- open: true,
14
13
  };
15
14
 
16
15
  beforeEach(() => {
@@ -18,14 +17,14 @@ describe('Modal', () => {
18
17
  });
19
18
 
20
19
  it(`doesn't calls onClose when click is inside modal`, () => {
21
- render(<Modal {...props} />);
20
+ render(<Modal {...props} open />);
22
21
 
23
22
  fireEvent.click(getDialog());
24
23
  expect(props.onClose).not.toHaveBeenCalled();
25
24
  });
26
25
 
27
26
  it('calls onClose if click outside the content', () => {
28
- render(<Modal {...props} />);
27
+ render(<Modal {...props} open />);
29
28
  expect(props.onClose).not.toHaveBeenCalled();
30
29
 
31
30
  fireEvent.click(screen.getByRole('presentation'));
@@ -33,7 +32,7 @@ describe('Modal', () => {
33
32
  });
34
33
 
35
34
  it("doesn't call onClose if click outside the content and closing on dimmer is disabled", () => {
36
- render(<Modal {...props} disableDimmerClickToClose />);
35
+ render(<Modal {...props} open disableDimmerClickToClose />);
37
36
 
38
37
  fireEvent.click(screen.getByRole('presentation'));
39
38
 
@@ -41,7 +40,7 @@ describe('Modal', () => {
41
40
  });
42
41
 
43
42
  it('calls onClose when Escape is pressed on Modal', () => {
44
- render(<Modal {...props} />);
43
+ render(<Modal {...props} open />);
45
44
  expect(props.onClose).not.toHaveBeenCalled();
46
45
 
47
46
  fireEvent.keyDown(getDialog(), { key: 'Escape' });
@@ -49,7 +48,7 @@ describe('Modal', () => {
49
48
  });
50
49
 
51
50
  it('calls onClose when Escape is pressed on document', () => {
52
- render(<Modal {...props} />);
51
+ render(<Modal {...props} open />);
53
52
  expect(props.onClose).not.toHaveBeenCalled();
54
53
 
55
54
  fireEvent.keyDown(document, { key: 'Escape' });
@@ -4,13 +4,13 @@ import { text, boolean } from '@storybook/addon-knobs';
4
4
  import {
5
5
  FastFlag as FastFlagIcon,
6
6
  Bank as BankIcon,
7
- PlusCircle,
8
- Profile,
9
7
  UpwardGraph as UpwardGraphIcon,
8
+ Plus as PlusIcon,
9
+ FastFlag,
10
10
  } from '@transferwise/icons';
11
11
  import { Illustration, Assets, Flag } from '@wise/art';
12
12
 
13
- import { Badge, Nudge, Avatar, Header, Title, Typography } from '..';
13
+ import { Nudge, Header, Title, Typography, AvatarView } from '..';
14
14
 
15
15
  import NavigationOption from './NavigationOption';
16
16
 
@@ -82,37 +82,13 @@ export const Variants = () => (
82
82
  </div>
83
83
  <div className="m-b-2">
84
84
  <div className="title-4 m-b-1">With Icon Avatar</div>
85
- <Template
86
- showMediaCircle={false}
87
- media={
88
- <Badge badge={<PlusCircle className="tw-contacts__new-contact-badge" />}>
89
- <Avatar type="icon">
90
- <Profile size="24" />
91
- </Avatar>
92
- </Badge>
93
- }
94
- />
85
+ <Template showMediaCircle={false} media={<AvatarView badge={{ icon: <PlusIcon /> }} />} />
95
86
  </div>
96
87
  <div className="m-b-2">
97
88
  <div className="title-4 m-b-1">With Contact Avatar</div>
98
89
  <Template
99
90
  showMediaCircle={false}
100
- media={
101
- <Badge
102
- badge={
103
- <img
104
- src="https://wise.com/public-resources/assets/brand/fast_flag_badge_personal.svg"
105
- alt=""
106
- height="24px"
107
- width="24px"
108
- />
109
- }
110
- >
111
- <Avatar type="initials" size="md">
112
- <span aria-hidden>SP</span>
113
- </Avatar>
114
- </Badge>
115
- }
91
+ media={<AvatarView name="Super Pepa" badge={{ icon: <FastFlag /> }} />}
116
92
  />
117
93
  </div>
118
94
  <div className="m-t-4 m-b-2">
@@ -124,22 +100,7 @@ export const Variants = () => (
124
100
  </p>
125
101
  <Template
126
102
  showMediaCircle
127
- media={
128
- <Badge
129
- badge={
130
- <img
131
- src="https://wise.com/public-resources/assets/brand/fast_flag_badge_personal.svg"
132
- alt=""
133
- height="24px"
134
- width="24px"
135
- />
136
- }
137
- >
138
- <Avatar type="initials" size="md">
139
- <span aria-hidden>SP</span>
140
- </Avatar>
141
- </Badge>
142
- }
103
+ media={<AvatarView name="Super Pepa" badge={{ icon: <FastFlag /> }} />}
143
104
  />
144
105
  </div>
145
106
  </>
@@ -222,9 +183,9 @@ export const BalanceContent = () => (
222
183
  content="British pound"
223
184
  showMediaCircle={false}
224
185
  media={
225
- <Avatar type="icon">
186
+ <AvatarView>
226
187
  <Flag code="GBP" />
227
- </Avatar>
188
+ </AvatarView>
228
189
  }
229
190
  />
230
191
  );
@@ -233,13 +194,7 @@ export const NewContactContent = () => (
233
194
  <NavigationOptionTemplate
234
195
  title="New Contact"
235
196
  showMediaCircle={false}
236
- media={
237
- <Badge badge={<PlusCircle className="tw-contacts__new-contact-badge" />}>
238
- <Avatar type="icon">
239
- <Profile size="24" />
240
- </Avatar>
241
- </Badge>
242
- }
197
+ media={<AvatarView badge={{ type: 'action' }} />}
243
198
  />
244
199
  );
245
200
 
@@ -248,13 +203,7 @@ export const ExistingContactContent = () => (
248
203
  title="Wise Customer"
249
204
  content="EUR account ending in 1111"
250
205
  showMediaCircle={false}
251
- media={
252
- <Badge badge={<Flag code="EUR" />}>
253
- <Avatar type="initials" size="md">
254
- <span aria-hidden>WS</span>
255
- </Avatar>
256
- </Badge>
257
- }
206
+ media={<AvatarView name="Wise Steve" badge={{ flagCode: 'EUR' }} />}
258
207
  />
259
208
  );
260
209
 
@@ -280,9 +229,9 @@ export const ManageAccountContent = () => (
280
229
  content="View and share your account details to get paid."
281
230
  showMediaCircle={false}
282
231
  media={
283
- <Avatar type="icon">
232
+ <AvatarView>
284
233
  <BankIcon size={24} />
285
- </Avatar>
234
+ </AvatarView>
286
235
  }
287
236
  />
288
237
  <NavigationOptionTemplate
@@ -290,9 +239,9 @@ export const ManageAccountContent = () => (
290
239
  content="Convert money between your balances at your desired exchange rate."
291
240
  showMediaCircle={false}
292
241
  media={
293
- <Avatar type="icon">
242
+ <AvatarView>
294
243
  <UpwardGraphIcon size={24} />
295
- </Avatar>
244
+ </AvatarView>
296
245
  }
297
246
  />
298
247
  </>
@@ -2,9 +2,8 @@ import { action } from '@storybook/addon-actions';
2
2
  import { select, text } from '@storybook/addon-knobs';
3
3
  import { Person as ProfileIcon, Briefcase as BriefcaseIcon } from '@transferwise/icons';
4
4
 
5
- import Avatar, { AvatarType } from '../avatar';
6
- import AvatarWrapper from '../avatarWrapper';
7
- import { ProfileType, Size } from '../common';
5
+ import AvatarView from '../avatarView';
6
+ import { ProfileType } from '../common';
8
7
  import Logo from '../logo';
9
8
 
10
9
  import OverlayHeader from './OverlayHeader';
@@ -29,11 +28,7 @@ export const Basic = () => {
29
28
  return (
30
29
  <OverlayHeader
31
30
  logo={<Logo />}
32
- avatar={
33
- <Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
34
- {avatarProfiles[showAvatar]}
35
- </Avatar>
36
- }
31
+ avatar={<AvatarView>{avatarProfiles[showAvatar]}</AvatarView>}
37
32
  onClose={action('Close clicked')}
38
33
  />
39
34
  );
@@ -46,13 +41,13 @@ export const WithAvatarWrapper = () => {
46
41
  );
47
42
  const profileType = select(
48
43
  'profileType',
49
- Object.keys(ProfileType) as `${ProfileType}`[],
44
+ [ProfileType.PERSONAL, ProfileType.BUSINESS],
50
45
  undefined,
51
46
  );
52
47
  return (
53
48
  <OverlayHeader
54
49
  logo={<Logo />}
55
- avatar={<AvatarWrapper url={avatarURL} profileType={profileType} />}
50
+ avatar={<AvatarView imgSrc={avatarURL} type={profileType?.toLowerCase()} />}
56
51
  onClose={action('Close clicked')}
57
52
  />
58
53
  );
@@ -2,7 +2,7 @@ import { boolean, text } from '@storybook/addon-knobs';
2
2
  import { Flag } from '@wise/art';
3
3
  import { useState } from 'react';
4
4
 
5
- import Avatar, { AvatarType } from '../avatar';
5
+ import AvatarView from '../avatarView';
6
6
  import Checkbox from '../checkbox';
7
7
 
8
8
  import Radio from './Radio';
@@ -32,9 +32,9 @@ export const Basic = () => {
32
32
  disabled={disabled}
33
33
  avatar={
34
34
  showAvatar ? (
35
- <Avatar type={AvatarType.THUMBNAIL}>
35
+ <AvatarView>
36
36
  <Flag code="IMP" />
37
- </Avatar>
37
+ </AvatarView>
38
38
  ) : null
39
39
  }
40
40
  onChange={() => setChecked(!checked)}
@@ -50,9 +50,9 @@ export const Basic = () => {
50
50
  secondary={secondary}
51
51
  avatar={
52
52
  showAvatar ? (
53
- <Avatar type={AvatarType.THUMBNAIL}>
53
+ <AvatarView>
54
54
  <Flag code="KES" />
55
- </Avatar>
55
+ </AvatarView>
56
56
  ) : null
57
57
  }
58
58
  onChange={() => setChecked(!checked)}
@@ -1,6 +1,6 @@
1
1
  import { Flag } from '@wise/art';
2
2
 
3
- import Avatar, { AvatarType } from '../avatar';
3
+ import AvatarView from '../avatarView';
4
4
 
5
5
  import RadioGroup, { RadioGroupProps, RadioGroupRadio } from './RadioGroup';
6
6
  import { Field } from '../field/Field';
@@ -52,9 +52,9 @@ export const WithAvatars = {
52
52
  ({
53
53
  ...radio,
54
54
  avatar: (
55
- <Avatar type={AvatarType.THUMBNAIL}>
55
+ <AvatarView>
56
56
  <Flag code="NZD" />
57
- </Avatar>
57
+ </AvatarView>
58
58
  ),
59
59
  }) satisfies RadioGroupRadio,
60
60
  ),
@@ -8,8 +8,7 @@ import SelectOption, {
8
8
  import { Bank, BankTransfer, Beach, Briefcase, Card, Plane } from '@transferwise/icons';
9
9
  import { Field } from '../field/Field';
10
10
  import { lorem10 } from '../test-utils';
11
- import Badge from '../badge';
12
- import Avatar from '../avatar';
11
+ import AvatarView from '../avatarView';
13
12
  import { Sentiment } from '../common';
14
13
  import { useState } from 'react';
15
14
 
@@ -116,57 +115,59 @@ const paymentMethods: SelectOptiopsSection<CustomData>[] = [
116
115
  ];
117
116
 
118
117
  const balances: SelectOptiopsSection[] = [
119
- {
120
- title: 'Balances',
121
- options: [
122
- {
123
- media: <Flag code="gbp" />,
124
- title: 'Wise GBP balance',
125
- },
126
- {
127
- media: <Flag code="eur" />,
128
- title: 'Wise EUR balance',
129
- },
130
- ],
131
- },
132
118
  {
133
119
  title: 'Jars',
134
120
  options: [
135
121
  {
136
122
  media: (
137
- <Badge badge={<Flag code="usd" />} size="md">
138
- <Avatar type="icon" size="md" backgroundColor="var(--color-bright-pink)">
139
- <Beach size="24" />
140
- </Avatar>
141
- </Badge>
123
+ <AvatarView
124
+ badge={{ flagCode: 'usd' }}
125
+ style={{ backgroundColor: 'var(--color-bright-pink)' }}
126
+ name="Tim Cook"
127
+ />
142
128
  ),
143
129
  title: 'Hawaii Holiday',
144
130
  content: 'Wise USD jar',
145
131
  },
146
132
  {
147
133
  media: (
148
- <Badge badge={<Flag code="aed" />} size="md">
149
- <Avatar type="icon" size="md" backgroundColor="var(--color-bright-yellow)">
150
- <Briefcase size="24" />
151
- </Avatar>
152
- </Badge>
134
+ <AvatarView
135
+ badge={{ flagCode: 'aed' }}
136
+ style={{ backgroundColor: 'var(--color-bright-yellow)' }}
137
+ >
138
+ <Briefcase />
139
+ </AvatarView>
153
140
  ),
154
141
  title: 'Emirates Business Trip',
155
142
  content: 'Wise AED jar',
156
143
  },
157
144
  {
158
145
  media: (
159
- <Badge badge={<Flag code="jpy" />} size="md">
160
- <Avatar type="icon" size="md" backgroundColor="var(--color-bright-blue)">
161
- <Plane size="24" />
162
- </Avatar>
163
- </Badge>
146
+ <AvatarView
147
+ badge={{ flagCode: 'jpy' }}
148
+ style={{ backgroundColor: 'var(--color-bright-blue)' }}
149
+ >
150
+ <Plane />
151
+ </AvatarView>
164
152
  ),
165
153
  title: 'Trip to Mars',
166
154
  content: 'Wise Jpy jar',
167
155
  },
168
156
  ],
169
157
  },
158
+ {
159
+ title: 'Balances',
160
+ options: [
161
+ {
162
+ media: <Flag code="gbp" />,
163
+ title: 'Wise GBP balance',
164
+ },
165
+ {
166
+ media: <Flag code="eur" />,
167
+ title: 'Wise EUR balance',
168
+ },
169
+ ],
170
+ },
170
171
  ];
171
172
 
172
173
  export const Basic: Story = {
@@ -1,6 +1,6 @@
1
1
  import { shallow, mount } from 'enzyme';
2
2
 
3
- import SlidingPanel from './SlidingPanel';
3
+ import SlidingPanel, { EXIT_ANIMATION } from './SlidingPanel';
4
4
 
5
5
  describe('SlidingPanel', () => {
6
6
  let component;