@transferwise/components 46.77.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 (132) hide show
  1. package/build/avatar/Avatar.js +2 -7
  2. package/build/avatar/Avatar.js.map +1 -1
  3. package/build/avatar/Avatar.mjs +2 -7
  4. package/build/avatar/Avatar.mjs.map +1 -1
  5. package/build/badge/Badge.js +1 -10
  6. package/build/badge/Badge.js.map +1 -1
  7. package/build/badge/Badge.mjs +1 -10
  8. package/build/badge/Badge.mjs.map +1 -1
  9. package/build/circularButton/CircularButton.js +1 -1
  10. package/build/circularButton/CircularButton.js.map +1 -1
  11. package/build/circularButton/CircularButton.mjs +1 -1
  12. package/build/circularButton/CircularButton.mjs.map +1 -1
  13. package/build/common/circle/Circle.js +15 -2
  14. package/build/common/circle/Circle.js.map +1 -1
  15. package/build/common/circle/Circle.mjs +15 -2
  16. package/build/common/circle/Circle.mjs.map +1 -1
  17. package/build/i18n/de.json +5 -0
  18. package/build/i18n/de.json.js +5 -0
  19. package/build/i18n/de.json.js.map +1 -1
  20. package/build/i18n/de.json.mjs +5 -0
  21. package/build/i18n/de.json.mjs.map +1 -1
  22. package/build/i18n/es.json +5 -0
  23. package/build/i18n/es.json.js +5 -0
  24. package/build/i18n/es.json.js.map +1 -1
  25. package/build/i18n/es.json.mjs +5 -0
  26. package/build/i18n/es.json.mjs.map +1 -1
  27. package/build/i18n/fr.json +5 -0
  28. package/build/i18n/fr.json.js +5 -0
  29. package/build/i18n/fr.json.js.map +1 -1
  30. package/build/i18n/fr.json.mjs +5 -0
  31. package/build/i18n/fr.json.mjs.map +1 -1
  32. package/build/i18n/hu.json +5 -0
  33. package/build/i18n/hu.json.js +5 -0
  34. package/build/i18n/hu.json.js.map +1 -1
  35. package/build/i18n/hu.json.mjs +5 -0
  36. package/build/i18n/hu.json.mjs.map +1 -1
  37. package/build/i18n/id.json +5 -0
  38. package/build/i18n/id.json.js +5 -0
  39. package/build/i18n/id.json.js.map +1 -1
  40. package/build/i18n/id.json.mjs +5 -0
  41. package/build/i18n/id.json.mjs.map +1 -1
  42. package/build/i18n/it.json +5 -0
  43. package/build/i18n/it.json.js +5 -0
  44. package/build/i18n/it.json.js.map +1 -1
  45. package/build/i18n/it.json.mjs +5 -0
  46. package/build/i18n/it.json.mjs.map +1 -1
  47. package/build/i18n/ja.json +5 -0
  48. package/build/i18n/ja.json.js +5 -0
  49. package/build/i18n/ja.json.js.map +1 -1
  50. package/build/i18n/ja.json.mjs +5 -0
  51. package/build/i18n/ja.json.mjs.map +1 -1
  52. package/build/i18n/pl.json +5 -0
  53. package/build/i18n/pl.json.js +5 -0
  54. package/build/i18n/pl.json.js.map +1 -1
  55. package/build/i18n/pl.json.mjs +5 -0
  56. package/build/i18n/pl.json.mjs.map +1 -1
  57. package/build/i18n/pt.json +5 -0
  58. package/build/i18n/pt.json.js +5 -0
  59. package/build/i18n/pt.json.js.map +1 -1
  60. package/build/i18n/pt.json.mjs +5 -0
  61. package/build/i18n/pt.json.mjs.map +1 -1
  62. package/build/i18n/ro.json +5 -0
  63. package/build/i18n/ro.json.js +5 -0
  64. package/build/i18n/ro.json.js.map +1 -1
  65. package/build/i18n/ro.json.mjs +5 -0
  66. package/build/i18n/ro.json.mjs.map +1 -1
  67. package/build/i18n/ru.json +5 -0
  68. package/build/i18n/ru.json.js +5 -0
  69. package/build/i18n/ru.json.js.map +1 -1
  70. package/build/i18n/ru.json.mjs +5 -0
  71. package/build/i18n/ru.json.mjs.map +1 -1
  72. package/build/i18n/tr.json +5 -0
  73. package/build/i18n/tr.json.js +5 -0
  74. package/build/i18n/tr.json.js.map +1 -1
  75. package/build/i18n/tr.json.mjs +5 -0
  76. package/build/i18n/tr.json.mjs.map +1 -1
  77. package/build/main.css +46 -22
  78. package/build/statusIcon/StatusIcon.js +4 -4
  79. package/build/statusIcon/StatusIcon.js.map +1 -1
  80. package/build/statusIcon/StatusIcon.mjs +4 -4
  81. package/build/statusIcon/StatusIcon.mjs.map +1 -1
  82. package/build/styles/avatar/Avatar.css +29 -0
  83. package/build/styles/badge/Badge.css +6 -0
  84. package/build/styles/circularButton/CircularButton.css +2 -2
  85. package/build/styles/common/circle/Circle.css +4 -0
  86. package/build/styles/main.css +46 -22
  87. package/build/styles/statusIcon/StatusIcon.css +0 -20
  88. package/build/types/avatar/Avatar.d.ts.map +1 -1
  89. package/build/types/badge/Badge.d.ts.map +1 -1
  90. package/build/types/common/circle/Circle.d.ts +1 -1
  91. package/build/types/common/circle/Circle.d.ts.map +1 -1
  92. package/build/types/statusIcon/StatusIcon.d.ts +7 -3
  93. package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
  94. package/package.json +3 -3
  95. package/src/avatar/Avatar.css +29 -0
  96. package/src/avatar/Avatar.less +12 -0
  97. package/src/avatar/Avatar.tsx +4 -8
  98. package/src/avatarWrapper/__snapshots__/AvatarWrapper.spec.tsx.snap +11 -22
  99. package/src/badge/Badge.css +6 -0
  100. package/src/badge/Badge.less +6 -0
  101. package/src/badge/Badge.tsx +1 -11
  102. package/src/circularButton/CircularButton.css +2 -2
  103. package/src/circularButton/CircularButton.less +1 -1
  104. package/src/circularButton/CircularButton.story.tsx +3 -0
  105. package/src/circularButton/CircularButton.tsx +1 -1
  106. package/src/circularButton/__snapshots__/CircularButton.spec.tsx.snap +10 -10
  107. package/src/common/circle/Circle.css +4 -0
  108. package/src/common/circle/Circle.less +6 -0
  109. package/src/common/circle/Circle.story.tsx +2 -2
  110. package/src/common/circle/Circle.tsx +25 -2
  111. package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +4 -8
  112. package/src/i18n/de.json +5 -0
  113. package/src/i18n/es.json +5 -0
  114. package/src/i18n/fr.json +5 -0
  115. package/src/i18n/hu.json +5 -0
  116. package/src/i18n/id.json +5 -0
  117. package/src/i18n/it.json +5 -0
  118. package/src/i18n/ja.json +5 -0
  119. package/src/i18n/pl.json +5 -0
  120. package/src/i18n/pt.json +5 -0
  121. package/src/i18n/ro.json +5 -0
  122. package/src/i18n/ru.json +5 -0
  123. package/src/i18n/tr.json +5 -0
  124. package/src/main.css +46 -22
  125. package/src/overlayHeader/__snapshots__/OverlayHeader.spec.tsx.snap +2 -4
  126. package/src/promoCard/PromoCard.spec.tsx +1 -1
  127. package/src/radio/__snapshots__/Radio.rtl.spec.tsx.snap +2 -4
  128. package/src/statusIcon/StatusIcon.css +0 -20
  129. package/src/statusIcon/StatusIcon.less +0 -17
  130. package/src/statusIcon/StatusIcon.spec.tsx +2 -21
  131. package/src/statusIcon/StatusIcon.story.tsx +32 -1
  132. package/src/statusIcon/StatusIcon.tsx +11 -10
@@ -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)}