@transferwise/components 46.76.0 → 46.78.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 (142) hide show
  1. package/build/alert/Alert.js +17 -13
  2. package/build/alert/Alert.js.map +1 -1
  3. package/build/alert/Alert.mjs +17 -13
  4. package/build/alert/Alert.mjs.map +1 -1
  5. package/build/avatar/Avatar.js +2 -7
  6. package/build/avatar/Avatar.js.map +1 -1
  7. package/build/avatar/Avatar.mjs +2 -7
  8. package/build/avatar/Avatar.mjs.map +1 -1
  9. package/build/badge/Badge.js +1 -10
  10. package/build/badge/Badge.js.map +1 -1
  11. package/build/badge/Badge.mjs +1 -10
  12. package/build/badge/Badge.mjs.map +1 -1
  13. package/build/circularButton/CircularButton.js +1 -1
  14. package/build/circularButton/CircularButton.js.map +1 -1
  15. package/build/circularButton/CircularButton.mjs +1 -1
  16. package/build/circularButton/CircularButton.mjs.map +1 -1
  17. package/build/common/circle/Circle.js +15 -2
  18. package/build/common/circle/Circle.js.map +1 -1
  19. package/build/common/circle/Circle.mjs +15 -2
  20. package/build/common/circle/Circle.mjs.map +1 -1
  21. package/build/i18n/de.json +5 -0
  22. package/build/i18n/de.json.js +5 -0
  23. package/build/i18n/de.json.js.map +1 -1
  24. package/build/i18n/de.json.mjs +5 -0
  25. package/build/i18n/de.json.mjs.map +1 -1
  26. package/build/i18n/es.json +5 -0
  27. package/build/i18n/es.json.js +5 -0
  28. package/build/i18n/es.json.js.map +1 -1
  29. package/build/i18n/es.json.mjs +5 -0
  30. package/build/i18n/es.json.mjs.map +1 -1
  31. package/build/i18n/fr.json +5 -0
  32. package/build/i18n/fr.json.js +5 -0
  33. package/build/i18n/fr.json.js.map +1 -1
  34. package/build/i18n/fr.json.mjs +5 -0
  35. package/build/i18n/fr.json.mjs.map +1 -1
  36. package/build/i18n/hu.json +5 -0
  37. package/build/i18n/hu.json.js +5 -0
  38. package/build/i18n/hu.json.js.map +1 -1
  39. package/build/i18n/hu.json.mjs +5 -0
  40. package/build/i18n/hu.json.mjs.map +1 -1
  41. package/build/i18n/id.json +5 -0
  42. package/build/i18n/id.json.js +5 -0
  43. package/build/i18n/id.json.js.map +1 -1
  44. package/build/i18n/id.json.mjs +5 -0
  45. package/build/i18n/id.json.mjs.map +1 -1
  46. package/build/i18n/it.json +5 -0
  47. package/build/i18n/it.json.js +5 -0
  48. package/build/i18n/it.json.js.map +1 -1
  49. package/build/i18n/it.json.mjs +5 -0
  50. package/build/i18n/it.json.mjs.map +1 -1
  51. package/build/i18n/ja.json +5 -0
  52. package/build/i18n/ja.json.js +5 -0
  53. package/build/i18n/ja.json.js.map +1 -1
  54. package/build/i18n/ja.json.mjs +5 -0
  55. package/build/i18n/ja.json.mjs.map +1 -1
  56. package/build/i18n/pl.json +5 -0
  57. package/build/i18n/pl.json.js +5 -0
  58. package/build/i18n/pl.json.js.map +1 -1
  59. package/build/i18n/pl.json.mjs +5 -0
  60. package/build/i18n/pl.json.mjs.map +1 -1
  61. package/build/i18n/pt.json +5 -0
  62. package/build/i18n/pt.json.js +5 -0
  63. package/build/i18n/pt.json.js.map +1 -1
  64. package/build/i18n/pt.json.mjs +5 -0
  65. package/build/i18n/pt.json.mjs.map +1 -1
  66. package/build/i18n/ro.json +5 -0
  67. package/build/i18n/ro.json.js +5 -0
  68. package/build/i18n/ro.json.js.map +1 -1
  69. package/build/i18n/ro.json.mjs +5 -0
  70. package/build/i18n/ro.json.mjs.map +1 -1
  71. package/build/i18n/ru.json +5 -0
  72. package/build/i18n/ru.json.js +5 -0
  73. package/build/i18n/ru.json.js.map +1 -1
  74. package/build/i18n/ru.json.mjs +5 -0
  75. package/build/i18n/ru.json.mjs.map +1 -1
  76. package/build/i18n/tr.json +5 -0
  77. package/build/i18n/tr.json.js +5 -0
  78. package/build/i18n/tr.json.js.map +1 -1
  79. package/build/i18n/tr.json.mjs +5 -0
  80. package/build/i18n/tr.json.mjs.map +1 -1
  81. package/build/main.css +46 -22
  82. package/build/statusIcon/StatusIcon.js +4 -4
  83. package/build/statusIcon/StatusIcon.js.map +1 -1
  84. package/build/statusIcon/StatusIcon.mjs +4 -4
  85. package/build/statusIcon/StatusIcon.mjs.map +1 -1
  86. package/build/styles/avatar/Avatar.css +29 -0
  87. package/build/styles/badge/Badge.css +6 -0
  88. package/build/styles/circularButton/CircularButton.css +2 -2
  89. package/build/styles/common/circle/Circle.css +4 -0
  90. package/build/styles/main.css +46 -22
  91. package/build/styles/statusIcon/StatusIcon.css +0 -20
  92. package/build/types/alert/Alert.d.ts +3 -11
  93. package/build/types/alert/Alert.d.ts.map +1 -1
  94. package/build/types/avatar/Avatar.d.ts.map +1 -1
  95. package/build/types/badge/Badge.d.ts.map +1 -1
  96. package/build/types/common/circle/Circle.d.ts +1 -1
  97. package/build/types/common/circle/Circle.d.ts.map +1 -1
  98. package/build/types/statusIcon/StatusIcon.d.ts +7 -3
  99. package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
  100. package/package.json +3 -3
  101. package/src/alert/Alert.spec.story.tsx +85 -4
  102. package/src/alert/Alert.spec.tsx +36 -14
  103. package/src/alert/Alert.story.tsx +50 -35
  104. package/src/alert/Alert.tsx +22 -23
  105. package/src/avatar/Avatar.css +29 -0
  106. package/src/avatar/Avatar.less +12 -0
  107. package/src/avatar/Avatar.tsx +4 -8
  108. package/src/avatarWrapper/__snapshots__/AvatarWrapper.spec.tsx.snap +11 -22
  109. package/src/badge/Badge.css +6 -0
  110. package/src/badge/Badge.less +6 -0
  111. package/src/badge/Badge.tsx +1 -11
  112. package/src/circularButton/CircularButton.css +2 -2
  113. package/src/circularButton/CircularButton.less +1 -1
  114. package/src/circularButton/CircularButton.story.tsx +3 -0
  115. package/src/circularButton/CircularButton.tsx +1 -1
  116. package/src/circularButton/__snapshots__/CircularButton.spec.tsx.snap +10 -10
  117. package/src/common/circle/Circle.css +4 -0
  118. package/src/common/circle/Circle.less +6 -0
  119. package/src/common/circle/Circle.story.tsx +2 -2
  120. package/src/common/circle/Circle.tsx +25 -2
  121. package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +4 -8
  122. package/src/i18n/de.json +5 -0
  123. package/src/i18n/es.json +5 -0
  124. package/src/i18n/fr.json +5 -0
  125. package/src/i18n/hu.json +5 -0
  126. package/src/i18n/id.json +5 -0
  127. package/src/i18n/it.json +5 -0
  128. package/src/i18n/ja.json +5 -0
  129. package/src/i18n/pl.json +5 -0
  130. package/src/i18n/pt.json +5 -0
  131. package/src/i18n/ro.json +5 -0
  132. package/src/i18n/ru.json +5 -0
  133. package/src/i18n/tr.json +5 -0
  134. package/src/main.css +46 -22
  135. package/src/overlayHeader/__snapshots__/OverlayHeader.spec.tsx.snap +2 -4
  136. package/src/promoCard/PromoCard.spec.tsx +1 -1
  137. package/src/radio/__snapshots__/Radio.rtl.spec.tsx.snap +2 -4
  138. package/src/statusIcon/StatusIcon.css +0 -20
  139. package/src/statusIcon/StatusIcon.less +0 -17
  140. package/src/statusIcon/StatusIcon.spec.tsx +2 -21
  141. package/src/statusIcon/StatusIcon.story.tsx +32 -1
  142. package/src/statusIcon/StatusIcon.tsx +11 -10
