@transferwise/components 46.79.1 → 46.81.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.
Files changed (123) 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 +175 -0
  6. package/build/avatarView/AvatarView.js.map +1 -0
  7. package/build/avatarView/AvatarView.mjs +173 -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 +16 -4
  18. package/build/badge/Badge.js.map +1 -1
  19. package/build/badge/Badge.mjs +15 -3
  20. package/build/badge/Badge.mjs.map +1 -1
  21. package/build/badge/BadgeAssets.js +60 -0
  22. package/build/badge/BadgeAssets.js.map +1 -0
  23. package/build/badge/BadgeAssets.mjs +58 -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 +19 -1
  30. package/build/common/circle/Circle.js.map +1 -1
  31. package/build/common/circle/Circle.mjs +19 -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/i18n/zh-HK.json +5 -0
  39. package/build/i18n/zh-HK.json.js +5 -0
  40. package/build/i18n/zh-HK.json.js.map +1 -1
  41. package/build/i18n/zh-HK.json.mjs +5 -0
  42. package/build/i18n/zh-HK.json.mjs.map +1 -1
  43. package/build/index.js +18 -13
  44. package/build/index.js.map +1 -1
  45. package/build/index.mjs +10 -7
  46. package/build/index.mjs.map +1 -1
  47. package/build/main.css +74 -5
  48. package/build/styles/avatarView/AvatarView.css +36 -0
  49. package/build/styles/avatarView/NotificationDot.css +20 -0
  50. package/build/styles/badge/Badge.css +6 -5
  51. package/build/styles/common/circle/Circle.css +32 -0
  52. package/build/styles/main.css +74 -5
  53. package/build/types/avatar/Avatar.d.ts +3 -0
  54. package/build/types/avatar/Avatar.d.ts.map +1 -1
  55. package/build/types/avatarView/AvatarView.d.ts +26 -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 +9 -4
  64. package/build/types/badge/Badge.d.ts.map +1 -1
  65. package/build/types/badge/BadgeAssets.d.ts +14 -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/build/types/test-utils/index.d.ts +158 -0
  78. package/build/types/test-utils/index.d.ts.map +1 -0
  79. package/build/types/test-utils/jest.setup.d.ts +2 -0
  80. package/build/types/test-utils/jest.setup.d.ts.map +1 -0
  81. package/package.json +2 -1
  82. package/src/avatar/Avatar.tsx +3 -0
  83. package/src/avatarView/AvatarView.css +36 -0
  84. package/src/avatarView/AvatarView.less +27 -0
  85. package/src/avatarView/AvatarView.story.tsx +467 -0
  86. package/src/avatarView/AvatarView.tsx +171 -0
  87. package/src/avatarView/NotificationDot.css +20 -0
  88. package/src/avatarView/NotificationDot.less +24 -0
  89. package/src/avatarView/NotificationDot.tsx +35 -0
  90. package/src/avatarView/index.ts +2 -0
  91. package/src/avatarWrapper/AvatarWrapper.story.tsx +19 -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 +20 -6
  96. package/src/badge/BadgeAssets.tsx +61 -0
  97. package/src/badge/index.ts +3 -0
  98. package/src/button/{Button.spec.js → Button.spec.tsx} +3 -2
  99. package/src/button/Button.tsx +1 -1
  100. package/src/button/legacyUtils/{legacyUtils.spec.js → legacyUtils.spec.tsx} +1 -1
  101. package/src/button/legacyUtils/legacyUtils.ts +2 -2
  102. package/src/circularButton/CircularButton.spec.tsx +0 -36
  103. package/src/common/circle/Circle.css +32 -0
  104. package/src/common/circle/Circle.less +35 -0
  105. package/src/common/circle/Circle.tsx +24 -1
  106. package/src/flowNavigation/FlowNavigation.story.tsx +19 -52
  107. package/src/i18n/th.json +5 -0
  108. package/src/i18n/zh-HK.json +5 -0
  109. package/src/index.ts +3 -0
  110. package/src/listItem/ListItem.story.tsx +5 -47
  111. package/src/main.css +74 -5
  112. package/src/main.less +1 -0
  113. package/src/modal/{Modal.rtl.spec.js → Modal.rtl.spec.tsx} +8 -7
  114. package/src/overlayHeader/OverlayHeader.story.tsx +6 -14
  115. package/src/slidingPanel/SlidingPanel.spec.js +1 -1
  116. package/src/ssr.spec.tsx +264 -0
  117. package/src/test-utils/{index.js → index.tsx} +11 -6
  118. package/src/test-utils/{jest.setup.js → jest.setup.ts} +13 -8
  119. package/src/circularButton/__snapshots__/CircularButton.spec.tsx.snap +0 -381
  120. package/src/ssr.spec.js +0 -256
  121. /package/src/button/__snapshots__/{Button.spec.js.snap → Button.spec.tsx.snap} +0 -0
  122. /package/src/dimmer/{Dimmer.rtl.spec.js → Dimmer.rtl.spec.tsx} +0 -0
  123. /package/src/info/{Info.spec.js → Info.spec.jsx} +0 -0
