11import * as stylex from '@stylexjs/stylex' ;
22
3- import { colorVars , fontWeightVars , radiusVars , scrollFadeVars , space , typeScaleVars } from '../../tokens.stylex' ;
3+ import {
4+ colorVars ,
5+ durationVars ,
6+ focusVars ,
7+ fontWeightVars ,
8+ radiusVars ,
9+ scrollFadeVars ,
10+ space ,
11+ typeScaleVars ,
12+ } from '../../tokens.stylex' ;
13+ import { tableStateMarker } from './table.markers.stylex' ;
414
515const surface = 'var(--_cl-table-surface)' ;
616const tint = 'var(--_cl-table-row-tint)' ;
@@ -45,50 +55,60 @@ export const styles = stylex.create({
4555 '--_cl-table-surface' : colorVars [ '--cl-color-background-subtle' ] ,
4656 backgroundColor : colorVars [ '--cl-color-background-subtle' ] ,
4757 } ,
48- bodyRow : {
49- borderBlockStartColor : colorVars [ '--cl-color-border' ] ,
50- borderBlockStartStyle : 'solid' ,
51- borderBlockStartWidth : '1px' ,
52- } ,
53- interactiveRow : {
58+ row : {
5459 '--_cl-table-row-tint' : {
5560 default : null ,
56- '@media (hover: hover)' : { ':hover' : colorVars [ '--cl-color-background-subtle' ] } ,
61+ ':where([data-selected])' : colorVars [ '--cl-color-neutral-alpha-100' ] ,
62+ '@media (hover: hover)' : {
63+ default : null ,
64+ ':where([data-actionable]:not([data-selected]):hover)' : colorVars [ '--cl-color-background-subtle' ] ,
65+ } ,
5766 } ,
5867 backgroundColor : {
5968 default : null ,
60- '@media (hover: hover)' : { ':hover' : colorVars [ '--cl-color-background-subtle' ] } ,
69+ ':where([data-selected])' : colorVars [ '--cl-color-neutral-alpha-100' ] ,
70+ '@media (hover: hover)' : {
71+ default : null ,
72+ ':where([data-actionable]:not([data-selected]):hover)' : colorVars [ '--cl-color-background-subtle' ] ,
73+ } ,
6174 } ,
62- cursor : 'pointer' ,
63- } ,
64- selectedRow : {
65- '--_cl-table-row-tint ' : colorVars [ '--cl-color-neutral-alpha-100' ] ,
66- backgroundColor : colorVars [ '--cl-color-neutral-alpha-100' ] ,
75+ borderBlockStartColor : colorVars [ '--cl-color-border' ] ,
76+ borderBlockStartStyle : 'solid' ,
77+ borderBlockStartWidth : '1px' ,
78+ cursor : { default : null , ':where([data-actionable]) ' : 'pointer' } ,
79+ position : 'relative' ,
6780 } ,
68- headerCell : {
81+ column : {
6982 paddingBlock : space [ '2.5' ] ,
7083 paddingInline : space [ '4' ] ,
7184 color : colorVars [ '--cl-color-foreground-secondary' ] ,
7285 fontSize : typeScaleVars [ '--cl-text-xs-size' ] ,
7386 fontWeight : fontWeightVars [ '--cl-font-medium' ] ,
7487 lineHeight : typeScaleVars [ '--cl-text-xs-leading' ] ,
88+ position : 'relative' ,
7589 verticalAlign : 'middle' ,
7690 whiteSpace : 'nowrap' ,
7791 } ,
78- sortableHeaderCell : {
79- paddingBlock : space [ '1.5' ] ,
80- paddingInline : space [ '2' ] ,
92+ sortableColumn : {
93+ color : {
94+ default : colorVars [ '--cl-color-foreground-secondary' ] ,
95+ '@media (hover: hover)' : { default : null , ':hover' : colorVars [ '--cl-color-foreground' ] } ,
96+ } ,
97+ cursor : 'pointer' ,
98+ userSelect : 'none' ,
8199 } ,
82- sortButton : {
83- color : 'inherit' ,
84- fontWeight : 'inherit' ,
100+ sortLabel : {
101+ gap : space [ '1' ] ,
102+ alignItems : 'center' ,
103+ display : 'inline-flex' ,
85104 } ,
86105 cell : {
87106 paddingBlock : space [ '3' ] ,
88107 paddingInline : space [ '4' ] ,
89108 color : colorVars [ '--cl-color-foreground' ] ,
90109 fontSize : typeScaleVars [ '--cl-text-sm-size' ] ,
91110 lineHeight : typeScaleVars [ '--cl-text-sm-leading' ] ,
111+ position : 'relative' ,
92112 verticalAlign : 'middle' ,
93113 } ,
94114 selectCell : {
@@ -103,7 +123,7 @@ export const styles = stylex.create({
103123 backgroundColor : surface ,
104124 backgroundImage : `linear-gradient(${ tint } , ${ tint } )` ,
105125 position : 'sticky' ,
106- zIndex : 1 ,
126+ zIndex : { default : 1 , ':focus-visible' : 2 } ,
107127 '::before' : {
108128 insetBlock : 0 ,
109129 content : '""' ,
@@ -112,9 +132,53 @@ export const styles = stylex.create({
112132 width : scrollFadeVars [ '--cl-scroll-fade-size' ] ,
113133 } ,
114134 } ,
115- emptyCell : {
135+ focusRing : {
136+ outlineOffset : { default : null , ':focus-visible' : `calc(-1 * ${ focusVars [ '--cl-focus-outline-width' ] } )` } ,
137+ zIndex : { default : null , ':focus-visible' : 2 } ,
138+ } ,
139+ empty : {
116140 textAlign : 'center' ,
117141 } ,
142+ expandButton : {
143+ borderRadius : radiusVars [ '--cl-radius-sm' ] ,
144+ alignItems : 'center' ,
145+ color : colorVars [ '--cl-color-foreground-secondary' ] ,
146+ cursor : 'pointer' ,
147+ display : 'inline-flex' ,
148+ justifyContent : 'center' ,
149+ marginInlineEnd : space [ '1' ] ,
150+ verticalAlign : 'middle' ,
151+ } ,
152+ expandIcon : {
153+ transform : {
154+ default : null ,
155+ ':is([dir="rtl"] *):not([data-expanded] *)' : 'scaleX(-1)' ,
156+ [ stylex . when . ancestor ( '[data-expanded]' , tableStateMarker ) ] : 'rotate(90deg)' ,
157+ } ,
158+ transitionDuration : durationVars [ '--cl-duration-fast' ] ,
159+ transitionProperty : 'transform' ,
160+ } ,
161+ } ) ;
162+
163+ export const sortIcons = stylex . create ( {
164+ none : {
165+ display : {
166+ default : 'block' ,
167+ [ stylex . when . ancestor ( '[data-sort-direction]' , tableStateMarker ) ] : 'none' ,
168+ } ,
169+ } ,
170+ ascending : {
171+ display : {
172+ default : 'none' ,
173+ [ stylex . when . ancestor ( '[data-sort-direction="ascending"]' , tableStateMarker ) ] : 'block' ,
174+ } ,
175+ } ,
176+ descending : {
177+ display : {
178+ default : 'none' ,
179+ [ stylex . when . ancestor ( '[data-sort-direction="descending"]' , tableStateMarker ) ] : 'block' ,
180+ } ,
181+ } ,
118182} ) ;
119183
120184export const layouts = stylex . create ( {
0 commit comments