@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
@@ -0,0 +1,296 @@
1
+ .wds-sentiment-surface {
2
+ background-color: var(--color-sentiment-background-surface);
3
+ color: var(--color-sentiment-content-primary);
4
+
5
+ &-negative {
6
+ .np-theme-personal &,
7
+ .np-theme-personal--bright-green & {
8
+ &-base {
9
+ .sentiment-surface-tokens(
10
+ #CB272F, #B8232B, #A72027,
11
+ #CB272F, #B8232B, #A72027,
12
+ #FBEAEA, #F9E1E1, #F8D8D8,
13
+ #F5D3D4, #F0BDBE, #ECACAD,
14
+ #FBEAEA, #F9E1E1, #F8D8D8,
15
+ #FBEAEA, #F9E1E1, #F8D8D8
16
+ );
17
+ }
18
+ &-elevated {
19
+ .sentiment-surface-tokens(
20
+ #FFFFFF, #F5CCCC, #F1B7B7,
21
+ #FBEAEA, #F5CCCC, #F1B7B7,
22
+ #CB272F, #B8232B, #A72027,
23
+ #9B141B, #831116, #6D0E13,
24
+ #CB272F, #B8232B, #A72027,
25
+ #90000D, #B8232B, #A72027
26
+ );
27
+ }
28
+ }
29
+
30
+ .np-theme-personal--dark &,
31
+ .np-theme-personal--forest-green & {
32
+ &-base {
33
+ .sentiment-surface-tokens(
34
+ #FFA8AD, #FFBDC0, #FFD1D3,
35
+ #FFA8AD, #FFBDC0, #FFD1D3,
36
+ #410B0D, #641115, #761418,
37
+ #601013, #7A1519, #90181D,
38
+ #410B0D, #641115, #761418,
39
+ #410B0D, #641115, #761418
40
+ );
41
+ }
42
+ &-elevated {
43
+ .sentiment-surface-tokens(
44
+ #410B0D, #641115, #761418,
45
+ #410B0D, #641115, #761418,
46
+ #FFA8AD, #FFBDC0, #FFD1D3,
47
+ #D9898D, #D68084, #D06C71,
48
+ #FFA8AD, #FFBDC0, #FFD1D3,
49
+ #FFA8AD, #FFBDC0, #FFD1D3
50
+ );
51
+ }
52
+ }
53
+ }
54
+
55
+ &-warning {
56
+ .np-theme-personal &,
57
+ .np-theme-personal--bright-green & {
58
+ &-base {
59
+ .sentiment-surface-tokens(
60
+ #4A3B1C, #302612, #2C2311, // content-primary (default, hover, active)
61
+ #FFD11A, #FFBF0F, #FFBB00, // interactive-primary
62
+ #FFF7D7, #FFF0B2, #FFE98F, // interactive-secondary
63
+ #FFEC9E, #FFE187, #FFD55F, // interactive-secondary-neutral
64
+ #4A3B1C, #302612, #2C2311, // interactive-control
65
+ #FFF7D7, #FFF0B2, #FFE98F // background-surface
66
+ );
67
+ }
68
+ &-elevated {
69
+ .sentiment-surface-tokens(
70
+ #4A3B1C, #302612, #2C2311, // content-primary
71
+ #4A3B1C, #302612, #2C2311, // interactive-primary
72
+ #FFD11A, #FFBF0F, #FFBB00, // interactive-secondary
73
+ #FFEC9E, #FFEDB8, #FFF2CC, // interactive-secondary-neutral
74
+ #FFD11A, #FFBF0F, #FFBB00, // interactive-control
75
+ #FFD11A, #FFBF0F, #FFBB00 // background-surface
76
+ );
77
+ }
78
+ }
79
+
80
+ .np-theme-personal--dark &,
81
+ .np-theme-personal--forest-green & {
82
+ &-base {
83
+ .sentiment-surface-tokens(
84
+ #FADC65, #F9D648, #F8CD20, // content-primary
85
+ #FADC65, #F9D648, #F8CD20, // interactive-primary
86
+ #3A3523, #504930, #665D3D, // interactive-secondary
87
+ #4D462A, #5D532F, #685D33, // interactive-secondary-neutral
88
+ #3A3523, #504930, #665D3D, // interactive-control
89
+ #3A3523, #504930, #665D3D // background-surface
90
+ );
91
+ }
92
+ &-elevated {
93
+ .sentiment-surface-tokens(
94
+ #3A3523, #504930, #665D3D, // content-primary
95
+ #3A3523, #504930, #665D3D, // interactive-primary
96
+ #FADC65, #F9D648, #F8CD20, // interactive-secondary
97
+ #E3C85D, #DFC044, #D9B526, // interactive-secondary-neutral
98
+ #FADC65, #F9D648, #F8CD20, // interactive-control
99
+ #FADC65, #F9D648, #F8CD20 // background-surface
100
+ );
101
+ }
102
+ }
103
+ }
104
+ &-success {
105
+ .np-theme-personal &,
106
+ .np-theme-personal--bright-green & {
107
+ &-base {
108
+ .sentiment-surface-tokens(
109
+ #054D28, #043A1E, #022614, // content-primary (default, hover, active)
110
+ #054D28, #043A1E, #022614, // interactive-primary
111
+ #E2F6D5, #D3F2C0, #C5EDAB, // interactive-secondary
112
+ #BCD9B8, #AACFA5, #94C38E, // interactive-secondary-neutral
113
+ #E2F6D5, #D3F2C0, #C5EDAB, // interactive-control
114
+ #E2F6D5, #D3F2C0, #C5EDAB // background-surface
115
+ );
116
+ }
117
+ &-elevated {
118
+ .sentiment-surface-tokens(
119
+ #E2F6D5, #D3F2C0, #C5EDAB, // content-primary
120
+ #E2F6D5, #D3F2C0, #C5EDAB, // interactive-primary
121
+ #054D28, #043A1E, #022614, // interactive-secondary
122
+ #256A43, #2A794C, #329057, // interactive-secondary-neutral
123
+ #054D28, #043A1E, #022614, // interactive-control
124
+ #054D28, #043A1E, #022614 // background-surface
125
+ );
126
+ }
127
+ }
128
+
129
+ .np-theme-personal--dark &,
130
+ .np-theme-personal--forest-green & {
131
+ &-base {
132
+ .sentiment-surface-tokens(
133
+ #BAE5A0, #C8EAB3, #D6F0C7, // content-primary
134
+ #BAE5A0, #C8EAB3, #D6F0C7, // interactive-primary
135
+ #252C20, #323B2B, #3E4A36, // interactive-secondary
136
+ #37422F, #46533B, #546548, // interactive-secondary-neutral
137
+ #252C20, #323B2B, #3E4A36, // interactive-control
138
+ #252C20, #323B2B, #3E4A36 // background-surface
139
+ );
140
+ }
141
+ &-elevated {
142
+ .sentiment-surface-tokens(
143
+ #252C20, #323B2B, #3E4A36, // content-primary
144
+ #252C20, #323B2B, #3E4A36, // interactive-primary
145
+ #BAE5A0, #C8EAB3, #D6F0C7, // interactive-secondary
146
+ #A8CF91, #94C478, #83BB63, // interactive-secondary-neutral
147
+ #BAE5A0, #C8EAB3, #D6F0C7, // interactive-control
148
+ #BAE5A0, #C8EAB3, #D6F0C7 // background-surface
149
+ );
150
+ }
151
+ }
152
+ }
153
+ &-neutral {
154
+ .np-theme-personal &,
155
+ .np-theme-personal--bright-green & {
156
+ &-base {
157
+ .sentiment-surface-tokens(
158
+ #454745, #353635, #232423, // content-primary (default, hover, active)
159
+ #454745, #353635, #232423, // interactive-primary
160
+ #F1F1ED, #E7E7E1, #DFDED5, // interactive-secondary
161
+ #E4E4DC, #DCDCD2, #D3D2C6, // interactive-secondary-neutral
162
+ #F1F1ED, #E7E7E1, #DFDED5, // interactive-control
163
+ #F1F1ED, #E7E7E1, #DFDED5 // background-surface
164
+ );
165
+ }
166
+ &-elevated {
167
+ .sentiment-surface-tokens(
168
+ #F1F1ED, #E7E7E1, #DFDED5, // content-primary
169
+ #F1F1ED, #E7E7E1, #DFDED5, // interactive-primary
170
+ #454745, #353635, #232423, // interactive-secondary
171
+ #5A5C5A, #6D6F6D, #727472, // interactive-secondary-neutral
172
+ #454745, #353635, #232423, // interactive-control
173
+ #454745, #353635, #232423 // background-surface
174
+ );
175
+ }
176
+ }
177
+
178
+ .np-theme-personal--dark &,
179
+ .np-theme-personal--forest-green & {
180
+ &-base {
181
+ .sentiment-surface-tokens(
182
+ #F1F1ED, #E7E7E1, #DFDED5, // content-primary
183
+ #F1F1ED, #E7E7E1, #DFDED5, // interactive-primary
184
+ #2A2C29, #414441, #595B58, // interactive-secondary
185
+ #424441, #4C4E4B, #565955, // interactive-secondary-neutral
186
+ #2A2C29, #414441, #595B58, // interactive-control
187
+ #2A2C29, #414441, #595B58 // background-surface
188
+ );
189
+ }
190
+ &-elevated {
191
+ .sentiment-surface-tokens(
192
+ #2A2C29, #414441, #595B58, // content-primary
193
+ #2A2C29, #414441, #595B58, // interactive-primary
194
+ #F1F1ED, #E7E7E1, #DFDED5, // interactive-secondary
195
+ #E4E4DC, #DCDCD2, #D3D2C6, // interactive-secondary-neutral
196
+ #F1F1ED, #E7E7E1, #DFDED5, // interactive-control
197
+ #F1F1ED, #E7E7E1, #DFDED5 // background-surface
198
+ );
199
+ }
200
+ }
201
+ }
202
+ &-proposition {
203
+ .np-theme-personal &,
204
+ .np-theme-personal--bright-green & {
205
+ &-base {
206
+ .sentiment-surface-tokens(
207
+ #0E0F0C, #0A2826, #074140, // content-primary (default, hover, active)
208
+ #054D4D, #043A3A, #022626, // interactive-primary
209
+ #E0F7F7, #CAF1F1, #B6ECEC, // interactive-secondary
210
+ #B4D5D5, #A3CCCC, #9AC6C6, // interactive-secondary-neutral
211
+ #E0F7F7, #CAF1F1, #B6ECEC, // interactive-control
212
+ #E0F7F7, #CAF1F1, #B6ECEC // background-surface
213
+ );
214
+ }
215
+ &-elevated {
216
+ .sentiment-surface-tokens(
217
+ #FFFFFF, #EAF9F9, #D5F4F4, // content-primary
218
+ #E0F7F7, #CAF1F1, #B6ECEC, // interactive-primary
219
+ #054D4D, #043A3A, #022626, // interactive-secondary
220
+ #1F6161, #247070, #298080, // interactive-secondary-neutral
221
+ #054D4D, #043A3A, #022626, // interactive-control
222
+ #054D4D, #043A3A, #022626 // background-surface
223
+ );
224
+ }
225
+ }
226
+
227
+ .np-theme-personal--dark &,
228
+ .np-theme-personal--forest-green & {
229
+ &-base {
230
+ .sentiment-surface-tokens(
231
+ #FFFFFF, #EAF9F9, #D5F4F4, // content-primary
232
+ #E0F7F7, #CAF1F1, #B6ECEC, // interactive-primary
233
+ #0B312F, #124F4C, #176460, // interactive-secondary
234
+ #174E4D, #1D6261, #237675, // interactive-secondary-neutral
235
+ #0B312F, #124F4C, #176460, // interactive-control
236
+ #0B312F, #124F4C, #176460 // background-surface
237
+ );
238
+ }
239
+ &-elevated {
240
+ .sentiment-surface-tokens(
241
+ #0E0F0C, #0A2826, #074140, // content-primary
242
+ #0B312F, #104744, #16605C, // interactive-primary
243
+ #E0F7F7, #CAF1F1, #B6ECEC, // interactive-secondary
244
+ #B4D5D5, #A3CCCC, #9AC6C6, // interactive-secondary-neutral
245
+ #E0F7F7, #CAF1F1, #B6ECEC, // interactive-control
246
+ #E0F7F7, #CAF1F1, #B6ECEC // background-surface
247
+ );
248
+ }
249
+ }
250
+ }
251
+ }
252
+
253
+ .sentiment-surface-tokens(
254
+ @content-primary,
255
+ @content-primary-hover,
256
+ @content-primary-active,
257
+ @interactive-primary,
258
+ @interactive-primary-hover,
259
+ @interactive-primary-active,
260
+ @interactive-secondary,
261
+ @interactive-secondary-hover,
262
+ @interactive-secondary-active,
263
+ @interactive-secondary-neutral,
264
+ @interactive-secondary-neutral-hover,
265
+ @interactive-secondary-neutral-active,
266
+ @interactive-control,
267
+ @interactive-control-hover,
268
+ @interactive-control-active,
269
+ @background-surface,
270
+ @background-surface-hover,
271
+ @background-surface-active
272
+ ) {
273
+ --color-sentiment-content-primary: @content-primary;
274
+ --color-sentiment-content-primary-hover: @content-primary-hover;
275
+ --color-sentiment-content-primary-active: @content-primary-active;
276
+
277
+ --color-sentiment-interactive-primary: @interactive-primary;
278
+ --color-sentiment-interactive-primary-hover: @interactive-primary-hover;
279
+ --color-sentiment-interactive-primary-active: @interactive-primary-active;
280
+
281
+ --color-sentiment-interactive-secondary: @interactive-secondary;
282
+ --color-sentiment-interactive-secondary-hover: @interactive-secondary-hover;
283
+ --color-sentiment-interactive-secondary-active: @interactive-secondary-active;
284
+
285
+ --color-sentiment-interactive-secondary-neutral: @interactive-secondary-neutral;
286
+ --color-sentiment-interactive-secondary-neutral-hover: @interactive-secondary-neutral-hover;
287
+ --color-sentiment-interactive-secondary-neutral-active: @interactive-secondary-neutral-active;
288
+
289
+ --color-sentiment-interactive-control: @interactive-control;
290
+ --color-sentiment-interactive-control-hover: @interactive-control-hover;
291
+ --color-sentiment-interactive-control-active: @interactive-control-active;
292
+
293
+ --color-sentiment-background-surface: @background-surface;
294
+ --color-sentiment-background-surface-hover: @background-surface-hover;
295
+ --color-sentiment-background-surface-active: @background-surface-active;
296
+ }
@@ -0,0 +1,140 @@
1
+ import { render, screen } from '../test-utils';
2
+ import SentimentSurface from './SentimentSurface';
3
+ import { Sentiment, Emphasis } from './SentimentSurface.types';
4
+
5
+ describe('SentimentSurface', () => {
6
+ const testContent = 'Test content';
7
+
8
+ describe('rendering', () => {
9
+ it('renders with children', () => {
10
+ render(<SentimentSurface sentiment="neutral">{testContent}</SentimentSurface>);
11
+ expect(screen.getByText(testContent)).toBeInTheDocument();
12
+ });
13
+
14
+ it('renders as div by default', () => {
15
+ render(
16
+ <SentimentSurface sentiment="neutral" testId="surface">
17
+ {testContent}
18
+ </SentimentSurface>,
19
+ );
20
+ expect(screen.getByTestId('surface').tagName).toBe('DIV');
21
+ });
22
+
23
+ it('renders as custom element when as prop is provided', () => {
24
+ render(
25
+ <SentimentSurface sentiment="neutral" as="section" testId="surface">
26
+ {testContent}
27
+ </SentimentSurface>,
28
+ );
29
+ expect(screen.getByTestId('surface').tagName).toBe('SECTION');
30
+ });
31
+ });
32
+
33
+ describe('sentiment variants', () => {
34
+ const sentiments: Sentiment[] = ['negative', 'warning', 'neutral', 'success', 'proposition'];
35
+
36
+ sentiments.forEach((sentiment) => {
37
+ it(`renders ${sentiment} sentiment with correct class`, () => {
38
+ render(
39
+ <SentimentSurface sentiment={sentiment} testId="surface">
40
+ {testContent}
41
+ </SentimentSurface>,
42
+ );
43
+ const element = screen.getByTestId('surface');
44
+ expect(element).toHaveClass('wds-sentiment-surface');
45
+ expect(element).toHaveClass(`wds-sentiment-surface-${sentiment}-base`);
46
+ });
47
+ });
48
+ });
49
+
50
+ describe('emphasis variants', () => {
51
+ const emphasisLevels: Emphasis[] = ['base', 'elevated'];
52
+
53
+ emphasisLevels.forEach((emphasis) => {
54
+ it(`renders ${emphasis} emphasis with correct class`, () => {
55
+ render(
56
+ <SentimentSurface sentiment="neutral" emphasis={emphasis} testId="surface">
57
+ {testContent}
58
+ </SentimentSurface>,
59
+ );
60
+ const element = screen.getByTestId('surface');
61
+ expect(element).toHaveClass('wds-sentiment-surface');
62
+ expect(element).toHaveClass(`wds-sentiment-surface-neutral-${emphasis}`);
63
+ });
64
+ });
65
+
66
+ it('defaults to base emphasis when not provided', () => {
67
+ render(
68
+ <SentimentSurface sentiment="neutral" testId="surface">
69
+ {testContent}
70
+ </SentimentSurface>,
71
+ );
72
+ const element = screen.getByTestId('surface');
73
+ expect(element).toHaveClass('wds-sentiment-surface');
74
+ expect(element).toHaveClass('wds-sentiment-surface-neutral-base');
75
+ });
76
+ });
77
+
78
+ describe('custom props', () => {
79
+ it('applies custom className', () => {
80
+ const customClass = 'custom-class';
81
+ render(
82
+ <SentimentSurface sentiment="neutral" className={customClass} testId="surface">
83
+ {testContent}
84
+ </SentimentSurface>,
85
+ );
86
+ expect(screen.getByTestId('surface')).toHaveClass(customClass);
87
+ });
88
+
89
+ it('applies custom id', () => {
90
+ const customId = 'custom-id';
91
+ render(
92
+ <SentimentSurface sentiment="neutral" id={customId}>
93
+ {testContent}
94
+ </SentimentSurface>,
95
+ );
96
+ expect(screen.getByText(testContent)).toHaveAttribute('id', customId);
97
+ });
98
+
99
+ it('applies testId via data-testid', () => {
100
+ const testId = 'test-surface';
101
+ render(
102
+ <SentimentSurface sentiment="neutral" testId={testId}>
103
+ {testContent}
104
+ </SentimentSurface>,
105
+ );
106
+ expect(screen.getByTestId(testId)).toBeInTheDocument();
107
+ });
108
+
109
+ it('applies custom style', () => {
110
+ const customStyle = { padding: '20px' };
111
+ render(
112
+ <SentimentSurface sentiment="neutral" style={customStyle} testId="surface">
113
+ {testContent}
114
+ </SentimentSurface>,
115
+ );
116
+ expect(screen.getByTestId('surface')).toHaveStyle(customStyle);
117
+ });
118
+ });
119
+
120
+ describe('HTML attributes', () => {
121
+ it('supports aria-label attribute', () => {
122
+ const ariaLabel = 'Surface label';
123
+ render(
124
+ <SentimentSurface sentiment="neutral" aria-label={ariaLabel} testId="surface">
125
+ {testContent}
126
+ </SentimentSurface>,
127
+ );
128
+ expect(screen.getByTestId('surface')).toHaveAttribute('aria-label', ariaLabel);
129
+ });
130
+
131
+ it('supports role attribute', () => {
132
+ render(
133
+ <SentimentSurface sentiment="neutral" role="region" testId="surface">
134
+ {testContent}
135
+ </SentimentSurface>,
136
+ );
137
+ expect(screen.getByTestId('surface')).toHaveAttribute('role', 'region');
138
+ });
139
+ });
140
+ });