@@ -1,12 +1,10 @@
1
1
  import { boolean, select, text } from '@storybook/addon-knobs';
2
- import { Person as ProfileIcon, Briefcase as BriefcaseIcon } from '@transferwise/icons';
3
2
  import { useState } from 'react';
4
3
 
5
- import Avatar, { AvatarType } from '../avatar';
6
- import AvatarWrapper from '../avatarWrapper';
4
+ import AvatarView from '../avatarView';
7
5
  import Body from '../body';
8
6
  import Button from '../button';
9
- import { ProfileType, Size, Typography } from '../common';
7
+ import { ProfileType, Typography } from '../common';
10
8
  import Logo from '../logo';
11
9
  import OverlayHeader from '../overlayHeader';
12
10
 
@@ -19,43 +17,24 @@ export default {
19
17
  component: FlowNavigation,
20
18
  title: 'Navigation/FlowNavigation',
21
19
  };
22
- const avatarProfiles = {
23
- '': null,
24
- Business: <BriefcaseIcon />,
25
- Profile: <ProfileIcon />,
26
- };
27
- type ProfileTypeKeys = keyof typeof ProfileType;
28
-
29
- const getAvatarProfile = (showAvatar: string) =>
30
- showAvatar in avatarProfiles ? avatarProfiles[showAvatar as keyof typeof avatarProfiles] : null;
31
20
 
