@transferwise/components 46.115.0 → 46.116.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 (65) hide show
  1. package/build/criticalBanner/CriticalCommsBanner.js +1 -0
  2. package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
  3. package/build/criticalBanner/CriticalCommsBanner.mjs +1 -0
  4. package/build/criticalBanner/CriticalCommsBanner.mjs.map +1 -1
  5. package/build/main.css +428 -36
  6. package/build/mocks.js +7 -0
  7. package/build/mocks.js.map +1 -1
  8. package/build/mocks.mjs +7 -1
  9. package/build/mocks.mjs.map +1 -1
  10. package/build/sentimentSurface/SentimentSurface.js +43 -0
  11. package/build/sentimentSurface/SentimentSurface.js.map +1 -0
  12. package/build/sentimentSurface/SentimentSurface.mjs +39 -0
  13. package/build/sentimentSurface/SentimentSurface.mjs.map +1 -0
  14. package/build/sentimentSurface/classMap.js +17 -0
  15. package/build/sentimentSurface/classMap.js.map +1 -0
  16. package/build/sentimentSurface/classMap.mjs +14 -0
  17. package/build/sentimentSurface/classMap.mjs.map +1 -0
  18. package/build/statusIcon/StatusIcon.js +10 -1
  19. package/build/statusIcon/StatusIcon.js.map +1 -1
  20. package/build/statusIcon/StatusIcon.mjs +10 -1
  21. package/build/statusIcon/StatusIcon.mjs.map +1 -1
  22. package/build/styles/main.css +428 -36
  23. package/build/styles/sentimentSurface/SentimentSurface.css +424 -0
  24. package/build/styles/statusIcon/StatusIcon.css +4 -36
  25. package/build/types/criticalBanner/CriticalCommsBanner.d.ts +2 -1
  26. package/build/types/criticalBanner/CriticalCommsBanner.d.ts.map +1 -1
  27. package/build/types/mocks.d.ts +1 -0
  28. package/build/types/mocks.d.ts.map +1 -1
  29. package/build/types/sentimentSurface/SentimentSurface.d.ts +30 -0
  30. package/build/types/sentimentSurface/SentimentSurface.d.ts.map +1 -0
  31. package/build/types/sentimentSurface/SentimentSurface.types.d.ts +80 -0
  32. package/build/types/sentimentSurface/SentimentSurface.types.d.ts.map +1 -0
  33. package/build/types/sentimentSurface/classMap.d.ts +4 -0
  34. package/build/types/sentimentSurface/classMap.d.ts.map +1 -0
  35. package/build/types/sentimentSurface/index.d.ts +3 -0
  36. package/build/types/sentimentSurface/index.d.ts.map +1 -0
  37. package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
  38. package/build/types/test-utils/window-mock.d.ts +1 -0
  39. package/build/types/test-utils/window-mock.d.ts.map +1 -1
  40. package/package.json +3 -8
  41. package/src/criticalBanner/CriticalCommsBanner.tsx +3 -2
  42. package/src/expressiveMoneyInput/ExpressiveMoneyInput.spec.tsx +229 -0
  43. package/src/expressiveMoneyInput/amountInput/AmountInput.spec.tsx +282 -0
  44. package/src/expressiveMoneyInput/currencySelector/CurrencySelector.spec.tsx +160 -0
  45. package/src/inputs/SelectInput.spec.tsx +7 -1
  46. package/src/main.css +428 -36
  47. package/src/main.less +2 -0
  48. package/src/mocks.ts +7 -0
  49. package/src/moneyInput/MoneyInput.spec.tsx +9 -1
  50. package/src/provider/theme/ThemeProvider.story.tsx +78 -11
  51. package/src/sentimentSurface/SentimentSurface.css +424 -0
  52. package/src/sentimentSurface/SentimentSurface.docs.mdx +527 -0
  53. package/src/sentimentSurface/SentimentSurface.less +296 -0
  54. package/src/sentimentSurface/SentimentSurface.spec.tsx +140 -0
  55. package/src/sentimentSurface/SentimentSurface.story.tsx +340 -0
  56. package/src/sentimentSurface/SentimentSurface.tests.story.tsx +123 -0
  57. package/src/sentimentSurface/SentimentSurface.tsx +72 -0
  58. package/src/sentimentSurface/SentimentSurface.types.ts +104 -0
  59. package/src/sentimentSurface/classMap.ts +15 -0
  60. package/src/sentimentSurface/index.ts +8 -0
  61. package/src/statusIcon/StatusIcon.css +4 -36
  62. package/src/statusIcon/StatusIcon.less +3 -41
  63. package/src/statusIcon/StatusIcon.tsx +14 -1
  64. package/src/test-utils/jest.setup.ts +0 -5
  65. package/src/test-utils/window-mock.ts +5 -0
