Skip to content

Commit 971162c

Browse files
fix: S2 ListView polish styles (adobe#9717)
* fix: S2 ListBox styles for scrollbars * remove corner radius for non quiet * fix: ListView item size and borders (adobe#9723) * always round first and last items * fix focus ring * force rounded corners when focused --------- Co-authored-by: Devon Govett <devongovett@gmail.com>
1 parent cdbfe48 commit 971162c

1 file changed

Lines changed: 79 additions & 88 deletions

File tree

packages/@react-spectrum/s2/src/ListView.tsx

Lines changed: 79 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,8 @@ const listitem = style<GridListItemRenderProps & {
280280
selectionStyle?: 'highlight' | 'checkbox',
281281
scale?: 'medium' | 'large'
282282
}>({
283-
...focusRing(),
283+
outlineStyle: 'none',
284284
boxSizing: 'border-box',
285-
outlineOffset: -2,
286285
columnGap: 0,
287286
paddingX: 0,
288287
paddingY: 8,
@@ -320,7 +319,6 @@ const listitem = style<GridListItemRenderProps & {
320319
default: 'default',
321320
isLink: 'pointer'
322321
},
323-
transition: 'default',
324322
'--borderColor': {
325323
type: 'borderColor',
326324
value: {
@@ -339,54 +337,16 @@ const listitem = style<GridListItemRenderProps & {
339337
default: 1,
340338
isLastItem: {
341339
default: 1,
342-
isQuiet: {
343-
selectionStyle: {
344-
checkbox: 0,
345-
highlight: {
346-
default: 0,
347-
isSelected: 1
348-
}
349-
}
350-
}
340+
isQuiet: 0
351341
}
352342
},
353343
borderStartWidth: 0,
354344
borderEndWidth: 0,
355345
borderStyle: 'solid',
356346
borderColor: {
357347
default: '--borderColor',
358-
isSelected: {
359-
selectionStyle: {
360-
highlight: {
361-
default: 'transparent',
362-
isNextSelected: 'transparent'
363-
},
364-
checkbox: {
365-
default: '--borderColor',
366-
isNextSelected: selectedBackground
367-
}
368-
}
369-
}
370-
},
371-
borderTopStartRadius: {
372-
isFirstItem: 'default'
373-
},
374-
borderTopEndRadius: {
375-
isFirstItem: 'default'
376-
},
377-
borderBottomStartRadius: {
378-
isLastItem: {
379-
isQuiet: {
380-
isSelected: 'default'
381-
}
382-
}
383-
},
384-
borderBottomEndRadius: {
385-
isLastItem: {
386-
isQuiet: {
387-
isSelected: 'default'
388-
}
389-
}
348+
isNextSelected: 'transparent',
349+
isSelected: 'transparent'
390350
}
391351
});
392352

@@ -400,22 +360,22 @@ const listRowBackground = style<GridListItemRenderProps & {
400360
isNextNotSelected?: boolean,
401361
selectionStyle?: 'highlight' | 'checkbox'
402362
}>({
363+
...focusRing(),
364+
outlineOffset: -2,
403365
position: 'absolute',
404366
zIndex: -1,
405-
top: 0,
367+
top: {
368+
default: 0,
369+
isSelected: '[-1px]',
370+
// Don't overlap focus ring of row above.
371+
isPrevSelected: 0,
372+
isFirstItem: 0
373+
},
406374
left: 0,
407375
right: 0,
408376
bottom: {
409377
default: 0,
410-
isSelected: {
411-
selectionStyle: {
412-
checkbox: 0,
413-
highlight: {
414-
default: 0,
415-
isNextSelected: '[-1px]'
416-
}
417-
}
418-
}
378+
isSelected: '[-1px]'
419379
},
420380
backgroundColor: {
421381
default: '--rowBackgroundColor',
@@ -440,9 +400,10 @@ const listRowBackground = style<GridListItemRenderProps & {
440400
isFocusVisible: selectedActiveBackground
441401
},
442402
highlight: {
443-
default: 'blue-900/10',
444-
isHovered: 'blue-900/15',
445-
isPressed: 'blue-900/15'
403+
// Use solid colors rather than transparent because the rows overlap.
404+
default: colorMix('gray-25', 'blue-900', 10),
405+
isHovered: colorMix('gray-25', 'blue-900', 15),
406+
isPressed: colorMix('gray-25', 'blue-900', 15)
446407
}
447408
}
448409
},
@@ -451,64 +412,94 @@ const listRowBackground = style<GridListItemRenderProps & {
451412
}
452413
},
453414
borderTopStartRadius: {
454-
isFirstItem: 'default'
415+
isFirstItem: {
416+
isSelected: {
417+
selectionStyle: {
418+
checkbox: 'none',
419+
highlight: 'default'
420+
}
421+
},
422+
isQuiet: 'default',
423+
isFocusVisible: 'default'
424+
}
455425
},
456426
borderTopEndRadius: {
457-
isFirstItem: 'default'
427+
isFirstItem: {
428+
isSelected: {
429+
selectionStyle: {
430+
checkbox: 'none',
431+
highlight: 'default'
432+
}
433+
},
434+
isQuiet: 'default',
435+
isFocusVisible: 'default'
436+
}
458437
},
459438
borderBottomStartRadius: {
460439
isLastItem: {
461-
isQuiet: {
462-
isSelected: 'default'
463-
}
440+
isSelected: {
441+
selectionStyle: {
442+
checkbox: 'none',
443+
highlight: 'default'
444+
}
445+
},
446+
isQuiet: 'default',
447+
isFocusVisible: 'default'
464448
}
465449
},
466450
borderBottomEndRadius: {
467451
isLastItem: {
468-
isQuiet: {
469-
isSelected: 'default'
470-
}
452+
isSelected: {
453+
selectionStyle: {
454+
checkbox: 'none',
455+
highlight: 'default'
456+
}
457+
},
458+
isQuiet: 'default',
459+
isFocusVisible: 'default'
471460
}
472461
},
473462
borderTopWidth: {
474-
default: 1,
475-
isPrevSelected: {
463+
default: {
476464
selectionStyle: {
477-
highlight: 0,
478-
checkbox: 0
465+
checkbox: 0,
466+
highlight: 1
479467
}
480-
}
468+
},
469+
isPrevSelected: 0
481470
},
482471
borderBottomWidth: {
483-
default: 1,
484-
isNextSelected: {
472+
default: {
485473
selectionStyle: {
486-
highlight: 0,
487-
checkbox: 0
474+
checkbox: 0,
475+
highlight: 1
488476
}
489477
},
490-
isLastItem: {
491-
default: 1,
492-
isQuiet: {
493-
selectionStyle: {
494-
checkbox: 0,
495-
highlight: {
496-
default: 0,
497-
isSelected: 1
498-
}
499-
}
478+
isNextSelected: 0
479+
},
480+
borderStartWidth: {
481+
default: {
482+
selectionStyle: {
483+
checkbox: 0,
484+
highlight: 1
485+
}
486+
}
487+
},
488+
borderEndWidth: {
489+
default: {
490+
selectionStyle: {
491+
checkbox: 0,
492+
highlight: 1
500493
}
501494
}
502495
},
503-
borderStartWidth: 1,
504-
borderEndWidth: 1,
505496
borderStyle: 'solid',
506497
borderColor: {
507498
default: 'transparent',
508499
isSelected: {
509500
selectionStyle: {
510-
highlight: '--borderColor',
511-
checkbox: 'transparent'
501+
checkbox: 'transparent',
502+
highlight: '--borderColor'
512503
}
513504
}
514505
}

0 commit comments

Comments
 (0)