@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
66 lines (65 loc) • 3.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AccentIcon = exports.accentIconStencil = exports.accentIconStyles = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const common_1 = require("@workday/canvas-kit-react/common");
const tokens_1 = require("@workday/canvas-kit-react/tokens");
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
const design_assets_types_1 = require("@workday/design-assets-types");
const Svg_1 = require("./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. Deprecated in v11.0.0.
*/
const accentIconStyles = ({ color = tokens_1.colors.blueberry500, transparent = false, }) => ({
'& .color-500': {
fill: (0, common_1.getColor)(color),
},
'& .french-vanilla-100': {
fill: transparent ? 'transparent' : tokens_1.colors.frenchVanilla100,
},
});
exports.accentIconStyles = accentIconStyles;
/**
* @deprecated ⚠️ `accentIconStencil` is deprecated and will be removed in a future major version. Deprecated in v15.0.0.
*/
exports.accentIconStencil = (0, canvas_kit_styling_1.createStencil)({
extends: Svg_1.svgStencil,
vars: {
color: '',
},
base: { name: "1180r3", styles: "box-sizing:border-box;--size-svg-bca693:3.5rem;& .color-500{fill:var(--color-accent-icon-1046a0, var(--cnvs-sys-color-bg-primary-strong));}& .french-vanilla-100{fill:var(--cnvs-sys-color-bg-default);}" },
modifiers: {
transparent: {
true: { name: "38ddnk", styles: "& .french-vanilla-100{fill:transparent;}" }
}
}
}, "accent-icon-1046a0");
/** @deprecated Deprecated in v11 */
const transformColorNameToToken = (color) => {
const { legacy, sana, ...baseTokens } = canvas_tokens_web_1.base;
if (color && color in baseTokens) {
return (0, canvas_kit_styling_1.cssVar)(baseTokens[color]);
}
if (color === null || color === void 0 ? void 0 : color.startsWith('--')) {
return (0, canvas_kit_styling_1.cssVar)(color);
}
return color;
};
/**
* @deprecated ⚠️ `AccentIcon` is deprecated and will be removed in a future major version. Deprecated in v15.0.0.
*/
exports.AccentIcon = (0, common_1.createComponent)('span')({
displayName: 'AccentIcon',
Component: ({ transparent, size, icon, color, shouldMirror, shouldMirrorInRTL, ...elemProps }, ref, Element) => {
return ((0, jsx_runtime_1.jsx)(Svg_1.Svg, { src: icon, type: design_assets_types_1.CanvasIconTypes.Accent, as: Element, ref: ref, ...(0, canvas_kit_styling_1.handleCsProp)(elemProps, [
(0, exports.accentIconStencil)({
color: transformColorNameToToken(color),
size: typeof size === 'number' ? (0, canvas_kit_styling_1.px2rem)(size) : undefined,
shouldMirror,
shouldMirrorInRTL,
transparent,
}),
]) }));
},
});