@@ -1,38 +1,6 @@
1
- .status-circle .light {
2
- color: var(--color-contrast-overlay);
1
+ .wds-sentiment-surface.status-circle {
2
+ background-color: var(--color-sentiment-interactive-primary);
3
3
  }
4
- .np-theme-personal--bright-green .status-circle .light {
5
- color: var(--color-white);
6
- }
7
- .status-circle .dark {
8
- color: #37517e;
9
- color: var(--color-content-primary);
10
- }
11
- .status-circle.warning,
12
- .status-circle.pending {
13
- background-color: var(--color-sentiment-warning);
14
- }
15
- .np-theme-personal .status-circle.warning .status-icon,
16
- .np-theme-personal .status-circle.pending .status-icon {
17
- color: var(--color-dark);
18
- }
19
- .status-circle.negative,
20
- .status-circle.error {
21
- background-color: var(--color-sentiment-negative);
22
- }
23
- .status-circle.negative .status-icon,
24
- .status-circle.error .status-icon {
25
- color: var(--color-sentiment-negative-secondary);
26
- }
27
- .status-circle.neutral {
28
- background-color: #5d7079;
29
- background-color: var(--color-content-secondary);
30
- }
31
- .status-circle.positive,
32
- .status-circle.success {
33
- background-color: var(--color-sentiment-positive);
34
- }
35
- .status-circle.positive .status-icon,
36
- .status-circle.success .status-icon {
37
- color: var(--color-sentiment-positive-secondary);
4
+ .wds-sentiment-surface.status-circle .status-icon {
5
+ color: var(--color-sentiment-interactive-control);
38
6
  }
@@ -1,44 +1,6 @@
1
- .status-circle {
2
- .light {
3
- color: var(--color-contrast-overlay);
4
-
5
- .np-theme-personal--bright-green & {
6
- color: var(--color-white);
7
- }
8
- }
9
-
10
- .dark {
11
- color: var(--color-content-primary);
12
- }
13
-
14
- &.warning,
15
- &.pending {
16
- background-color: var(--color-sentiment-warning);
17
-
18
- .status-icon {
19
- .np-theme-personal & {
20
- color: var(--color-dark);
21
- }
22
- }
23
- }
24
- }
25
-
26
- .status-circle.negative,
27
- .status-circle.error {
28
- background-color: var(--color-sentiment-negative);
29
- .status-icon {
30
- color: var(--color-sentiment-negative-secondary);
31
- }
32
- }
33
-
34
- .status-circle.neutral {
35
- background-color: var(--color-content-secondary);
36
- }
37
-
38
- .status-circle.positive,
39
- .status-circle.success {
40
- background-color: var(--color-sentiment-positive);
1
+ .wds-sentiment-surface.status-circle {
2
+ background-color: var(--color-sentiment-interactive-primary);
41
3
  .status-icon {
42
- color: var(--color-sentiment-positive-secondary);
4
+ color: var(--color-sentiment-interactive-control);
43
5
  }
44
6
  }
@@ -1,7 +1,9 @@
1
1
  import { Info, Alert, Cross, Check, ClockBorderless } from '@transferwise/icons';
2
2
  import { clsx } from 'clsx';
3
3
  import { useIntl } from 'react-intl';
4
+ import { PropsWithChildren } from 'react';
4
5
 
6
+ import SentimentSurface from '../sentimentSurface';
5
7
  import { SizeSmall, SizeMedium, SizeLarge, Sentiment, Size, Breakpoint, Status } from '../common';
6
8
  import Circle, { CircleProps } from '../common/circle';
7
9
  import { useMedia } from '../common/hooks/useMedia';
@@ -81,9 +83,20 @@ const StatusIcon = ({ sentiment = 'neutral', size: sizeProp = 40, iconLabel }: S
81
83
  const iconColor = sentiment === 'warning' || sentiment === 'pending' ? 'dark' : 'light';
82
84
  const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);
83
85
  const size = mapLegacySize[sizeProp] ?? sizeProp;
86
+ // eslint-disable-next-line react/no-unstable-nested-components
87
+ const SentimentSurfaceSetting = (props: PropsWithChildren<Pick<CircleProps, 'className'>>) => (
88
+ <SentimentSurface
89
+ as="span"
90
+ // @ts-expect-error sentiment and SentimentSurface types mismatch
91
+ sentiment={
92
+ sentiment === 'positive' ? 'success' : sentiment === 'pending' ? 'warning' : sentiment
93
+ }
94
+ {...props}
95
+ />
96
+ );
84
97
  return (
85
98
  <Circle
86
- as="span"
99
+ as={SentimentSurfaceSetting}
87
100
  size={isTinyViewport && size < 40 ? 32 : size}
88
101
  data-testid="status-icon"
89
102
  className={clsx('status-circle', sentiment)}
@@ -5,11 +5,6 @@ import fetchMock from 'jest-fetch-mock';
5
5
 
6
6
  global.fetch = fetchMock as unknown as typeof global.fetch;
7
7
 
8
- global.requestAnimationFrame = (callback: (time: number) => void): number => {
9
- callback(performance.now());
10
- return 0;
11
- };
12
-
13
8
  Object.defineProperty(global, 'TextEncoder', {
14
9
  value: util.TextEncoder,
15
10
  });
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  mockMatchMedia as baseMockMatchMedia,
3
3
  mockResizeObserver as baseMockResizeObserver,
4
+ mockRequestAnimationFrame as baseMockRequestAnimationFrame,
4
5
  } from '../mocks';
5
6
 
6
7
  export function mockMatchMedia() {
@@ -12,3 +13,7 @@ export function mockResizeObserver() {
12
13
  // https://github.com/jsdom/jsdom/issues/3368
13
14
  baseMockResizeObserver(jest);
14
15
  }
16
+
17
+ export function mockRequestAnimationFrame() {
18
+ baseMockRequestAnimationFrame();
19
+ }