Skip to content

Commit fb329d1

Browse files
authored
fix(s2): Fix exceptions to baseColor in Button and Tag backgrounds (#8235)
1 parent 206ebd5 commit fb329d1

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import {ActionButtonGroupContext} from './ActionButtonGroup';
1414
import {AvatarContext} from './Avatar';
15-
import {baseColor, focusRing, fontRelative, style} from '../style' with { type: 'macro' };
15+
import {baseColor, focusRing, fontRelative, lightDark, style} from '../style' with { type: 'macro' };
1616
import {ButtonProps, ButtonRenderProps, ContextValue, OverlayTriggerStateContext, Provider, Button as RACButton, useSlottedContext} from 'react-aria-components';
1717
import {centerBaseline} from './CenterBaseline';
1818
import {control, getAllowedOverrides, staticColor, StyleProps} from './style-utils' with { type: 'macro' };
@@ -91,7 +91,12 @@ export const btnStyles = style<ButtonRenderProps & ActionButtonStyleProps & Togg
9191
},
9292
isSelected: {
9393
default: baseColor('neutral'),
94-
isEmphasized: baseColor('accent'),
94+
isEmphasized: {
95+
default: lightDark('accent-900', 'accent-700'),
96+
isHovered: lightDark('accent-1000', 'accent-600'),
97+
isPressed: lightDark('accent-1000', 'accent-600'),
98+
isFocused: lightDark('accent-1000', 'accent-600')
99+
},
95100
isDisabled: {
96101
default: 'gray-100',
97102
isQuiet: 'transparent'

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212

13-
import {baseColor, focusRing, fontRelative, linearGradient, style} from '../style' with {type: 'macro'};
13+
import {baseColor, focusRing, fontRelative, lightDark, linearGradient, style} from '../style' with {type: 'macro'};
1414
import {ButtonRenderProps, ContextValue, Link, LinkProps, OverlayTriggerStateContext, Provider, Button as RACButton, ButtonProps as RACButtonProps} from 'react-aria-components';
1515
import {centerBaseline} from './CenterBaseline';
1616
import {control, getAllowedOverrides, staticColor, StyleProps} from './style-utils' with {type: 'macro'};
@@ -112,8 +112,18 @@ const button = style<ButtonRenderProps & ButtonStyleProps & {isStaticColor: bool
112112
variant: {
113113
primary: baseColor('neutral'),
114114
secondary: baseColor('gray-100'),
115-
accent: baseColor('accent'),
116-
negative: baseColor('negative'),
115+
accent: {
116+
default: lightDark('accent-900', 'accent-700'),
117+
isHovered: lightDark('accent-1000', 'accent-600'),
118+
isPressed: lightDark('accent-1000', 'accent-600'),
119+
isFocused: lightDark('accent-1000', 'accent-600')
120+
},
121+
negative: {
122+
default: lightDark('negative-900', 'negative-700'),
123+
isHovered: lightDark('negative-1000', 'negative-600'),
124+
isPressed: lightDark('negative-1000', 'negative-600'),
125+
isFocused: lightDark('negative-1000', 'negative-600')
126+
},
117127
premium: 'gray-100',
118128
genai: 'gray-100'
119129
},

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
useSlottedContext
2929
} from 'react-aria-components';
3030
import {AvatarContext} from './Avatar';
31-
import {baseColor, focusRing, fontRelative, style} from '../style' with { type: 'macro' };
31+
import {baseColor, focusRing, fontRelative, lightDark, style} from '../style' with { type: 'macro' };
3232
import {CenterBaseline, centerBaseline} from './CenterBaseline';
3333
import {ClearButton} from './ClearButton';
3434
import {Collection, CollectionBuilder} from '@react-aria/collections';
@@ -439,7 +439,10 @@ const tagStyles = style<TagRenderProps & {size?: 'S' | 'M' | 'L', isEmphasized?:
439439
isSelected: {
440440
default: baseColor('neutral'),
441441
isEmphasized: {
442-
default: baseColor('accent')
442+
default: lightDark('accent-900', 'accent-700'),
443+
isHovered: lightDark('accent-1000', 'accent-600'),
444+
isPressed: lightDark('accent-1000', 'accent-600'),
445+
isFocused: lightDark('accent-1000', 'accent-600')
443446
}
444447
},
445448
isDisabled: 'disabled',

0 commit comments

Comments
 (0)