@@ -229,10 +229,52 @@ const CellCore = (props: CellCoreProps): React.ReactElement => {
229
229
) ;
230
230
} ;
231
231
232
+ const cellTokens = {
233
+ root : {
234
+ default : {
235
+ background : semanticColor . surface . primary ,
236
+ foreground : semanticColor . text . primary ,
237
+ } ,
238
+ hover : {
239
+ background : color . fadedBlue8 ,
240
+ } ,
241
+ press : {
242
+ background : color . fadedBlue8 ,
243
+ border : semanticColor . surface . emphasis ,
244
+ } ,
245
+ selected : {
246
+ background : color . fadedBlue8 ,
247
+ foreground : color . activeBlue ,
248
+ border : semanticColor . surface . emphasis ,
249
+ } ,
250
+ focus : {
251
+ border : semanticColor . focus . outer ,
252
+ } ,
253
+ disabled : {
254
+ foreground : semanticColor . text . disabled ,
255
+ border : semanticColor . focus . outer ,
256
+ } ,
257
+ } ,
258
+ accessory : {
259
+ default : {
260
+ foreground : semanticColor . icon . primary ,
261
+ } ,
262
+ selected : {
263
+ foreground : semanticColor . icon . action ,
264
+ } ,
265
+ disabled : {
266
+ // Use secondary icon color for disabled state because opacity is
267
+ // also applied to the accessory. Opacity is used so it is applied
268
+ // to images also
269
+ foreground : semanticColor . icon . secondary ,
270
+ } ,
271
+ } ,
272
+ } ;
273
+
232
274
const styles = StyleSheet . create ( {
233
275
wrapper : {
234
- background : color . white ,
235
- color : color . offBlack ,
276
+ background : cellTokens . root . default . background ,
277
+ color : cellTokens . root . default . foreground ,
236
278
display : "flex" ,
237
279
minHeight : CellMeasurements . cellMinHeight ,
238
280
textAlign : "left" ,
@@ -262,13 +304,14 @@ const styles = StyleSheet.create({
262
304
activeInnerWrapper : {
263
305
position : "relative" ,
264
306
":before" : {
307
+ // Styles for the left bar indicator
265
308
content : "''" ,
266
309
position : "absolute" ,
267
310
top : 0 ,
268
311
left : 0 ,
269
312
bottom : 0 ,
270
313
width : border . width . thick ,
271
- backgroundColor : semanticColor . surface . emphasis ,
314
+ backgroundColor : cellTokens . root . selected . border ,
272
315
} ,
273
316
} ,
274
317
@@ -291,7 +334,7 @@ const styles = StyleSheet.create({
291
334
accessoryRight : {
292
335
// The right accessory will have this color by default. Unless the
293
336
// accessory element overrides that color internally.
294
- color : semanticColor . icon . primary ,
337
+ color : cellTokens . accessory . default . foreground ,
295
338
} ,
296
339
297
340
/**
@@ -333,21 +376,21 @@ const styles = StyleSheet.create({
333
376
// that the focus ring is drawn inside the cell.
334
377
width : `calc(100% - ${ spacing . xxxSmall_4 } px)` ,
335
378
height : `calc(100% - ${ spacing . xxxSmall_4 } px)` ,
336
- border : `${ spacing . xxxxSmall_2 } px solid ${ color . blue } ` ,
379
+ border : `${ spacing . xxxxSmall_2 } px solid ${ cellTokens . root . focus . border } ` ,
337
380
borderRadius : spacing . xxxSmall_4 ,
338
381
} ,
339
382
[ ":focus-visible[aria-disabled=true]:after" as any ] : {
340
- borderColor : semanticColor . focus . outer ,
383
+ borderColor : cellTokens . root . disabled . border ,
341
384
} ,
342
385
343
386
// hover + enabled
344
387
[ ":hover[aria-disabled=false]" as any ] : {
345
- background : color . fadedBlue8 ,
388
+ background : cellTokens . root . hover . background ,
346
389
} ,
347
390
348
391
// pressed + enabled
349
392
[ ":active[aria-disabled=false]" as any ] : {
350
- background : color . fadedBlue8 ,
393
+ background : cellTokens . root . press . background ,
351
394
} ,
352
395
// press + enabled + not currently selected (active prop: false)
353
396
// We apply the left bar indicator styles on the inner-wrapper element
@@ -372,21 +415,13 @@ const styles = StyleSheet.create({
372
415
} ,
373
416
374
417
active : {
375
- background : color . fadedBlue8 ,
376
- color : color . activeBlue ,
418
+ background : cellTokens . root . selected . background ,
419
+ color : cellTokens . root . selected . foreground ,
377
420
cursor : "default" ,
378
-
379
- [ ":hover[aria-disabled=false]" as any ] : {
380
- background : color . fadedBlue8 ,
381
- } ,
382
-
383
- [ ":active[aria-disabled=false]" as any ] : {
384
- background : color . fadedBlue8 ,
385
- } ,
386
421
} ,
387
422
388
423
disabled : {
389
- color : color . offBlack32 ,
424
+ color : cellTokens . root . disabled . foreground ,
390
425
":focus-visible" : {
391
426
// Prevent the focus ring from being displayed when the cell is
392
427
// disabled.
@@ -395,11 +430,11 @@ const styles = StyleSheet.create({
395
430
} ,
396
431
397
432
accessoryActive : {
398
- color : color . blue ,
433
+ color : cellTokens . accessory . selected . foreground ,
399
434
} ,
400
435
401
436
accessoryDisabled : {
402
- color : color . offBlack ,
437
+ color : cellTokens . accessory . disabled . foreground ,
403
438
opacity : 0.32 ,
404
439
} ,
405
440
} ) ;
0 commit comments