@transferwise/components 46.145.0 → 46.147.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.
- package/build/main.css +509 -551
- package/build/nudge/Nudge.js.map +1 -1
- package/build/nudge/Nudge.mjs.map +1 -1
- package/build/prompt/InfoPrompt/InfoPrompt.js +1 -1
- package/build/prompt/InfoPrompt/InfoPrompt.js.map +1 -1
- package/build/prompt/InfoPrompt/InfoPrompt.mjs +2 -2
- package/build/prompt/InfoPrompt/InfoPrompt.mjs.map +1 -1
- package/build/sentimentSurface/SentimentSurface.js +9 -2
- package/build/sentimentSurface/SentimentSurface.js.map +1 -1
- package/build/sentimentSurface/SentimentSurface.mjs +9 -2
- package/build/sentimentSurface/SentimentSurface.mjs.map +1 -1
- package/build/styles/main.css +509 -551
- package/build/styles/nudge/Nudge.css +11 -0
- package/build/styles/sentimentSurface/SentimentSurface.css +325 -337
- package/build/types/nudge/Nudge.d.ts +1 -1
- package/build/types/nudge/Nudge.d.ts.map +1 -1
- package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts +3 -2
- package/build/types/prompt/InfoPrompt/InfoPrompt.d.ts.map +1 -1
- package/build/types/sentimentSurface/SentimentSurface.d.ts.map +1 -1
- package/package.json +24 -20
- package/src/criticalBanner/CriticalCommsBanner.test.tsx +1 -1
- package/src/main.css +509 -551
- package/src/nudge/Nudge.css +11 -0
- package/src/nudge/Nudge.less +4 -0
- package/src/nudge/Nudge.story.tsx +9 -0
- package/src/nudge/Nudge.tsx +2 -1
- package/src/prompt/InfoPrompt/InfoPrompt.story.tsx +42 -0
- package/src/prompt/InfoPrompt/InfoPrompt.test.tsx +65 -1
- package/src/prompt/InfoPrompt/InfoPrompt.tsx +15 -4
- package/src/sentimentSurface/SentimentSurface.css +325 -337
- package/src/sentimentSurface/SentimentSurface.docs.mdx +2 -0
- package/src/sentimentSurface/SentimentSurface.less +2 -322
- package/src/sentimentSurface/SentimentSurface.story.tsx +4 -0
- package/src/sentimentSurface/SentimentSurface.test.story.tsx +1 -5
- package/src/sentimentSurface/SentimentSurface.test.tsx +84 -3
- package/src/sentimentSurface/SentimentSurface.tsx +10 -2
|
@@ -36,6 +36,8 @@ Each `SentimentSurface` sets tokens for content, interactive elements, and backg
|
|
|
36
36
|
--color-sentiment-background-surface
|
|
37
37
|
--color-sentiment-background-surface-hover
|
|
38
38
|
--color-sentiment-background-surface-active
|
|
39
|
+
|
|
40
|
+
--color-sentiment-border-overlay
|
|
39
41
|
`} />
|
|
40
42
|
|
|
41
43
|
## Using Tokens in Components
|
|
@@ -1,330 +1,10 @@
|
|
|
1
|
+
@import "@transferwise/neptune-tokens/sentiment/sentiments.css";
|
|
2
|
+
|
|
1
3
|
.wds-sentiment-surface {
|
|
2
4
|
&--hasBaseStyles {
|
|
3
5
|
background-color: var(--color-sentiment-background-surface);
|
|
4
6
|
color: var(--color-sentiment-content-primary);
|
|
5
7
|
}
|
|
6
8
|
|
|
7
|
-
&-negative {
|
|
8
|
-
.np-theme-personal&,
|
|
9
|
-
.np-theme-business&,
|
|
10
|
-
.np-theme-platform&,
|
|
11
|
-
.np-theme-personal--bright-green&,
|
|
12
|
-
.np-theme-business--bright-green& {
|
|
13
|
-
&-base {
|
|
14
|
-
.sentiment-surface-tokens(
|
|
15
|
-
#CB272F, #B8232B, #A72027,
|
|
16
|
-
#CB272F, #B8232B, #A72027,
|
|
17
|
-
#FBEAEA, #F9E1E1, #F8D8D8,
|
|
18
|
-
#F5D3D4, #F0BDBE, #ECACAD,
|
|
19
|
-
#FBEAEA, #F9E1E1, #F8D8D8,
|
|
20
|
-
#FBEAEA, #F9E1E1, #F8D8D8
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
&-elevated {
|
|
24
|
-
.sentiment-surface-tokens(
|
|
25
|
-
#FFFFFF, #F5CCCC, #F1B7B7,
|
|
26
|
-
#FBEAEA, #F5CCCC, #F1B7B7,
|
|
27
|
-
#CB272F, #B8232B, #A72027,
|
|
28
|
-
#9B141B, #831116, #6D0e13,
|
|
29
|
-
#CB272F, #B8232B, #A72027,
|
|
30
|
-
#CB272F, #B8232B, #A72027
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.np-theme-personal--dark&,
|
|
36
|
-
.np-theme-business--dark&,
|
|
37
|
-
.np-theme-personal--forest-green&,
|
|
38
|
-
.np-theme-business--forest-green&,
|
|
39
|
-
.np-theme-platform--forest-green& {
|
|
40
|
-
&-base {
|
|
41
|
-
.sentiment-surface-tokens(
|
|
42
|
-
#FFA8AD, #FFBDC0, #FFD1D3,
|
|
43
|
-
#FFA8AD, #FFBDC0, #FFD1D3,
|
|
44
|
-
#410B0D, #641115, #761418,
|
|
45
|
-
#601013, #7A1519, #90181D,
|
|
46
|
-
#410B0D, #641115, #761418,
|
|
47
|
-
#410B0D, #641115, #761418
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
&-elevated {
|
|
51
|
-
.sentiment-surface-tokens(
|
|
52
|
-
#410B0D, #641115, #761418,
|
|
53
|
-
#410B0D, #641115, #761418,
|
|
54
|
-
#FFA8AD, #FFBDC0, #FFD1D3,
|
|
55
|
-
#D9898D, #D68084, #D06C71,
|
|
56
|
-
#FFA8AD, #FFBDC0, #FFD1D3,
|
|
57
|
-
#FFA8AD, #FFBDC0, #FFD1D3
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
&-warning {
|
|
64
|
-
.np-theme-personal&,
|
|
65
|
-
.np-theme-business&,
|
|
66
|
-
.np-theme-platform&,
|
|
67
|
-
.np-theme-personal--bright-green&,
|
|
68
|
-
.np-theme-business--bright-green& {
|
|
69
|
-
&-base {
|
|
70
|
-
.sentiment-surface-tokens(
|
|
71
|
-
#4A3B1C, #302612, #2C2311, // content-primary (default, hover, active)
|
|
72
|
-
#FFD11A, #FFBF0F, #FFBB00, // interactive-primary
|
|
73
|
-
#FFF7D7, #FFF0B2, #FFE98F, // interactive-secondary
|
|
74
|
-
#FFEC9E, #FFE187, #FFD55F, // interactive-secondary-neutral
|
|
75
|
-
#4A3B1C, #302612, #2C2311, // interactive-control
|
|
76
|
-
#FFF7D7, #FFF0B2, #FFE98F // background-surface
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
&-elevated {
|
|
80
|
-
.sentiment-surface-tokens(
|
|
81
|
-
#4A3B1C, #302612, #2C2311, // content-primary
|
|
82
|
-
#4A3B1C, #302612, #2C2311, // interactive-primary
|
|
83
|
-
#FFD11A, #FFBF0F, #FFBB00, // interactive-secondary
|
|
84
|
-
#FFEC9E, #FFEDB8, #FFF2CC, // interactive-secondary-neutral
|
|
85
|
-
#FFD11A, #FFBF0F, #FFBB00, // interactive-control
|
|
86
|
-
#FFD11A, #FFBF0F, #FFBB00 // background-surface
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.np-theme-personal--dark&,
|
|
92
|
-
.np-theme-business--dark&,
|
|
93
|
-
.np-theme-personal--forest-green&,
|
|
94
|
-
.np-theme-business--forest-green&,
|
|
95
|
-
.np-theme-platform--forest-green& {
|
|
96
|
-
&-base {
|
|
97
|
-
.sentiment-surface-tokens(
|
|
98
|
-
#FADC65, #F9D648, #F8CD20, // content-primary
|
|
99
|
-
#FADC65, #F9D648, #F8CD20, // interactive-primary
|
|
100
|
-
#3A3523, #504930, #665D3D, // interactive-secondary
|
|
101
|
-
#4D462A, #5D532F, #685D33, // interactive-secondary-neutral
|
|
102
|
-
#3A3523, #504930, #665D3D, // interactive-control
|
|
103
|
-
#3A3523, #504930, #665D3D // background-surface
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
&-elevated {
|
|
107
|
-
.sentiment-surface-tokens(
|
|
108
|
-
#3A3523, #504930, #665D3D, // content-primary
|
|
109
|
-
#3A3523, #504930, #665D3D, // interactive-primary
|
|
110
|
-
#FADC65, #F9D648, #F8CD20, // interactive-secondary
|
|
111
|
-
#E3C85D, #DFC044, #D9B526, // interactive-secondary-neutral
|
|
112
|
-
#FADC65, #F9D648, #F8CD20, // interactive-control
|
|
113
|
-
#FADC65, #F9D648, #F8CD20 // background-surface
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
&-success {
|
|
119
|
-
.np-theme-personal&,
|
|
120
|
-
.np-theme-business&,
|
|
121
|
-
.np-theme-platform&,
|
|
122
|
-
.np-theme-personal--bright-green&,
|
|
123
|
-
.np-theme-business--bright-green& {
|
|
124
|
-
&-base {
|
|
125
|
-
.sentiment-surface-tokens(
|
|
126
|
-
#054D28, #043A1E, #022614, // content-primary (default, hover, active)
|
|
127
|
-
#054D28, #043A1E, #022614, // interactive-primary
|
|
128
|
-
#E2F6D5, #D3F2C0, #C5EDAB, // interactive-secondary
|
|
129
|
-
#BCD9B8, #AACFA5, #94C38E, // interactive-secondary-neutral
|
|
130
|
-
#E2F6D5, #D3F2C0, #C5EDAB, // interactive-control
|
|
131
|
-
#E2F6D5, #D3F2C0, #C5EDAB // background-surface
|
|
132
|
-
);
|
|
133
|
-
}
|
|
134
|
-
&-elevated {
|
|
135
|
-
.sentiment-surface-tokens(
|
|
136
|
-
#CEF1B8, #E0FFCC, #E1F4D4, // content-primary
|
|
137
|
-
#CEF1B8, #E0FFCC, #E1F4D4, // interactive-primary
|
|
138
|
-
#054D28, #043A1E, #022614, // interactive-secondary
|
|
139
|
-
#256A43, #2A794C, #329057, // interactive-secondary-neutral
|
|
140
|
-
#054D28, #043A1E, #022614, // interactive-control
|
|
141
|
-
#054D28, #043A1E, #022614 // background-surface
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
.np-theme-personal--dark&,
|
|
147
|
-
.np-theme-business--dark&,
|
|
148
|
-
.np-theme-personal--forest-green&,
|
|
149
|
-
.np-theme-business--forest-green&,
|
|
150
|
-
.np-theme-platform--forest-green& {
|
|
151
|
-
&-base {
|
|
152
|
-
.sentiment-surface-tokens(
|
|
153
|
-
#CEF1B8, #E0FFCC, #E1F4D4, // content-primary
|
|
154
|
-
#CEF1B8, #E0FFCC, #E1F4D4, // interactive-primary
|
|
155
|
-
#054D28, #043A1E, #022614, // interactive-secondary
|
|
156
|
-
#256A43, #2A794C, #329057, // interactive-secondary-neutral
|
|
157
|
-
#054D28, #043A1E, #022614, // interactive-control
|
|
158
|
-
#054D28, #043A1E, #022614 // background-surface
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
&-elevated {
|
|
162
|
-
.sentiment-surface-tokens(
|
|
163
|
-
#252C20, #323B2B, #3E4A36, // content-primary
|
|
164
|
-
#252C20, #323B2B, #3E4A36, // interactive-primary
|
|
165
|
-
#BAE5A0, #C8EAB3, #D6F0C7, // interactive-secondary
|
|
166
|
-
#A8CF91, #94C478, #83BB63, // interactive-secondary-neutral
|
|
167
|
-
#BAE5A0, #C8EAB3, #D6F0C7, // interactive-control
|
|
168
|
-
#BAE5A0, #C8EAB3, #D6F0C7 // background-surface
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
&-neutral {
|
|
174
|
-
.np-theme-personal&,
|
|
175
|
-
.np-theme-business&,
|
|
176
|
-
.np-theme-platform&,
|
|
177
|
-
.np-theme-personal--bright-green&,
|
|
178
|
-
.np-theme-business--bright-green& {
|
|
179
|
-
&-base {
|
|
180
|
-
.sentiment-surface-tokens(
|
|
181
|
-
#454745, #353635, #232423, // content-primary (default, hover, active)
|
|
182
|
-
#454745, #353635, #232423, // interactive-primary
|
|
183
|
-
rgba(62, 59, 7, 0.07), rgba(62, 59, 7, 0.12), rgba(62, 59, 7, 0.17), // interactive-secondary
|
|
184
|
-
rgba(62, 59, 7, 0.07), rgba(62, 59, 7, 0.12), rgba(62, 59, 7, 0.17), // interactive-secondary-neutral
|
|
185
|
-
#F1F1ED, #E7E7E1, #DFDED5, // interactive-control
|
|
186
|
-
rgba(62, 59, 7, 0.07), rgba(62, 59, 7, 0.12), rgba(62, 59, 7, 0.17) // background-surface
|
|
187
|
-
);
|
|
188
|
-
}
|
|
189
|
-
&-elevated {
|
|
190
|
-
.sentiment-surface-tokens(
|
|
191
|
-
#F1F1ED, #E7E7E1, #DFDED5, // content-primary
|
|
192
|
-
#F1F1ED, #E7E7E1, #DFDED5, // interactive-primary
|
|
193
|
-
#454745, #353635, #232423, // interactive-secondary
|
|
194
|
-
#585958, #6A6C6A, #7D7E7D, // interactive-secondary-neutral
|
|
195
|
-
#454745, #353635, #232423, // interactive-control
|
|
196
|
-
#454745, #353635, #232423 // background-surface
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.np-theme-personal--dark&,
|
|
202
|
-
.np-theme-business--dark&,
|
|
203
|
-
.np-theme-personal--forest-green&,
|
|
204
|
-
.np-theme-business--forest-green&,
|
|
205
|
-
.np-theme-platform--forest-green& {
|
|
206
|
-
&-base {
|
|
207
|
-
.sentiment-surface-tokens(
|
|
208
|
-
#F1F1ED, #E7E7E1, #DFDED5, // content-primary
|
|
209
|
-
#F1F1ED, #E7E7E1, #DFDED5, // interactive-primary
|
|
210
|
-
rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.20), rgba(255, 255, 255, 0.30), // interactive-secondary
|
|
211
|
-
rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.20), rgba(255, 255, 255, 0.30), // interactive-secondary-neutral
|
|
212
|
-
#2A2C29, #414441, #595B58, // interactive-control
|
|
213
|
-
rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.20), rgba(255, 255, 255, 0.30) // background-surface
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
&-elevated {
|
|
217
|
-
.sentiment-surface-tokens(
|
|
218
|
-
#2A2C29, #414441, #595B58, // content-primary
|
|
219
|
-
#2A2C29, #414441, #595B58, // interactive-primary
|
|
220
|
-
#F1F1ED, #E7E7E1, #DFDED5, // interactive-secondary
|
|
221
|
-
#E4E4DC, #DCDCD2, #D3D2C6, // interactive-secondary-neutral
|
|
222
|
-
#F1F1ED, #E7E7E1, #DFDED5, // interactive-control
|
|
223
|
-
#F1F1ED, #E7E7E1, #DFDED5 // background-surface
|
|
224
|
-
);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
&-proposition {
|
|
229
|
-
.np-theme-personal&,
|
|
230
|
-
.np-theme-business&,
|
|
231
|
-
.np-theme-platform&,
|
|
232
|
-
.np-theme-personal--bright-green&,
|
|
233
|
-
.np-theme-business--bright-green& {
|
|
234
|
-
&-base {
|
|
235
|
-
.sentiment-surface-tokens(
|
|
236
|
-
#0E0F0C, #0A2826, #074140, // content-primary (default, hover, active)
|
|
237
|
-
#054D4D, #043A3A, #022626, // interactive-primary
|
|
238
|
-
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-secondary
|
|
239
|
-
#B4D5D5, #A3CCCC, #9AC6C6, // interactive-secondary-neutral
|
|
240
|
-
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-control
|
|
241
|
-
#E0F7F7, #CAF1F1, #B6ECEC // background-surface
|
|
242
|
-
);
|
|
243
|
-
}
|
|
244
|
-
&-elevated {
|
|
245
|
-
.sentiment-surface-tokens(
|
|
246
|
-
#FFFFFF, #EAF9F9, #D5F4F4, // content-primary
|
|
247
|
-
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-primary
|
|
248
|
-
#054D4D, #043A3A, #022626, // interactive-secondary
|
|
249
|
-
#1F6161, #247070, #298080, // interactive-secondary-neutral
|
|
250
|
-
#054D4D, #043A3A, #022626, // interactive-control
|
|
251
|
-
#054D4D, #043A3A, #022626 // background-surface
|
|
252
|
-
);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
.np-theme-personal--dark&,
|
|
257
|
-
.np-theme-business--dark&,
|
|
258
|
-
.np-theme-personal--forest-green&,
|
|
259
|
-
.np-theme-business--forest-green&,
|
|
260
|
-
.np-theme-platform--forest-green& {
|
|
261
|
-
&-base {
|
|
262
|
-
.sentiment-surface-tokens(
|
|
263
|
-
#FFFFFF, #EAF9F9, #D5F4F4, // content-primary
|
|
264
|
-
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-primary
|
|
265
|
-
#054D4D, #043A3A, #022626, // interactive-secondary
|
|
266
|
-
#1F6161, #247070, #298080, // interactive-secondary-neutral
|
|
267
|
-
#054D4D, #043A3A, #022626, // interactive-control
|
|
268
|
-
#054D4D, #043A3A, #022626 // background-surface
|
|
269
|
-
);
|
|
270
|
-
}
|
|
271
|
-
&-elevated {
|
|
272
|
-
.sentiment-surface-tokens(
|
|
273
|
-
#0E0F0C, #0A2826, #074140, // content-primary
|
|
274
|
-
#0B312F, #104744, #16605C, // interactive-primary
|
|
275
|
-
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-secondary
|
|
276
|
-
#B4D5D5, #A3CCCC, #9AC6C6, // interactive-secondary-neutral
|
|
277
|
-
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-control
|
|
278
|
-
#E0F7F7, #CAF1F1, #B6ECEC // background-surface
|
|
279
|
-
);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
9
|
--ring-outline-color: var(--color-sentiment-content-primary, var(--color-content-primary));
|
|
285
10
|
}
|
|
286
|
-
|
|
287
|
-
.sentiment-surface-tokens(
|
|
288
|
-
@content-primary,
|
|
289
|
-
@content-primary-hover,
|
|
290
|
-
@content-primary-active,
|
|
291
|
-
@interactive-primary,
|
|
292
|
-
@interactive-primary-hover,
|
|
293
|
-
@interactive-primary-active,
|
|
294
|
-
@interactive-secondary,
|
|
295
|
-
@interactive-secondary-hover,
|
|
296
|
-
@interactive-secondary-active,
|
|
297
|
-
@interactive-secondary-neutral,
|
|
298
|
-
@interactive-secondary-neutral-hover,
|
|
299
|
-
@interactive-secondary-neutral-active,
|
|
300
|
-
@interactive-control,
|
|
301
|
-
@interactive-control-hover,
|
|
302
|
-
@interactive-control-active,
|
|
303
|
-
@background-surface,
|
|
304
|
-
@background-surface-hover,
|
|
305
|
-
@background-surface-active
|
|
306
|
-
) {
|
|
307
|
-
--color-sentiment-content-primary: @content-primary;
|
|
308
|
-
--color-sentiment-content-primary-hover: @content-primary-hover;
|
|
309
|
-
--color-sentiment-content-primary-active: @content-primary-active;
|
|
310
|
-
|
|
311
|
-
--color-sentiment-interactive-primary: @interactive-primary;
|
|
312
|
-
--color-sentiment-interactive-primary-hover: @interactive-primary-hover;
|
|
313
|
-
--color-sentiment-interactive-primary-active: @interactive-primary-active;
|
|
314
|
-
|
|
315
|
-
--color-sentiment-interactive-secondary: @interactive-secondary;
|
|
316
|
-
--color-sentiment-interactive-secondary-hover: @interactive-secondary-hover;
|
|
317
|
-
--color-sentiment-interactive-secondary-active: @interactive-secondary-active;
|
|
318
|
-
|
|
319
|
-
--color-sentiment-interactive-secondary-neutral: @interactive-secondary-neutral;
|
|
320
|
-
--color-sentiment-interactive-secondary-neutral-hover: @interactive-secondary-neutral-hover;
|
|
321
|
-
--color-sentiment-interactive-secondary-neutral-active: @interactive-secondary-neutral-active;
|
|
322
|
-
|
|
323
|
-
--color-sentiment-interactive-control: @interactive-control;
|
|
324
|
-
--color-sentiment-interactive-control-hover: @interactive-control-hover;
|
|
325
|
-
--color-sentiment-interactive-control-active: @interactive-control-active;
|
|
326
|
-
|
|
327
|
-
--color-sentiment-background-surface: @background-surface;
|
|
328
|
-
--color-sentiment-background-surface-hover: @background-surface-hover;
|
|
329
|
-
--color-sentiment-background-surface-active: @background-surface-active;
|
|
330
|
-
}
|
|
@@ -83,11 +83,7 @@ const ButtonsGrid = () => (
|
|
|
83
83
|
key={`${sentiment}-${emphasis}`}
|
|
84
84
|
sentiment={sentiment}
|
|
85
85
|
emphasis={emphasis}
|
|
86
|
-
|
|
87
|
-
backgroundColor: 'var(--color-sentiment-background-surface)',
|
|
88
|
-
color: 'var(--color-sentiment-content-primary)',
|
|
89
|
-
padding: '16px',
|
|
90
|
-
}}
|
|
86
|
+
className="p-a-2"
|
|
91
87
|
>
|
|
92
88
|
<span
|
|
93
89
|
style={{
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ThemeProvider } from '@wise/components-theming';
|
|
2
|
+
|
|
1
3
|
import { render, screen } from '../test-utils';
|
|
2
4
|
import SentimentSurface from './SentimentSurface';
|
|
3
5
|
import { Sentiment, Emphasis } from './SentimentSurface.types';
|
|
@@ -62,7 +64,7 @@ describe('SentimentSurface', () => {
|
|
|
62
64
|
);
|
|
63
65
|
const element = screen.getByTestId('surface');
|
|
64
66
|
expect(element).toHaveClass('wds-sentiment-surface');
|
|
65
|
-
expect(element).toHaveClass(`wds-sentiment
|
|
67
|
+
expect(element).toHaveClass(`wds-sentiment-${sentiment}-light-base`);
|
|
66
68
|
});
|
|
67
69
|
});
|
|
68
70
|
});
|
|
@@ -79,7 +81,7 @@ describe('SentimentSurface', () => {
|
|
|
79
81
|
);
|
|
80
82
|
const element = screen.getByTestId('surface');
|
|
81
83
|
expect(element).toHaveClass('wds-sentiment-surface');
|
|
82
|
-
expect(element).toHaveClass(`wds-sentiment-
|
|
84
|
+
expect(element).toHaveClass(`wds-sentiment-neutral-light-${emphasis}`);
|
|
83
85
|
});
|
|
84
86
|
});
|
|
85
87
|
|
|
@@ -91,7 +93,7 @@ describe('SentimentSurface', () => {
|
|
|
91
93
|
);
|
|
92
94
|
const element = screen.getByTestId('surface');
|
|
93
95
|
expect(element).toHaveClass('wds-sentiment-surface');
|
|
94
|
-
expect(element).toHaveClass('wds-sentiment-
|
|
96
|
+
expect(element).toHaveClass('wds-sentiment-neutral-light-base');
|
|
95
97
|
});
|
|
96
98
|
});
|
|
97
99
|
|
|
@@ -137,6 +139,85 @@ describe('SentimentSurface', () => {
|
|
|
137
139
|
});
|
|
138
140
|
});
|
|
139
141
|
|
|
142
|
+
describe('dark mode detection', () => {
|
|
143
|
+
it('uses dark mode class for forest-green theme', () => {
|
|
144
|
+
render(
|
|
145
|
+
<ThemeProvider theme="forest-green">
|
|
146
|
+
<SentimentSurface sentiment="negative" data-testid="surface">
|
|
147
|
+
{testContent}
|
|
148
|
+
</SentimentSurface>
|
|
149
|
+
</ThemeProvider>,
|
|
150
|
+
);
|
|
151
|
+
expect(screen.getByTestId('surface')).toHaveClass('wds-sentiment-negative-dark-base');
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it('uses dark mode class for business--forest-green theme', () => {
|
|
155
|
+
render(
|
|
156
|
+
<ThemeProvider theme="business--forest-green">
|
|
157
|
+
<SentimentSurface sentiment="warning" emphasis="elevated" data-testid="surface">
|
|
158
|
+
{testContent}
|
|
159
|
+
</SentimentSurface>
|
|
160
|
+
</ThemeProvider>,
|
|
161
|
+
);
|
|
162
|
+
expect(screen.getByTestId('surface')).toHaveClass('wds-sentiment-warning-dark-elevated');
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it('uses dark mode class for dark screen mode', () => {
|
|
166
|
+
render(
|
|
167
|
+
<ThemeProvider theme="personal" screenMode="dark">
|
|
168
|
+
<SentimentSurface sentiment="success" data-testid="surface">
|
|
169
|
+
{testContent}
|
|
170
|
+
</SentimentSurface>
|
|
171
|
+
</ThemeProvider>,
|
|
172
|
+
);
|
|
173
|
+
expect(screen.getByTestId('surface')).toHaveClass('wds-sentiment-success-dark-base');
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it('uses light mode class for bright-green theme', () => {
|
|
177
|
+
render(
|
|
178
|
+
<ThemeProvider theme="bright-green">
|
|
179
|
+
<SentimentSurface sentiment="neutral" data-testid="surface">
|
|
180
|
+
{testContent}
|
|
181
|
+
</SentimentSurface>
|
|
182
|
+
</ThemeProvider>,
|
|
183
|
+
);
|
|
184
|
+
expect(screen.getByTestId('surface')).toHaveClass('wds-sentiment-neutral-light-base');
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it('uses light mode class for np-theme-platform in light mode', () => {
|
|
188
|
+
render(
|
|
189
|
+
<ThemeProvider theme="platform" screenMode="light">
|
|
190
|
+
<SentimentSurface sentiment="neutral" data-testid="surface">
|
|
191
|
+
{testContent}
|
|
192
|
+
</SentimentSurface>
|
|
193
|
+
</ThemeProvider>,
|
|
194
|
+
);
|
|
195
|
+
expect(screen.getByTestId('surface')).toHaveClass('wds-sentiment-neutral-light-base');
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
it('uses light mode class for np-theme-platform in dark mode', () => {
|
|
199
|
+
render(
|
|
200
|
+
<ThemeProvider theme="platform" screenMode="dark">
|
|
201
|
+
<SentimentSurface sentiment="neutral" data-testid="surface">
|
|
202
|
+
{testContent}
|
|
203
|
+
</SentimentSurface>
|
|
204
|
+
</ThemeProvider>,
|
|
205
|
+
);
|
|
206
|
+
expect(screen.getByTestId('surface')).toHaveClass('wds-sentiment-neutral-light-base');
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
it('uses dark mode class for np-theme-platform--forest-green', () => {
|
|
210
|
+
render(
|
|
211
|
+
<ThemeProvider theme="platform--forest-green">
|
|
212
|
+
<SentimentSurface sentiment="negative" data-testid="surface">
|
|
213
|
+
{testContent}
|
|
214
|
+
</SentimentSurface>
|
|
215
|
+
</ThemeProvider>,
|
|
216
|
+
);
|
|
217
|
+
expect(screen.getByTestId('surface')).toHaveClass('wds-sentiment-negative-dark-base');
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
|
|
140
221
|
describe('HTML attributes', () => {
|
|
141
222
|
it('supports aria-label attribute', () => {
|
|
142
223
|
const ariaLabel = 'Surface label';
|
|
@@ -54,11 +54,19 @@ const SentimentSurface: SentimentSurfaceComponent = forwardRef(function Sentimen
|
|
|
54
54
|
) {
|
|
55
55
|
const Element = as ?? 'div';
|
|
56
56
|
const BASE_CLASS = 'wds-sentiment-surface';
|
|
57
|
-
const { className: closestBrandTheme } = useTheme();
|
|
57
|
+
const { className: closestBrandTheme, isScreenModeDark: isDark, theme } = useTheme();
|
|
58
|
+
|
|
59
|
+
const getThemeBrightness = () => {
|
|
60
|
+
const isForestGreen = theme.includes('forest-green');
|
|
61
|
+
const isPlatform = theme.includes('platform');
|
|
62
|
+
|
|
63
|
+
return isForestGreen || (isDark && !isPlatform) ? 'dark' : 'light';
|
|
64
|
+
};
|
|
65
|
+
|
|
58
66
|
const classNames = clsx(
|
|
59
67
|
closestBrandTheme,
|
|
60
68
|
BASE_CLASS,
|
|
61
|
-
|
|
69
|
+
`wds-sentiment-${sentiment}-${getThemeBrightness()}-${emphasis}`,
|
|
62
70
|
hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`,
|
|
63
71
|
className,
|
|
64
72
|
);
|