package/src/main.css CHANGED
@@ -221,18 +221,27 @@ div.critical-comms .critical-comms-body {
221
221
  }
222
222
  .tw-avatar {
223
223
  position: relative;
224
+ border-radius: 50%;
224
225
  -webkit-user-select: none;
225
226
  -moz-user-select: none;
226
227
  user-select: none;
227
228
  box-sizing: border-box;
228
229
  }
229
230
  .tw-avatar .tw-avatar__content {
231
+ align-items: center;
230
232
  background-color: rgba(134,167,189,0.10196);
231
233
  background-color: #86a7bd1a;
232
234
  background-color: var(--color-background-neutral);
235
+ border-radius: 50%;
236
+ color: #37517e;
237
+ color: var(--color-content-primary);
238
+ display: flex;
239
+ height: 100%;
240
+ justify-content: center;
233
241
  max-height: 100%;
234
242
  max-width: 100%;
235
243
  overflow: hidden;
244
+ width: 100%;
236
245
  }
237
246
  .tw-avatar--outlined {
238
247
  border: 1px solid #00a2dd;
@@ -275,6 +284,11 @@ div.critical-comms .critical-comms-body {
275
284
  color: var(--color-dark-charcoal);
276
285
  line-height: 1;
277
286
  }
287
+ .tw-avatar--24 {
288
+ min-width: 24px;
289
+ width: 24px;
290
+ height: 24px;
291
+ }
278
292
  .tw-avatar--24.tw-avatar--emoji,
279
293
  .tw-avatar--24.tw-avatar--icon {
280
294
  font-size: 12px;
@@ -305,6 +319,11 @@ div.critical-comms .critical-comms-body {
305
319
  content: "";
306
320
  border-radius: 50%;
307
321
  }
322
+ .tw-avatar--40 {
323
+ min-width: 40px;
324
+ width: 40px;
325
+ height: 40px;
326
+ }
308
327
  .tw-avatar--40.tw-avatar--emoji,
309
328
  .tw-avatar--40.tw-avatar--icon {
310
329
  font-size: 20px;
@@ -335,6 +354,11 @@ div.critical-comms .critical-comms-body {
335
354
  content: "";
336
355
  border-radius: 50%;
337
356
  }
357
+ .tw-avatar--48 {
358
+ min-width: 48px;
359
+ width: 48px;
360
+ height: 48px;
361
+ }
338
362
  .tw-avatar--48.tw-avatar--emoji,
339
363
  .tw-avatar--48.tw-avatar--icon {
340
364
  font-size: 24px;
@@ -365,6 +389,11 @@ div.critical-comms .critical-comms-body {
365
389
  content: "";
366
390
  border-radius: 50%;
367
391
  }
392
+ .tw-avatar--56 {
393
+ min-width: 56px;
394
+ width: 56px;
395
+ height: 56px;
396
+ }
368
397
  .tw-avatar--56.tw-avatar--emoji,
369
398
  .tw-avatar--56.tw-avatar--icon {
370
399
  font-size: 28px;
@@ -395,6 +424,11 @@ div.critical-comms .critical-comms-body {
395
424
  content: "";
396
425
  border-radius: 50%;
397
426
  }
427
+ .tw-avatar--72 {
428
+ min-width: 72px;
429
+ width: 72px;
430
+ height: 72px;
431
+ }
398
432
  .tw-avatar--72.tw-avatar--emoji,
399
433
  .tw-avatar--72.tw-avatar--icon {
400
434
  font-size: 36px;
@@ -460,10 +494,16 @@ div.critical-comms .critical-comms-body {
460
494
  }
461
495
  .tw-badge > .tw-badge__content {
462
496
  position: absolute;
497
+ width: var(--badge-size);
498
+ height: var(--badge-size);
463
499
  bottom: 0;
464
500
  right: 0;
465
501
  box-sizing: border-box;
502
+ border-radius: 50%;
466
503
  text-align: center;
504
+ display: flex;
505
+ align-items: center;
506
+ justify-content: center;
467
507
  overflow: hidden;
468
508
  -webkit-user-select: none;
469
509
  -moz-user-select: none;
@@ -1016,8 +1056,8 @@ div.critical-comms .critical-comms-body {
1016
1056
  }
1017
1057
  @media (max-width: 320px) {
1018
1058
  .np-circular-btn .tw-icon {
1019
- top: 8px;
1020
- top: var(--size-8);
1059
+ top: 12px;
1060
+ top: var(--size-12);
1021
1061
  }
1022
1062
  }
1023
1063
  .np-circular-btn .tw-icon > svg {
@@ -1172,6 +1212,10 @@ div.critical-comms .critical-comms-body {
1172
1212
  height: var(--circle-size);
1173
1213
  flex-shrink: 0;
1174
1214
  }
1215
+ .np-circle .tw-icon > svg {
1216
+ height: var(--circle-icon-size);
1217
+ width: var(--circle-icon-size);
1218
+ }
1175
1219
  .np-bottom-sheet {
1176
1220
  border-radius: 10px 10px 0 0;
1177
1221
  }
@@ -4158,12 +4202,6 @@ html:not([dir="rtl"]) .np-navigation-option {
4158
4202
  transform: translateY(-24px);
4159
4203
  }
4160
4204
  }
4161
- .status-icon > svg {
4162
- height: 32px;
4163
- height: var(--size-32);
4164
- width: 32px;
4165
- width: var(--size-32);
4166
- }
4167
4205
  .status-circle .light {
4168
4206
  color: var(--color-contrast);
4169
4207
  }
@@ -4179,20 +4217,6 @@ html:not([dir="rtl"]) .np-navigation-option {
4179
4217
  .np-theme-personal .status-circle.pending .status-icon {
4180
4218
  color: var(--color-dark);
4181
4219
  }
4182
- .status-circle-sm .status-icon > svg {
4183
- height: 14px;
4184
- height: var(--size-14);
4185
- width: 14px;
4186
- width: var(--size-14);
4187
- }
4188
- @media (max-width: 320px) {
4189
- .status-circle-sm .status-icon > svg {
4190
- width: 24px;
4191
- width: var(--size-24);
4192
- height: 24px;
4193
- height: var(--size-24);
4194
- }
4195
- }
4196
4220
  .status-circle.negative,
4197
4221
  .status-circle.error {
4198
4222
  background-color: var(--color-sentiment-negative);
@@ -18,12 +18,10 @@ exports[`OverlayHeader renders as expected 1`] = `
18
18
  class="d-flex align-items-center order-2"
19
19
  >
20
20
  <div
21
- class="np-circle d-flex align-items-center justify-content-center tw-avatar tw-avatar--48 tw-avatar--initials np-text-title-body"
22
- style="--circle-size: 48px;"
21
+ class="tw-avatar tw-avatar--48 tw-avatar--initials np-text-title-body"
23
22
  >
24
23
  <div
25
- class="np-circle d-flex align-items-center justify-content-center tw-avatar__content"
26
- style="--circle-size: 48px;"
24
+ class="tw-avatar__content"
27
25
  >
28
26
  TM
29
27
  </div>
@@ -1,4 +1,4 @@
1
- import { render, fireEvent, screen } from '@testing-library/react';
1
+ import { render, fireEvent, screen } from '../test-utils';
2
2
  import React from 'react';
3
3
 
4
4
  import PromoCard, { PromoCardProps, PromoCardCheckedProps, PromoCardLinkProps } from './PromoCard';
@@ -34,12 +34,10 @@ exports[`Radio shows the avatar when supplied 1`] = `
34
34
  class="np-radio__avatar m-l-auto"
35
35
  >
36
36
  <div
37
- class="np-circle d-flex align-items-center justify-content-center tw-avatar tw-avatar--48 tw-avatar--initials np-text-title-body"
38
- style="--circle-size: 48px;"
37
+ class="tw-avatar tw-avatar--48 tw-avatar--initials np-text-title-body"
39
38
  >
40
39
  <div
41
- class="np-circle d-flex align-items-center justify-content-center tw-avatar__content"
42
- style="--circle-size: 48px;"
40
+ class="tw-avatar__content"
43
41
  >
44
42
  HD
45
43
  </div>
@@ -1,9 +1,3 @@
1
- .status-icon > svg {
2
- height: 32px;
3
- height: var(--size-32);
4
- width: 32px;
5
- width: var(--size-32);
6
- }
7
1
  .status-circle .light {
8
2
  color: var(--color-contrast);
9
3
  }
@@ -19,20 +13,6 @@
19
13
  .np-theme-personal .status-circle.pending .status-icon {
20
14
  color: var(--color-dark);
21
15
  }
22
- .status-circle-sm .status-icon > svg {
23
- height: 14px;
24
- height: var(--size-14);
25
- width: 14px;
26
- width: var(--size-14);
27
- }
28
- @media (max-width: 320px) {
29
- .status-circle-sm .status-icon > svg {
30
- width: 24px;
31
- width: var(--size-24);
32
- height: 24px;
33
- height: var(--size-24);
34
- }
35
- }
36
16
  .status-circle.negative,
37
17
  .status-circle.error {
38
18
  background-color: var(--color-sentiment-negative);
@@ -1,8 +1,3 @@
1
- .status-icon > svg {
2
- height: var(--size-32);
3
- width: var(--size-32);
4
- }
5
-
6
1
  .status-circle {
7
2
  .light {
8
3
  color: var(--color-contrast);
@@ -22,18 +17,6 @@
22
17
  }
23
18
  }
24
19
  }
25
-
26
- &-sm {
27
- .status-icon > svg {
28
- height: var(--size-14);
29
- width: var(--size-14);
30
-
31
- @media (--screen-400-zoom) {
32
- width: var(--size-24);
33
- height: var(--size-24);
34
- }
35
- }
36
- }
37
20
  }
38
21
 
39
22
  .status-circle.negative,
@@ -1,16 +1,12 @@
1
1
  import { Sentiment, Size } from '../common';
2
2
  import { render, cleanup, screen, mockMatchMedia } from '../test-utils';
3
3
 
4
- import StatusIcon, { StatusIconProps } from '.';
4
+ import StatusIcon, { type StatusIconProps } from '.';
5
5
 
6
6
  mockMatchMedia();
7
7
 
8
8
  describe('StatusIcon', () => {
9
- const renderStatusIcon = (props?: {
10
- sentiment?: StatusIconProps['sentiment'];
11
- size?: StatusIconProps['size'];
12
- iconLabel?: StatusIconProps['iconLabel'];
13
- }) => {
9
+ const renderStatusIcon = (props?: StatusIconProps) => {
14
10
  return render(
15
11
  <StatusIcon
16
12
  sentiment={props?.sentiment || Sentiment.NEUTRAL}
@@ -27,23 +23,8 @@ describe('StatusIcon', () => {
27
23
 
28
24
  expect(screen.getByTestId('status-icon')).toHaveClass('neutral');
29
25
  expect(screen.getByTestId('status-icon')).toHaveClass('status-circle');
30
- expect(screen.getByTestId('status-icon')).toHaveClass('status-circle-md');
31
26
  });
32
27
 
33
- it.each([
34
- [Size.SMALL as const, 'status-circle-sm'],
35
- [Size.MEDIUM as const, 'status-circle-md'],
36
- [Size.LARGE as const, 'status-circle-lg'],
37
- ])(
38
- "if prop 'size' equals '%s' is passed, renders the status icon with class '%s'",
39
- (size, expectedClass) => {
40
- renderStatusIcon({ size });
41
-
42
- expect(screen.getByTestId('status-icon')).toHaveClass(expectedClass);
43
- cleanup();
44
- },
45
- );
46
-
47
28
  it.each([
48
29
  [Sentiment.NEGATIVE, Sentiment.NEGATIVE],
49
30
  [Sentiment.NEUTRAL, Sentiment.NEUTRAL],
@@ -1,6 +1,6 @@
1
1
  import { Meta, StoryObj } from '@storybook/react';
2
2
 
3
- import { Size, Sentiment } from '../common';
3
+ import { Sentiment, Size } from '../common';
4
4
 
5
5
  import StatusIcon from './StatusIcon';
6
6
 
@@ -29,6 +29,37 @@ export const Presentational: Story = {
29
29
  };
30
30
 
31
31
  export const Variants: Story = {
32
+ render: () => (
33
+ <span style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '400px' }}>
34
+ {[
35
+ Sentiment.POSITIVE,
36
+ Sentiment.NEGATIVE,
37
+ Sentiment.WARNING,
38
+ Sentiment.NEUTRAL,
39
+ Sentiment.PENDING,
40
+ ].map((sentiment) => {
41
+ return (
42
+ <span
43
+ key={sentiment}
44
+ style={{
45
+ display: 'flex',
46
+ justifyContent: 'space-between',
47
+ flexDirection: 'column',
48
+ minHeight: '150px',
49
+ alignItems: 'center',
50
+ }}
51
+ >
52
+ {([16, 24, 32, 40, 48, 56, 72] as const).map((size) => {
53
+ return <StatusIcon key={size} size={size} sentiment={sentiment} />;
54
+ })}
55
+ </span>
56
+ );
57
+ })}
58
+ </span>
59
+ ),
60
+ };
61
+
62
+ export const LegacySizes: Story = {
32
63
  render: () => (
33
64
  <span style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '400px' }}>
34
65
  {[
@@ -8,9 +8,14 @@ import { useMedia } from '../common/hooks/useMedia';
8
8
 
9
9
  import messages from './StatusIcon.messages';
10
10
 
11
+ /**
12
+ * @deprecated use `16 | 24 | 32 | 40 | 48 | 56 | 72` component instead
13
+ */
14
+ type LegacySizes = SizeSmall | SizeMedium | SizeLarge;
15
+
11
16
  export type StatusIconProps = {
12
- sentiment: `${Sentiment}`;
13
- size: SizeSmall | SizeMedium | SizeLarge;
17
+ sentiment?: `${Sentiment}`;
18
+ size?: LegacySizes | 16 | 24 | 32 | 40 | 48 | 56 | 72;
14
19
  /**
15
20
  * Override for the sentiment's-derived, default, accessible
16
21
  * name announced by the screen readers. <br />
@@ -25,11 +30,7 @@ const mapLegacySize = {
25
30
  [String(Size.LARGE)]: 48,
26
31
  } satisfies Record<string, CircleProps['size']>;
27
32
 
28
- const StatusIcon = ({
29
- sentiment = 'neutral',
30
- size: sizeProp = 'md',
31
- iconLabel,
32
- }: StatusIconProps) => {
33
+ const StatusIcon = ({ sentiment = 'neutral', size: sizeProp = 40, iconLabel }: StatusIconProps) => {
33
34
  const intl = useIntl();
34
35
 
35
36
  const iconMetaBySentiment: Record<
@@ -77,13 +78,13 @@ const StatusIcon = ({
77
78
 
78
79
  const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';
79
80
  const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);
80
- const size = sizeProp === Size.SMALL && isTinyViewport ? 32 : mapLegacySize[sizeProp];
81
+ const size = mapLegacySize[sizeProp] ?? sizeProp;
81
82
  return (
82
83
  <Circle
83
84
  as="span"
84
- size={size}
85
+ size={isTinyViewport && size < 40 ? 32 : size}
85
86
  data-testid="status-icon"
86
- className={clsx('status-circle', `status-circle-${sizeProp}`, sentiment)}
87
+ className={clsx('status-circle', sentiment)}
87
88
  >
88
89
  <Icon
89
90
  className={clsx('status-icon', iconColor)}