@transferwise/components 0.0.0-experimental-3cfaec8 → 0.0.0-experimental-ea557c7
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 +558 -503
- package/build/sentimentSurface/SentimentSurface.js +2 -9
- package/build/sentimentSurface/SentimentSurface.js.map +1 -1
- package/build/sentimentSurface/SentimentSurface.mjs +2 -9
- package/build/sentimentSurface/SentimentSurface.mjs.map +1 -1
- package/build/styles/css/neptune.css +11 -11
- package/build/styles/less/legacy-variables.less +1 -1
- package/build/styles/less/neptune-tokens.less +2 -2
- package/build/styles/main.css +558 -503
- package/build/styles/props/custom-media.css +1 -1
- package/build/styles/props/neptune-tokens.css +1 -1
- package/build/styles/sentimentSurface/SentimentSurface.css +337 -325
- package/build/styles/styles/less/neptune.css +11 -11
- package/build/types/sentimentSurface/SentimentSurface.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/criticalBanner/CriticalCommsBanner.test.tsx +1 -1
- package/src/main.css +558 -503
- package/src/sentimentSurface/SentimentSurface.css +337 -325
- package/src/sentimentSurface/SentimentSurface.docs.mdx +0 -2
- package/src/sentimentSurface/SentimentSurface.less +322 -2
- package/src/sentimentSurface/SentimentSurface.story.tsx +0 -4
- package/src/sentimentSurface/SentimentSurface.test.story.tsx +5 -1
- package/src/sentimentSurface/SentimentSurface.test.tsx +3 -84
- package/src/sentimentSurface/SentimentSurface.tsx +2 -10
- package/src/styles/less/neptune.css +11 -11
|
@@ -36,8 +36,6 @@ 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
|
|
41
39
|
`} />
|
|
42
40
|
|
|
43
41
|
## Using Tokens in Components
|
|
@@ -1,10 +1,330 @@
|
|
|
1
|
-
@import "@transferwise/neptune-tokens/sentiment/sentiments.css";
|
|
2
|
-
|
|
3
1
|
.wds-sentiment-surface {
|
|
4
2
|
&--hasBaseStyles {
|
|
5
3
|
background-color: var(--color-sentiment-background-surface);
|
|
6
4
|
color: var(--color-sentiment-content-primary);
|
|
7
5
|
}
|
|
8
6
|
|
|
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
|
+
|
|
9
284
|
--ring-outline-color: var(--color-sentiment-content-primary, var(--color-content-primary));
|
|
10
285
|
}
|
|
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,7 +83,11 @@ const ButtonsGrid = () => (
|
|
|
83
83
|
key={`${sentiment}-${emphasis}`}
|
|
84
84
|
sentiment={sentiment}
|
|
85
85
|
emphasis={emphasis}
|
|
86
|
-
|
|
86
|
+
style={{
|
|
87
|
+
backgroundColor: 'var(--color-sentiment-background-surface)',
|
|
88
|
+
color: 'var(--color-sentiment-content-primary)',
|
|
89
|
+
padding: '16px',
|
|
90
|
+
}}
|
|
87
91
|
>
|
|
88
92
|
<span
|
|
89
93
|
style={{
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ThemeProvider } from '@wise/components-theming';
|
|
2
|
-
|
|
3
1
|
import { render, screen } from '../test-utils';
|
|
4
2
|
import SentimentSurface from './SentimentSurface';
|
|
5
3
|
import { Sentiment, Emphasis } from './SentimentSurface.types';
|
|
@@ -64,7 +62,7 @@ describe('SentimentSurface', () => {
|
|
|
64
62
|
);
|
|
65
63
|
const element = screen.getByTestId('surface');
|
|
66
64
|
expect(element).toHaveClass('wds-sentiment-surface');
|
|
67
|
-
expect(element).toHaveClass(`wds-sentiment-${sentiment}-
|
|
65
|
+
expect(element).toHaveClass(`wds-sentiment-surface-${sentiment}-base`);
|
|
68
66
|
});
|
|
69
67
|
});
|
|
70
68
|
});
|
|
@@ -81,7 +79,7 @@ describe('SentimentSurface', () => {
|
|
|
81
79
|
);
|
|
82
80
|
const element = screen.getByTestId('surface');
|
|
83
81
|
expect(element).toHaveClass('wds-sentiment-surface');
|
|
84
|
-
expect(element).toHaveClass(`wds-sentiment-neutral
|
|
82
|
+
expect(element).toHaveClass(`wds-sentiment-surface-neutral-${emphasis}`);
|
|
85
83
|
});
|
|
86
84
|
});
|
|
87
85
|
|
|
@@ -93,7 +91,7 @@ describe('SentimentSurface', () => {
|
|
|
93
91
|
);
|
|
94
92
|
const element = screen.getByTestId('surface');
|
|
95
93
|
expect(element).toHaveClass('wds-sentiment-surface');
|
|
96
|
-
expect(element).toHaveClass('wds-sentiment-neutral-
|
|
94
|
+
expect(element).toHaveClass('wds-sentiment-surface-neutral-base');
|
|
97
95
|
});
|
|
98
96
|
});
|
|
99
97
|
|
|
@@ -139,85 +137,6 @@ describe('SentimentSurface', () => {
|
|
|
139
137
|
});
|
|
140
138
|
});
|
|
141
139
|
|
|
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
|
-
|
|
221
140
|
describe('HTML attributes', () => {
|
|
222
141
|
it('supports aria-label attribute', () => {
|
|
223
142
|
const ariaLabel = 'Surface label';
|
|
@@ -54,19 +54,11 @@ 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
|
|
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
|
-
|
|
57
|
+
const { className: closestBrandTheme } = useTheme();
|
|
66
58
|
const classNames = clsx(
|
|
67
59
|
closestBrandTheme,
|
|
68
60
|
BASE_CLASS,
|
|
69
|
-
|
|
61
|
+
`${BASE_CLASS}-${sentiment}-${emphasis}`,
|
|
70
62
|
hasBaseStyles && `${BASE_CLASS}--hasBaseStyles`,
|
|
71
63
|
className,
|
|
72
64
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Do not edit directly, this file was auto-generated.
|
|
3
|
-
* Generated on
|
|
3
|
+
* Generated on Thu, 14 May 2026 16:11:43 GMT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
:root {
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
|
|
145
145
|
/**
|
|
146
146
|
* Do not edit directly, this file was auto-generated.
|
|
147
|
-
* Generated on
|
|
147
|
+
* Generated on Thu, 14 May 2026 16:11:44 GMT
|
|
148
148
|
*/
|
|
149
149
|
|
|
150
150
|
.np-theme-personal {
|
|
@@ -328,7 +328,7 @@
|
|
|
328
328
|
|
|
329
329
|
/**
|
|
330
330
|
* Do not edit directly, this file was auto-generated.
|
|
331
|
-
* Generated on
|
|
331
|
+
* Generated on Thu, 14 May 2026 16:11:44 GMT
|
|
332
332
|
*/
|
|
333
333
|
|
|
334
334
|
.np-theme-personal--forest-green {
|
|
@@ -512,7 +512,7 @@
|
|
|
512
512
|
|
|
513
513
|
/**
|
|
514
514
|
* Do not edit directly, this file was auto-generated.
|
|
515
|
-
* Generated on
|
|
515
|
+
* Generated on Thu, 14 May 2026 16:11:44 GMT
|
|
516
516
|
*/
|
|
517
517
|
|
|
518
518
|
.np-theme-personal--bright-green {
|
|
@@ -696,7 +696,7 @@
|
|
|
696
696
|
|
|
697
697
|
/**
|
|
698
698
|
* Do not edit directly, this file was auto-generated.
|
|
699
|
-
* Generated on
|
|
699
|
+
* Generated on Thu, 14 May 2026 16:11:44 GMT
|
|
700
700
|
*/
|
|
701
701
|
|
|
702
702
|
.np-theme-personal--dark {
|
|
@@ -880,7 +880,7 @@
|
|
|
880
880
|
|
|
881
881
|
/**
|
|
882
882
|
* Do not edit directly, this file was auto-generated.
|
|
883
|
-
* Generated on
|
|
883
|
+
* Generated on Thu, 14 May 2026 16:11:44 GMT
|
|
884
884
|
*/
|
|
885
885
|
|
|
886
886
|
.np-theme-platform {
|
|
@@ -1064,7 +1064,7 @@
|
|
|
1064
1064
|
|
|
1065
1065
|
/**
|
|
1066
1066
|
* Do not edit directly, this file was auto-generated.
|
|
1067
|
-
* Generated on
|
|
1067
|
+
* Generated on Thu, 14 May 2026 16:11:44 GMT
|
|
1068
1068
|
*/
|
|
1069
1069
|
|
|
1070
1070
|
.np-theme-platform--forest-green {
|
|
@@ -1248,7 +1248,7 @@
|
|
|
1248
1248
|
|
|
1249
1249
|
/**
|
|
1250
1250
|
* Do not edit directly, this file was auto-generated.
|
|
1251
|
-
* Generated on
|
|
1251
|
+
* Generated on Thu, 14 May 2026 16:11:44 GMT
|
|
1252
1252
|
*/
|
|
1253
1253
|
|
|
1254
1254
|
.np-theme-business {
|
|
@@ -1433,7 +1433,7 @@
|
|
|
1433
1433
|
|
|
1434
1434
|
/**
|
|
1435
1435
|
* Do not edit directly, this file was auto-generated.
|
|
1436
|
-
* Generated on
|
|
1436
|
+
* Generated on Thu, 14 May 2026 16:11:44 GMT
|
|
1437
1437
|
*/
|
|
1438
1438
|
|
|
1439
1439
|
.np-theme-business--dark {
|
|
@@ -1618,7 +1618,7 @@
|
|
|
1618
1618
|
|
|
1619
1619
|
/**
|
|
1620
1620
|
* Do not edit directly, this file was auto-generated.
|
|
1621
|
-
* Generated on
|
|
1621
|
+
* Generated on Thu, 14 May 2026 16:11:44 GMT
|
|
1622
1622
|
*/
|
|
1623
1623
|
|
|
1624
1624
|
.np-theme-business--forest-green {
|
|
@@ -1803,7 +1803,7 @@
|
|
|
1803
1803
|
|
|
1804
1804
|
/**
|
|
1805
1805
|
* Do not edit directly, this file was auto-generated.
|
|
1806
|
-
* Generated on
|
|
1806
|
+
* Generated on Thu, 14 May 2026 16:11:44 GMT
|
|
1807
1807
|
*/
|
|
1808
1808
|
|
|
1809
1809
|
.np-theme-business--bright-green {
|