UNPKG

@workday/canvas-kit-react

Version:

The parent module that contains all Workday Canvas Kit React components

86 lines (85 loc) 4.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AppletIcon = exports.appletIconStencil = exports.appletIconStyles = 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 `appletIconStyles` will be removed in in a future version as a part of implementation of stencils and new tokens. Consider to use `appletIconStencil` instead. */ const appletIconStyles = ({ color = tokens_1.BrandingColor.Blueberry, }) => { // Check if valid color if (!Object.keys(tokens_1.BrandingColor) .map(color => tokens_1.BrandingColor[color]) .includes(color)) { throw Error(`Color "${color}" not found`); } const colorNames = { 100: `${color}100`, 200: `${color}200`, 300: `${color}300`, 400: `${color}400`, 500: `${color}500`, }; return { '& .color-100': { fill: canvas_tokens_web_1.system.color.fg.inverse, }, '& .color-200': { fill: tokens_1.colors[colorNames[200]], }, '& .color-300': { fill: tokens_1.colors[colorNames[300]], }, '& .color-400': { fill: tokens_1.colors[colorNames[400]], }, '& .color-400-alpha-20': { fill: tokens_1.colors[colorNames[400]], }, '& .color-500': { fill: tokens_1.colors[colorNames[500]], }, }; }; exports.appletIconStyles = appletIconStyles; /** * @deprecated ⚠️ `appletIconStencil` is deprecated and will be removed in a future major version. Deprecated in v15.0.0. */ exports.appletIconStencil = (0, canvas_kit_styling_1.createStencil)({ extends: Svg_1.svgStencil, vars: { color200: '', color300: '', color400: '', color500: '', }, base: { name: "8ce85", styles: "box-sizing:border-box;--size-svg-bca693:5.75rem;& .color-100{fill:var(--cnvs-sys-color-fg-inverse);}& .color-200{fill:var(--color200-applet-icon-02002c, var(--cnvs-base-palette-blue-200, oklch(0.8627 0.0701 250.6 / 1)));}& .color-300{fill:var(--color300-applet-icon-02002c, var(--cnvs-base-palette-blue-400, oklch(0.708 0.1549 255.41 / 1)));}& .color-400{fill:var(--color400-applet-icon-02002c, var(--cnvs-base-palette-blue-600, oklch(0.5198 0.1782 256.11 / 1)));}& .color-400-alpha-20{fill:var(--color400-applet-icon-02002c, var(--cnvs-base-palette-blue-600, oklch(0.5198 0.1782 256.11 / 1)));}& .color-500{fill:var(--color500-applet-icon-02002c, var(--cnvs-base-palette-blue-700, oklch(0.4658 0.1562 255.5 / 1)));}" } }, "applet-icon-02002c"); /** * @deprecated ⚠️ `AppletIcon` is deprecated and will be removed in a future major version. Deprecated in v15.0.0. */ exports.AppletIcon = (0, common_1.createComponent)('span')({ displayName: 'AppletIcon', Component: ({ size, icon, color, ...elemProps }, ref, Element) => { const colors = color && { color200: canvas_tokens_web_1.base.legacy[`${color}200`], color300: canvas_tokens_web_1.base.legacy[`${color}300`], color400: canvas_tokens_web_1.base.legacy[`${color}400`], color500: canvas_tokens_web_1.base.legacy[`${color}500`], }; return ((0, jsx_runtime_1.jsx)(Svg_1.Svg, { src: icon, type: design_assets_types_1.CanvasIconTypes.Applet, as: Element, ref: ref, ...(0, canvas_kit_styling_1.handleCsProp)(elemProps, [ (0, exports.appletIconStencil)({ ...colors, size: size ? (0, canvas_kit_styling_1.px2rem)(size) : undefined, }), ]) })); }, subComponents: { Colors: tokens_1.BrandingColor, }, });