Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('accent and fill props override color if set', () => {
const color = 'peachpuff';
const colorHover = 'goldenrod';
const accent = colors.blueberry200;
const accentHover = colors.blueberry500;
const fill = colors.cinnamon200;
const fillHover = colors.cinnamon500;
const componentStyle = systemIconStyles({
color,
colorHover,
accent,
accentHover,
fill,
fillHover,
});
expect(componentStyle['& .wd-icon-fill']).toHaveProperty('fill', fill);
expect(componentStyle[':hover .wd-icon-fill']).toHaveProperty('fill', fillHover);
expect(componentStyle['& .wd-icon-accent']).toHaveProperty('fill', accent);
expect(componentStyle[':hover .wd-icon-accent']).toHaveProperty('fill', accentHover);
});
({themeColor}) => ({
color: themeColor === HeaderTheme.White ? colors.blueberry500 : colors.frenchVanilla100,
borderLeft: `1px solid ${
themeColor === HeaderTheme.White
? colors.soap400
: chroma(colors.frenchVanilla100)
.alpha(0.3)
.css()
}`,
})
);
({themeColor}) => ({
color: themeColor === HeaderTheme.White ? colors.blueberry500 : colors.frenchVanilla100,
borderLeft: `1px solid ${
themeColor === HeaderTheme.White
? colors.soap400
: chroma(colors.soap400)
.alpha(0.4)
.css()
}`,
})
);
high: {
color: colors.licorice500,
background: colors.cantaloupe400,
},
low: {
color: colors.toastedMarshmallow600,
background: colors.cantaloupe100,
},
},
blue: {
high: {
color: colors.frenchVanilla100,
background: colors.blueberry400,
},
low: {
color: colors.blueberry500,
background: colors.blueberry100,
},
},
green: {
high: {
color: colors.frenchVanilla100,
background: colors.greenApple600,
},
low: {
color: colors.greenApple600,
background: colors.greenApple100,
},
},
red: {
high: {
color: colors.frenchVanilla100,
};
case IconButtonVariant.Circle:
return {
'&:active': {
...getFillSelector(colors.blueberry400),
...getAccentSelector(colors.frenchVanilla100),
},
...getBackgroundSelector(colors.blueberry400),
...getFillSelector(colors.blueberry400),
...getAccentSelector(colors.frenchVanilla100),
};
case IconButtonVariant.CircleFilled:
return {
backgroundColor: colors.blueberry400,
'&:hover, &:focus&:hover': {
backgroundColor: colors.blueberry500,
...getAccentSelector(colors.blueberry500),
},
...getBackgroundSelector(colors.frenchVanilla100),
...getFillSelector(colors.frenchVanilla100),
...getAccentSelector(colors.blueberry400),
};
case IconButtonVariant.Inverse:
return {
'&:hover span .wd-icon-fill, span .wd-icon-fill': {
fill: colors.frenchVanilla100,
},
...getBackgroundSelector(colors.frenchVanilla100),
...getAccentSelector(colors.licorice200),
};
case IconButtonVariant.InverseFilled:
return {
case IconButtonVariant.Circle:
return {
'&:active': {
...getFillSelector(colors.blueberry400),
...getAccentSelector(colors.frenchVanilla100),
},
...getBackgroundSelector(colors.blueberry400),
...getFillSelector(colors.blueberry400),
...getAccentSelector(colors.frenchVanilla100),
};
case IconButtonVariant.CircleFilled:
return {
backgroundColor: colors.blueberry400,
'&:hover, &:focus&:hover': {
backgroundColor: colors.blueberry500,
...getAccentSelector(colors.blueberry500),
},
...getBackgroundSelector(colors.frenchVanilla100),
...getFillSelector(colors.frenchVanilla100),
...getAccentSelector(colors.blueberry400),
};
case IconButtonVariant.Inverse:
return {
'&:hover span .wd-icon-fill, span .wd-icon-fill': {
fill: colors.frenchVanilla100,
},
...getBackgroundSelector(colors.frenchVanilla100),
...getAccentSelector(colors.licorice200),
};
case IconButtonVariant.InverseFilled:
return {
backgroundColor: 'rgba(0, 0, 0, 0.4)',
export const accentIconStyles = ({
color = colors.blueberry500,
transparent = false,
}: AccentIconStyles): CSSObject => ({
'& .color-500': {
fill: color,
},
'& .french-vanilla-100': {
fill: transparent ? 'transparent' : colors.frenchVanilla100,
},
});
({checked, disabled}) => ({
backgroundColor: disabled ? colors.soap400 : checked ? colors.blueberry500 : colors.licorice200,
})
);
({state}) => {
switch (state) {
case TableRowState.InputError:
return makeBorderlessStyle(errorColor);
case TableRowState.Error:
return makeColoredRowStyle(errorColor, errorColorLight);
case TableRowState.InputAlert:
return makeBorderlessStyle(alertColor);
case TableRowState.Alert:
return makeColoredRowStyle(alertColor, alertColorLight);
case TableRowState.Selected:
return {
'th, td': [
makeColoredRow(colors.blueberry100, colors.blueberry500),
{
'&:after': {
zIndex: 2,
},
},
],
};
default:
return {
'&:hover': {
'th, td': {
backgroundColor: colors.soap300,
},
},
'&:focus': {
outline: 'none',
export interface Themes {
[key: string]: ThemeAttributes;
}
export const themes: Themes = {
[HeaderTheme.White]: {
color: colors.blackPepper400,
background: colors.frenchVanilla100,
depth: depth['1'],
systemIcon: {
color: iconColors.standard,
colorHover: iconColors.hover,
},
linkColor: colors.blackPepper400,
linkFadeOutColor: colors.licorice200,
currentLinkColor: colors.blueberry500,
chipColor: colors.blueberry400,
},
[HeaderTheme.Blue]: {
color: colors.frenchVanilla100,
background: colors.gradients.blueberry,
depth: depth['3'],
systemIcon: {
color: colors.frenchVanilla100,
colorHover: colors.blueberry200,
},
linkColor: colors.frenchVanilla100,
linkFadeOutColor: chroma(colors.frenchVanilla100)
.alpha(0.5)
.css(),
currentLinkColor: colors.frenchVanilla100,
chipColor: colors.frenchVanilla100,