77
88import styled , { DefaultTheme , ThemeProps } from 'styled-components' ;
99import { parseToRgb , readableColor } from 'polished' ;
10- import { DEFAULT_THEME , focusStyles , retrieveComponentStyles } from '@zendeskgarden/react-theming' ;
10+ import { DEFAULT_THEME , getColor , retrieveComponentStyles } from '@zendeskgarden/react-theming' ;
1111import { StyledButtonPreview } from '../ColorPickerDialog/StyledButtonPreview' ;
1212import { IRGBColor } from '../../types' ;
1313
@@ -18,6 +18,7 @@ interface IStyledColorSwatchLabelProps extends ThemeProps<DefaultTheme> {
1818}
1919
2020const colorStyles = ( props : IStyledColorSwatchLabelProps ) => {
21+ const boxShadow = props . theme . shadows . md ( getColor ( 'primaryHue' , 600 , props . theme , 0.35 ) ! ) ;
2122 const { alpha } = parseToRgb ( props . backgroundColor ) as IRGBColor ;
2223 let foregroundColor ;
2324
@@ -33,6 +34,9 @@ const colorStyles = (props: IStyledColorSwatchLabelProps) => {
3334
3435 return `
3536 color: ${ foregroundColor } ;
37+
38+ &[data-garden-focus-visible] {
39+ box-shadow: ${ boxShadow } ;
3640 ` ;
3741} ;
3842
@@ -42,13 +46,11 @@ export const StyledColorSwatchLabel = styled(StyledButtonPreview).attrs({
4246 'data-garden-version' : PACKAGE_VERSION
4347} ) `
4448 position: relative;
45- top: 0;
4649 border-radius: ${ props => props . theme . borderRadii . md } ;
50+ cursor: pointer;
4751
4852 ${ colorStyles } ;
4953
50- ${ props => focusStyles ( { theme : props . theme , selector : '&:has(:focus-visible)' } ) }
51-
5254 ${ props => retrieveComponentStyles ( COMPONENT_ID , props ) } ;
5355` ;
5456
0 commit comments