32
21
  export const Variants = () => {
33
22
  const [activeStep, setActiveStep] = useState(2);
34
23
  const [closed, setClosed] = useState(false);
35
- const showAvatar = select('avatar', Object.keys(avatarProfiles), 'Profile');
24
+ const profileType = select(
25
+ 'avatar',
26
+ [ProfileType.PERSONAL, ProfileType.BUSINESS],
27
+ ProfileType.PERSONAL,
28
+ );
36
29
  const showCloseButton = boolean('show closeButton', true);
37
30
  const showMobileBackButton = boolean('show mobile backButton', true);
38
31
  const done = boolean('done', false);
39
- const profileType: ProfileTypeKeys | undefined = select(
40
- 'profileType',
41
- Object.keys(ProfileType) as ProfileTypeKeys[],
42
- undefined,
43
- );
44
- const avatarURL = text(
45
- 'avatarURL',
46
- 'https://wise.com/web-art/assets/illustrations/heart-small@2x.webp',
47
- );
32
+ const avatarURL = text('avatarURL', '../tapestry-01.png');
48
33
 
49
34
  return !closed ? (
50
35
  <>
51
36
  <FlowNavigation
52
- avatar={
53
- !showAvatar ? null : (
54
- <Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
55
- {getAvatarProfile(showAvatar)}
56
- </Avatar>
57
- )
58
- }
37
+ avatar={!profileType ? null : <AvatarView profileType={profileType} />}
59
38
  logo={<Logo />}
60
39
  activeStep={activeStep}
61
40
  done={done}
@@ -132,7 +111,7 @@ export const Variants = () => {
132
111
 
133
112
  <FlowNavigation
134
113
  done={done}
135
- avatar={<AvatarWrapper url={avatarURL} profileType={profileType} />}
114
+ avatar={<AvatarView imgSrc={avatarURL} profileType={profileType} />}
136
115
  activeStep={activeStep}
137
116
  steps={[
138
117
  {
@@ -178,7 +157,7 @@ export const Variants = () => {
178
157
  {/* Instance of always `done` FlowNav for visual testing */}
179
158
  <FlowNavigation
180
159
  done
181
- avatar={<AvatarWrapper url={avatarURL} profileType={profileType} />}
160
+ avatar={<AvatarView imgSrc={avatarURL} profileType={profileType} />}
182
161
  activeStep={activeStep}
183
162
  steps={[
184
163
  { label: 'Recipient', hoverLabel: 'Daniele Tomboro', onClick: () => setActiveStep(0) },
@@ -240,11 +219,7 @@ export const SendFlow = () => {
240
219
  return (
241
220
  <>
242
221
  <FlowNavigation
243
- avatar={
244
- <Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
245
- <ProfileIcon />
246
- </Avatar>
247
- }
222
+ avatar={<AvatarView />}
248
223
  logo={<Logo />}
249
224
  activeStep={activeStep}
250
225
  steps={steps}
@@ -272,7 +247,11 @@ export const SendFlow = () => {
272
247
  export const WithOverlayHeaderComparison = () => {
273
248
  const [activeStep, setActiveStep] = useState(4);
274
249
  const [closed, setClosed] = useState(false);
275
- const showAvatar = select('avatar', Object.keys(avatarProfiles), 'Profile');
250
+ const profileType = select(
251
+ 'avatar',
252
+ [ProfileType.PERSONAL, ProfileType.BUSINESS],
253
+ ProfileType.PERSONAL,
254
+ );
276
255
  const showCloseButton = boolean('show closeButton', true);
277
256
  const showMobileBackButton = boolean('show mobile backButton', true);
278
257
  const done = boolean('done', false);
@@ -281,13 +260,7 @@ export const WithOverlayHeaderComparison = () => {
281
260
  <>
282
261
  <div style={{ border: '1px solid #e8e8e8' }}>
283
262
  <FlowNavigation
284
- avatar={
285
- showAvatar ? (
286
- <Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
287
- {getAvatarProfile(showAvatar)}
288
- </Avatar>
289
- ) : null
290
- }
263
+ avatar={profileType ? <AvatarView profileType={profileType} /> : null}
291
264
  activeStep={activeStep}
292
265
  done={done}
293
266
  steps={[]}
@@ -301,13 +274,7 @@ export const WithOverlayHeaderComparison = () => {
301
274
  </div>
302
275
  <div style={{ border: '1px solid #e8e8e8' }}>
303
276
  <OverlayHeader
304
- avatar={
305
- showAvatar ? (
306
- <Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
307
- {getAvatarProfile(showAvatar)}
308
- </Avatar>
309
- ) : null
310
- }
277
+ avatar={profileType ? <AvatarView profileType={profileType} /> : null}
311
278
  onClose={showCloseButton ? () => setClosed(true) : undefined}
312
279
  />
313
280
  </div>
package/src/i18n/th.json CHANGED
@@ -27,6 +27,11 @@
27
27
  "neptune.SelectInput.noResultsFound": "ไม่พบผลลัพธ์",
28
28
  "neptune.SelectOption.action.label": "เลือก",
29
29
  "neptune.SelectOption.selected.action.label": "เปลี่ยนตัวเลือกที่เลือกไว้",
30
+ "neptune.StatusIcon.iconLabel.error": "ข้อผิดพลาด:",
31
+ "neptune.StatusIcon.iconLabel.information": "ข้อมูล:",
32
+ "neptune.StatusIcon.iconLabel.pending": "รอดำเนินการ:",
33
+ "neptune.StatusIcon.iconLabel.success": "สำเร็จ:",
34
+ "neptune.StatusIcon.iconLabel.warning": "คำเตือน:",
30
35
  "neptune.Summary.statusDone": "รายการที่ทำแล้ว",
31
36
  "neptune.Summary.statusNotDone": "รายการที่ต้องทำ",
32
37
  "neptune.Summary.statusPending": "รายการที่รอดำเนินการ",
@@ -27,6 +27,11 @@
27
27
  "neptune.SelectInput.noResultsFound": "找不到任何結果",
28
28
  "neptune.SelectOption.action.label": "選擇",
29
29
  "neptune.SelectOption.selected.action.label": "更改已選選項",
30
+ "neptune.StatusIcon.iconLabel.error": "錯誤:",
31
+ "neptune.StatusIcon.iconLabel.information": "資訊:",
32
+ "neptune.StatusIcon.iconLabel.pending": "處理中:",
33
+ "neptune.StatusIcon.iconLabel.success": "成功:",
34
+ "neptune.StatusIcon.iconLabel.warning": "警告:",
30
35
  "neptune.Summary.statusDone": "已完成事項",
31
36
  "neptune.Summary.statusNotDone": "未完成事項",
32
37
  "neptune.Summary.statusPending": "待處理事項",
package/src/index.ts CHANGED
@@ -8,6 +8,7 @@ export type { ActionOptionProps } from './actionOption';
8
8
  export type { SelectOptionProps, SelectOptionValue, SelectOptiopsSection } from './selectOption';
9
9
  export type { AlertAction, AlertProps, AlertType } from './alert';
10
10
  export type { AvatarProps } from './avatar';
11
+ export type { AvatarViewProps } from './avatarView';
11
12
  export type { BadgeProps } from './badge';
12
13
  export type { CardProps } from './card';
13
14
  export type { CarouselProps } from './carousel';
@@ -103,6 +104,7 @@ export { default as ActionOption } from './actionOption';
103
104
  export { default as SelectOption } from './selectOption';
104
105
  export { default as Alert } from './alert';
105
106
  export { default as Avatar } from './avatar';
107
+ export { default as AvatarView } from './avatarView';
106
108
  export { default as AvatarWrapper } from './avatarWrapper';
107
109
  export { default as Badge } from './badge';
108
110
  export { default as Body } from './body';
@@ -244,6 +246,7 @@ export {
244
246
  getLangFromLocale,
245
247
  isBrowser,
246
248
  isServerSide,
249
+ getBrandColorFromSeed,
247
250
  } from './common';
248
251
 
249
252
  /**
@@ -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 {
@@ -40,17 +38,7 @@ export const Variants = () => {
40
38
  <div className="m-t-4 m-b-2">
41
39
  <Title type="title-body">With Icon Avatar</Title>
42
40
  <List>
43
- <Template
44
- 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>
52
- }
53
- />
41
+ <Template media={<AvatarView imgSrc="../tapestry-01.png" />} />
54
42
  </List>
55
43
  </div>
56
44
  <div className="m-t-4 m-b-2">
@@ -59,22 +47,7 @@ export const Variants = () => {
59
47
  <Template
60
48
  title="Sandra Pepper"
61
49
  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
- }
50
+ media={<AvatarView profileName="Super Pepa" badge={{ icon: <FastFlag /> }} />}
78
51
  />
79
52
  </List>
80
53
  </div>
@@ -84,22 +57,7 @@ export const Variants = () => {
84
57
  <Template
85
58
  title="Account holder"
86
59
  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
- }
60
+ media={<AvatarView profileName="Super Pepa" badge={{ icon: <FastFlag /> }} />}
103
61
  action={<ActionButton>Share details</ActionButton>}
104
62
  />
105
63
  </List>
package/src/main.css CHANGED
@@ -469,6 +469,42 @@ 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-non-interactive .np-circle {
503
+ background-color: transparent;
504
+ }
505
+ .np-avatar-view-non-interactive .np-avatar-view-content .wds-flag {
506
+ box-shadow: none;
507
+ }
472
508
  .tw-badge {
473
509
  position: relative;
474
510
  display: inline-block;
@@ -476,6 +512,7 @@ div.critical-comms .critical-comms-body {
476
512
  --badge-mask: 2px;
477
513
  --badge-mask-offset: calc(var(--badge-size) / 2);
478
514
  --badge-border-color: rgba(255, 255, 255, 0.08);
515
+ --badge-content-position: 0px;
479
516
  }
480
517
  .tw-badge.tw-badge-lg {
481
518
  --badge-size: 24px;
@@ -485,8 +522,8 @@ div.critical-comms .critical-comms-body {
485
522
  --badge-border-color: rgba(0, 0, 0, 0.08);
486
523
  }
487
524
  .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));
525
+ -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));
526
+ 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
527
  }
491
528
  [dir="rtl"] .tw-badge > .tw-badge__children {
492
529
  -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 +533,8 @@ div.critical-comms .critical-comms-body {
496
533
  position: absolute;
497
534
  width: var(--badge-size);
498
535
  height: var(--badge-size);
499
- bottom: 0;
500
- right: 0;
536
+ bottom: var(--badge-content-position);
537
+ right: var(--badge-content-position);
501
538
  box-sizing: border-box;
502
539
  border-radius: 50%;
503
540
  text-align: center;
@@ -510,7 +547,7 @@ div.critical-comms .critical-comms-body {
510
547
  user-select: none;
511
548
  }
512
549
  [dir="rtl"] .tw-badge > .tw-badge__content {
513
- left: 0;
550
+ left: var(--badge-content-position);
514
551
  right: auto;
515
552
  right: initial;
516
553
  }
@@ -1211,11 +1248,43 @@ div.critical-comms .critical-comms-body {
1211
1248
  width: var(--circle-size);
1212
1249
  height: var(--circle-size);
1213
1250
  flex-shrink: 0;
1251
+ --circle-border-color: var(--color-border-neutral);
1252
+ --circle-border-width: 1px;
1253
+ font-size: var(--circle-font-size);
1254
+ font-weight: 600;
1255
+ font-weight: var(--font-weight-semi-bold);
1256
+ line-height: 1;
1257
+ }
1258
+ .np-circle .np-display {
1259
+ font-size: var(--circle-font-size);
1214
1260
  }
1215
1261
  .np-circle .tw-icon > svg {
1216
1262
  height: var(--circle-icon-size);
1217
1263
  width: var(--circle-icon-size);
1218
1264
  }
1265
+ .np-circle img,
1266
+ .np-circle .wds-flag {
1267
+ border-radius: 9999px;
1268
+ border-radius: var(--radius-full);
1269
+ width: 100%;
1270
+ height: 100%;
1271
+ -o-object-fit: cover;
1272
+ object-fit: cover;
1273
+ }
1274
+ .np-circle-border {
1275
+ position: relative;
1276
+ }
1277
+ .np-circle-border::after {
1278
+ content: "";
1279
+ position: absolute;
1280
+ top: 0;
1281
+ left: 0;
1282
+ width: 100%;
1283
+ height: 100%;
1284
+ border-radius: 9999px;
1285
+ border-radius: var(--radius-full);
1286
+ box-shadow: inset 0 0 0 var(--circle-border-width) var(--circle-border-color);
1287
+ }
1219
1288
  .np-bottom-sheet {
1220
1289
  border-radius: 10px 10px 0 0;
1221
1290
  }
package/src/main.less CHANGED
@@ -3,6 +3,7 @@
3
3
  @import "./actionButton/ActionButton.less";
4
4
  @import "./alert/Alert.less";
5
5
  @import "./avatar/Avatar.less";
6
+ @import "./avatarView/AvatarView.less";
6
7
  @import "./badge/Badge.less";
7
8
  @import "./button/Button.less";
8
9
  @import "./card/Card.less";
@@ -1,15 +1,16 @@
1
1
  import { Position } from '../common';
2
2
  import { render, fireEvent, screen, mockMatchMedia } from '../test-utils';
3
3
 
4
- import Modal from './Modal';
4
+ import Modal, { ModalProps } from './Modal';
5
5
 
6
6
  mockMatchMedia();
7
7
 
8
8
  describe('Modal', () => {
9
- const props = {
9
+ const props: ModalProps = {
10
10
  onClose: jest.fn(),
11
11
  body: 'Some body',
12
12
  position: Position.TOP,
13
+ open: true,
13
14
  };
14
15
 
15
16
  beforeEach(() => {
@@ -17,14 +18,14 @@ describe('Modal', () => {
17
18
  });
18
19
 
19
20
  it(`doesn't calls onClose when click is inside modal`, () => {
20
- render(<Modal {...props} open />);
21
+ render(<Modal {...props} />);
21
22
 
22
23
  fireEvent.click(getDialog());
23
24
  expect(props.onClose).not.toHaveBeenCalled();
24
25
  });
25
26
 
26
27
  it('calls onClose if click outside the content', () => {
27
- render(<Modal {...props} open />);
28
+ render(<Modal {...props} />);
28
29
  expect(props.onClose).not.toHaveBeenCalled();
29
30
 
30
31
  fireEvent.click(screen.getByRole('presentation'));
@@ -32,7 +33,7 @@ describe('Modal', () => {
32
33
  });
33
34
 
34
35
  it("doesn't call onClose if click outside the content and closing on dimmer is disabled", () => {
35
- render(<Modal {...props} open disableDimmerClickToClose />);
36
+ render(<Modal {...props} disableDimmerClickToClose />);
36
37
 
37
38
  fireEvent.click(screen.getByRole('presentation'));
38
39
 
@@ -40,7 +41,7 @@ describe('Modal', () => {
40
41
  });
41
42
 
42
43
  it('calls onClose when Escape is pressed on Modal', () => {
43
- render(<Modal {...props} open />);
44
+ render(<Modal {...props} />);
44
45
  expect(props.onClose).not.toHaveBeenCalled();
45
46
 
46
47
  fireEvent.keyDown(getDialog(), { key: 'Escape' });
@@ -48,7 +49,7 @@ describe('Modal', () => {
48
49
  });
49
50
 
50
51
  it('calls onClose when Escape is pressed on document', () => {
51
- render(<Modal {...props} open />);
52
+ render(<Modal {...props} />);
52
53
  expect(props.onClose).not.toHaveBeenCalled();
53
54
 
54
55
  fireEvent.keyDown(document, { key: 'Escape' });
@@ -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,30 +28,23 @@ 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
  );
40
35
  };
41
36
 
42
37
  export const WithAvatarWrapper = () => {
43
- const avatarURL = text(
44
- 'avatarURL',
45
- 'https://wise.com/web-art/assets/illustrations/heart-small@2x.webp',
46
- );
38
+ const avatarURL = text('avatarURL', '../tapestry-01.png');
47
39
  const profileType = select(
48
40
  'profileType',
49
- Object.keys(ProfileType) as `${ProfileType}`[],
41
+ [ProfileType.PERSONAL, ProfileType.BUSINESS],
50
42
  undefined,
51
43
  );
52
44
  return (
53
45
  <OverlayHeader
54
46
  logo={<Logo />}
55
- avatar={<AvatarWrapper url={avatarURL} profileType={profileType} />}
47
+ avatar={<AvatarView imgSrc={avatarURL} profileType={profileType} />}
56
48
  onClose={action('Close clicked')}
57
49
  />
58
50
  );
@@ -1,6 +1,6 @@
1
1
  import { shallow, mount } from 'enzyme';
2
2
 
3
- import SlidingPanel, { EXIT_ANIMATION } from './SlidingPanel';
3
+ import SlidingPanel from './SlidingPanel';
4
4
 
5
5
  describe('SlidingPanel', () => {
6
6
  let component;