@@ -13,14 +13,20 @@ import {
1313import { iconScope } from '../icon/icon.markers.stylex' ;
1414
1515// Neutral fills are the three neutral alpha steps, shared across variants:
16- // 100 — `filled-neutral` rest, `outline-*`/` ghost-*` hover
17- // 200 — `filled-neutral` hover, `outline-*`/` ghost-*` pressed
16+ // 100 — `filled-neutral` rest, `ghost-*` hover
17+ // 200 — `filled-neutral` hover, `ghost-*` pressed
1818// 300 — `filled-neutral` pressed
1919
2020// Opaque fills blend toward their own on-fill at the same 12%/18%. Neutral has no fill
2121// to blend from, so it rides the opacity ramp above.
22+ // Outline variants keep the surface as their fill and lay the hover and pressed wash over it as an
23+ // inset shadow, so the state tint works on any backdrop and still transitions.
2224const primaryHover = `color-mix(in oklab, ${ colorVars [ '--cl-color-brand' ] } , ${ colorVars [ '--cl-color-brand-foreground' ] } 12%)` ;
2325const primaryActive = `color-mix(in oklab, ${ colorVars [ '--cl-color-brand' ] } , ${ colorVars [ '--cl-color-brand-foreground' ] } 18%)` ;
26+ const neutralHoverWash = `inset 0 0 0 100vmax ${ colorVars [ '--cl-color-neutral-alpha-100' ] } ` ;
27+ const neutralPressedWash = `inset 0 0 0 100vmax ${ colorVars [ '--cl-color-neutral-alpha-200' ] } ` ;
28+ const negativeHoverWash = `inset 0 0 0 100vmax ${ colorVars [ '--cl-color-negative-alpha-200' ] } ` ;
29+ const negativePressedWash = `inset 0 0 0 100vmax ${ colorVars [ '--cl-color-negative-alpha-300' ] } ` ;
2430const negativeHover = `color-mix(in oklab, ${ colorVars [ '--cl-color-negative' ] } , ${ colorVars [ '--cl-color-negative-foreground' ] } 12%)` ;
2531const negativeActive = `color-mix(in oklab, ${ colorVars [ '--cl-color-negative' ] } , ${ colorVars [ '--cl-color-negative-foreground' ] } 18%)` ;
2632
@@ -75,7 +81,7 @@ export const styles = stylex.create({
7581 ':not([data-disabled]):active' : durationVars [ '--cl-duration-instant' ] ,
7682 ':not([data-disabled]):hover' : durationVars [ '--cl-duration-instant' ] ,
7783 } ,
78- transitionProperty : 'background-color, border-color, color, opacity, text-decoration-color' ,
84+ transitionProperty : 'background-color, border-color, box-shadow, color, opacity, text-decoration-color' ,
7985 // Linear, not `--cl-ease-default`: nothing here moves. An ease on already non-uniform
8086 // color interpolation just drags the midpoint, and the house curve's overshoot would
8187 // extrapolate past the target color.
@@ -181,39 +187,42 @@ export const variants = stylex.create({
181187 // fill, and leaves it independently themeable.
182188 'outline-primary' : {
183189 borderColor : colorVars [ '--cl-color-border' ] ,
184- backgroundColor : {
185- default : 'transparent' ,
186- ':not([data-disabled]):active' : colorVars [ '--cl-color-neutral-alpha-200' ] ,
187- ':not([data-disabled])[data-open]' : colorVars [ '--cl-color-neutral-alpha-200' ] ,
190+ backgroundColor : colorVars [ '--cl-color-surface' ] ,
191+ boxShadow : {
192+ default : null ,
193+ ':not([data-disabled]):active' : neutralPressedWash ,
194+ ':not([data-disabled])[data-open]' : neutralPressedWash ,
188195 '@media (hover: hover)' : {
189196 default : null ,
190- ':not([data-disabled]):hover:not(:active):not([data-open])' : colorVars [ '--cl-color-neutral-alpha-100' ] ,
197+ ':not([data-disabled]):hover:not(:active):not([data-open])' : neutralHoverWash ,
191198 } ,
192199 } ,
193200 color : colorVars [ '--cl-color-brand' ] ,
194201 } ,
195202 'outline-neutral' : {
196203 borderColor : colorVars [ '--cl-color-border' ] ,
197- backgroundColor : {
198- default : 'transparent' ,
199- ':not([data-disabled]):active' : colorVars [ '--cl-color-neutral-alpha-200' ] ,
200- ':not([data-disabled])[data-open]' : colorVars [ '--cl-color-neutral-alpha-200' ] ,
204+ backgroundColor : colorVars [ '--cl-color-surface' ] ,
205+ boxShadow : {
206+ default : null ,
207+ ':not([data-disabled]):active' : neutralPressedWash ,
208+ ':not([data-disabled])[data-open]' : neutralPressedWash ,
201209 '@media (hover: hover)' : {
202210 default : null ,
203- ':not([data-disabled]):hover:not(:active):not([data-open])' : colorVars [ '--cl-color-neutral-alpha-100' ] ,
211+ ':not([data-disabled]):hover:not(:active):not([data-open])' : neutralHoverWash ,
204212 } ,
205213 } ,
206214 color : colorVars [ '--cl-color-foreground' ] ,
207215 } ,
208216 'outline-negative' : {
209217 borderColor : colorVars [ '--cl-color-border' ] ,
210- backgroundColor : {
211- default : 'transparent' ,
212- ':not([data-disabled]):active' : colorVars [ '--cl-color-neutral-alpha-200' ] ,
213- ':not([data-disabled])[data-open]' : colorVars [ '--cl-color-neutral-alpha-200' ] ,
218+ backgroundColor : colorVars [ '--cl-color-surface' ] ,
219+ boxShadow : {
220+ default : null ,
221+ ':not([data-disabled]):active' : negativePressedWash ,
222+ ':not([data-disabled])[data-open]' : negativePressedWash ,
214223 '@media (hover: hover)' : {
215224 default : null ,
216- ':not([data-disabled]):hover:not(:active):not([data-open])' : colorVars [ '--cl-color-neutral-alpha-100' ] ,
225+ ':not([data-disabled]):hover:not(:active):not([data-open])' : negativeHoverWash ,
217226 } ,
218227 } ,
219228 color : colorVars [ '--cl-color-negative' ] ,
@@ -248,11 +257,11 @@ export const variants = stylex.create({
248257 'ghost-negative' : {
249258 backgroundColor : {
250259 default : 'transparent' ,
251- ':not([data-disabled]):active' : `color-mix(in oklab, ${ colorVars [ '--cl-color-negative-subtle' ] } , ${ colorVars [ '--cl-color-negative' ] } 8%)` ,
252- ':not([data-disabled])[data-open]' : `color-mix(in oklab, ${ colorVars [ '--cl-color-negative-subtle' ] } , ${ colorVars [ '--cl-color-negative' ] } 8%)` ,
260+ ':not([data-disabled]):active' : colorVars [ '--cl-color-negative-alpha-300' ] ,
261+ ':not([data-disabled])[data-open]' : colorVars [ '--cl-color-negative-alpha-300' ] ,
253262 '@media (hover: hover)' : {
254263 default : null ,
255- ':not([data-disabled]):hover:not(:active):not([data-open])' : colorVars [ '--cl-color-negative-subtle ' ] ,
264+ ':not([data-disabled]):hover:not(:active):not([data-open])' : colorVars [ '--cl-color-negative-alpha-200 ' ] ,
256265 } ,
257266 } ,
258267 color : colorVars [ '--cl-color-negative' ] ,
0 commit comments