@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
45 lines (44 loc) • 2.09 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { colors } from '@workday/canvas-kit-react/tokens';
import { CanvasIconTypes } from '@workday/design-assets-types';
import { createComponent, getColor } from '@workday/canvas-kit-react/common';
import { createStencil, cssVar, handleCsProp, px2rem } from '@workday/canvas-kit-styling';
import { system } from '@workday/canvas-tokens-web';
import { Svg, svgStencil, transformColorNameToToken } from './Svg';
/**
* @deprecated `accentIconStyles` will be removed in in a future version as a part of implementation of stencils and new tokens. Consider to use `accentIconStencil` instead.
*/
export const accentIconStyles = ({ color = colors.blueberry500, transparent = false, }) => ({
'& .color-500': {
fill: getColor(color),
},
'& .french-vanilla-100': {
fill: transparent ? 'transparent' : colors.frenchVanilla100,
},
});
export const accentIconStencil = createStencil({
extends: svgStencil,
vars: {
color: '',
},
base: { name: "2ehqkp", styles: "box-sizing:border-box;--size-svg-8fcab8:3.5rem;& .color-500{fill:var(--color-accent-icon-05e3c8, var(--cnvs-sys-color-bg-primary-strong));}& .french-vanilla-100{fill:var(--cnvs-sys-color-bg-default);}" },
modifiers: {
transparent: {
true: { name: "3rzgwq", styles: "& .french-vanilla-100{fill:transparent;}" }
}
}
}, "accent-icon-05e3c8");
export const AccentIcon = createComponent('span')({
displayName: 'AccentIcon',
Component: ({ transparent, size, icon, color, shouldMirror, shouldMirrorInRTL, ...elemProps }, ref, Element) => {
return (_jsx(Svg, { src: icon, type: CanvasIconTypes.Accent, as: Element, ref: ref, ...handleCsProp(elemProps, [
accentIconStencil({
color: transformColorNameToToken(color),
size: typeof size === 'number' ? px2rem(size) : undefined,
shouldMirror,
shouldMirrorInRTL,
transparent,
}),
]) }));
},
});