@workday/canvas-kit-react 11.0.0-alpha.726-next.0 → 11.0.0-alpha.758-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/breadcrumbs/lib/BreadcrumbsItem.tsx +1 -1
- package/breadcrumbs/lib/BreadcrumbsOverflowButton.tsx +1 -1
- package/button/lib/BaseButton.tsx +16 -1
- package/button/lib/DeleteButton.tsx +12 -11
- package/button/lib/ExternalHyperlink.tsx +1 -1
- package/button/lib/PrimaryButton.tsx +52 -45
- package/button/lib/SecondaryButton.tsx +58 -75
- package/button/lib/TertiaryButton.tsx +63 -54
- package/collection/lib/ListBox.tsx +9 -3
- package/combobox/lib/ComboboxMenuList.tsx +3 -4
- package/dist/commonjs/badge/lib/CountBadge.js +6 -6
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsItem.js +1 -1
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsOverflowButton.js +1 -1
- package/dist/commonjs/button/lib/BaseButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/BaseButton.js +18 -17
- package/dist/commonjs/button/lib/DeleteButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/DeleteButton.js +2 -1
- package/dist/commonjs/button/lib/ExternalHyperlink.js +1 -1
- package/dist/commonjs/button/lib/PrimaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/PrimaryButton.js +3 -2
- package/dist/commonjs/button/lib/SecondaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/SecondaryButton.js +3 -2
- package/dist/commonjs/button/lib/TertiaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/TertiaryButton.js +16 -15
- package/dist/commonjs/card/lib/Card.js +1 -1
- package/dist/commonjs/card/lib/CardHeading.js +1 -1
- package/dist/commonjs/checkbox/lib/CheckBackground.js +5 -5
- package/dist/commonjs/checkbox/lib/CheckboxCheck.js +9 -9
- package/dist/commonjs/checkbox/lib/CheckboxContainer.js +1 -1
- package/dist/commonjs/checkbox/lib/CheckboxInput.js +11 -11
- package/dist/commonjs/checkbox/lib/CheckboxRipple.js +1 -1
- package/dist/commonjs/collection/lib/ListBox.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/ListBox.js +14 -8
- package/dist/commonjs/combobox/lib/ComboboxMenuItem.js +4 -4
- package/dist/commonjs/combobox/lib/ComboboxMenuList.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/ComboboxMenuList.js +4 -5
- package/dist/commonjs/common/lib/AccessibleHide.js +1 -1
- package/dist/commonjs/common/lib/CanvasProvider.js +1 -1
- package/dist/commonjs/icon/index.d.ts +1 -1
- package/dist/commonjs/icon/index.d.ts.map +1 -1
- package/dist/commonjs/icon/index.js +4 -1
- package/dist/commonjs/icon/lib/AccentIcon.d.ts +30 -4
- package/dist/commonjs/icon/lib/AccentIcon.d.ts.map +1 -1
- package/dist/commonjs/icon/lib/AccentIcon.js +28 -4
- package/dist/commonjs/icon/lib/AppletIcon.d.ts +31 -2
- package/dist/commonjs/icon/lib/AppletIcon.d.ts.map +1 -1
- package/dist/commonjs/icon/lib/AppletIcon.js +27 -4
- package/dist/commonjs/icon/lib/Graphic.d.ts +20 -1
- package/dist/commonjs/icon/lib/Graphic.d.ts.map +1 -1
- package/dist/commonjs/icon/lib/Graphic.js +25 -3
- package/dist/commonjs/icon/lib/Svg.d.ts +12 -2
- package/dist/commonjs/icon/lib/Svg.d.ts.map +1 -1
- package/dist/commonjs/icon/lib/Svg.js +25 -10
- package/dist/commonjs/icon/lib/SystemIcon.d.ts +79 -16
- package/dist/commonjs/icon/lib/SystemIcon.d.ts.map +1 -1
- package/dist/commonjs/icon/lib/SystemIcon.js +51 -14
- package/dist/commonjs/icon/lib/SystemIconCircle.d.ts +2 -3
- package/dist/commonjs/icon/lib/SystemIconCircle.d.ts.map +1 -1
- package/dist/commonjs/icon/lib/SystemIconCircle.js +20 -30
- package/dist/commonjs/loading-dots/lib/LoadingDots.js +3 -3
- package/dist/commonjs/menu/lib/MenuCard.js +2 -2
- package/dist/commonjs/menu/lib/MenuList.js +5 -5
- package/dist/commonjs/select/lib/Select.js +7 -7
- package/dist/commonjs/select/lib/hooks/useSelectInput.d.ts +4 -1
- package/dist/commonjs/select/lib/hooks/useSelectInput.d.ts.map +1 -1
- package/dist/commonjs/select/lib/hooks/useSelectInput.js +14 -5
- package/dist/commonjs/switch/lib/Switch.js +13 -13
- package/dist/commonjs/table/lib/Table.js +2 -2
- package/dist/commonjs/table/lib/TableBody.js +2 -2
- package/dist/commonjs/table/lib/TableCaption.js +2 -2
- package/dist/commonjs/table/lib/TableCell.js +2 -2
- package/dist/commonjs/table/lib/TableFooter.js +2 -2
- package/dist/commonjs/table/lib/TableHead.js +2 -2
- package/dist/commonjs/table/lib/TableHeader.js +2 -2
- package/dist/commonjs/table/lib/TableRow.js +2 -2
- package/dist/commonjs/tabs/lib/TabsItem.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsItem.js +4 -12
- package/dist/commonjs/tabs/lib/useTabsModel.d.ts.map +1 -1
- package/dist/commonjs/text/lib/LabelText.d.ts.map +1 -1
- package/dist/commonjs/text/lib/LabelText.js +11 -27
- package/dist/commonjs/text/lib/Text.d.ts +103 -0
- package/dist/commonjs/text/lib/Text.d.ts.map +1 -1
- package/dist/commonjs/text/lib/Text.js +30 -27
- package/dist/commonjs/tooltip/lib/OverflowTooltip.d.ts.map +1 -1
- package/dist/commonjs/tooltip/lib/OverflowTooltip.js +2 -3
- package/dist/es6/badge/lib/CountBadge.js +6 -6
- package/dist/es6/breadcrumbs/lib/BreadcrumbsItem.js +1 -1
- package/dist/es6/breadcrumbs/lib/BreadcrumbsOverflowButton.js +1 -1
- package/dist/es6/button/lib/BaseButton.d.ts.map +1 -1
- package/dist/es6/button/lib/BaseButton.js +18 -17
- package/dist/es6/button/lib/DeleteButton.d.ts.map +1 -1
- package/dist/es6/button/lib/DeleteButton.js +2 -1
- package/dist/es6/button/lib/ExternalHyperlink.js +1 -1
- package/dist/es6/button/lib/PrimaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/PrimaryButton.js +3 -2
- package/dist/es6/button/lib/SecondaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/SecondaryButton.js +3 -2
- package/dist/es6/button/lib/TertiaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/TertiaryButton.js +16 -15
- package/dist/es6/card/lib/Card.js +1 -1
- package/dist/es6/card/lib/CardHeading.js +1 -1
- package/dist/es6/checkbox/lib/CheckBackground.js +5 -5
- package/dist/es6/checkbox/lib/CheckboxCheck.js +9 -9
- package/dist/es6/checkbox/lib/CheckboxContainer.js +1 -1
- package/dist/es6/checkbox/lib/CheckboxInput.js +11 -11
- package/dist/es6/checkbox/lib/CheckboxRipple.js +1 -1
- package/dist/es6/collection/lib/ListBox.d.ts.map +1 -1
- package/dist/es6/collection/lib/ListBox.js +15 -9
- package/dist/es6/combobox/lib/ComboboxMenuItem.js +4 -4
- package/dist/es6/combobox/lib/ComboboxMenuList.d.ts.map +1 -1
- package/dist/es6/combobox/lib/ComboboxMenuList.js +5 -6
- package/dist/es6/common/lib/AccessibleHide.js +1 -1
- package/dist/es6/common/lib/CanvasProvider.js +1 -1
- package/dist/es6/icon/index.d.ts +1 -1
- package/dist/es6/icon/index.d.ts.map +1 -1
- package/dist/es6/icon/index.js +1 -1
- package/dist/es6/icon/lib/AccentIcon.d.ts +30 -4
- package/dist/es6/icon/lib/AccentIcon.d.ts.map +1 -1
- package/dist/es6/icon/lib/AccentIcon.js +27 -3
- package/dist/es6/icon/lib/AppletIcon.d.ts +31 -2
- package/dist/es6/icon/lib/AppletIcon.d.ts.map +1 -1
- package/dist/es6/icon/lib/AppletIcon.js +26 -3
- package/dist/es6/icon/lib/Graphic.d.ts +20 -1
- package/dist/es6/icon/lib/Graphic.d.ts.map +1 -1
- package/dist/es6/icon/lib/Graphic.js +24 -2
- package/dist/es6/icon/lib/Svg.d.ts +12 -2
- package/dist/es6/icon/lib/Svg.d.ts.map +1 -1
- package/dist/es6/icon/lib/Svg.js +25 -11
- package/dist/es6/icon/lib/SystemIcon.d.ts +79 -16
- package/dist/es6/icon/lib/SystemIcon.d.ts.map +1 -1
- package/dist/es6/icon/lib/SystemIcon.js +50 -13
- package/dist/es6/icon/lib/SystemIconCircle.d.ts +2 -3
- package/dist/es6/icon/lib/SystemIconCircle.d.ts.map +1 -1
- package/dist/es6/icon/lib/SystemIconCircle.js +23 -30
- package/dist/es6/loading-dots/lib/LoadingDots.js +3 -3
- package/dist/es6/menu/lib/MenuCard.js +2 -2
- package/dist/es6/menu/lib/MenuList.js +5 -5
- package/dist/es6/select/lib/Select.js +7 -7
- package/dist/es6/select/lib/hooks/useSelectInput.d.ts +4 -1
- package/dist/es6/select/lib/hooks/useSelectInput.d.ts.map +1 -1
- package/dist/es6/select/lib/hooks/useSelectInput.js +14 -5
- package/dist/es6/switch/lib/Switch.js +13 -13
- package/dist/es6/table/lib/Table.js +2 -2
- package/dist/es6/table/lib/TableBody.js +2 -2
- package/dist/es6/table/lib/TableCaption.js +2 -2
- package/dist/es6/table/lib/TableCell.js +2 -2
- package/dist/es6/table/lib/TableFooter.js +2 -2
- package/dist/es6/table/lib/TableHead.js +2 -2
- package/dist/es6/table/lib/TableHeader.js +2 -2
- package/dist/es6/table/lib/TableRow.js +2 -2
- package/dist/es6/tabs/lib/TabsItem.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsItem.js +5 -13
- package/dist/es6/tabs/lib/useTabsModel.d.ts.map +1 -1
- package/dist/es6/text/lib/LabelText.d.ts.map +1 -1
- package/dist/es6/text/lib/LabelText.js +12 -28
- package/dist/es6/text/lib/Text.d.ts +103 -0
- package/dist/es6/text/lib/Text.d.ts.map +1 -1
- package/dist/es6/text/lib/Text.js +31 -28
- package/dist/es6/tooltip/lib/OverflowTooltip.d.ts.map +1 -1
- package/dist/es6/tooltip/lib/OverflowTooltip.js +2 -3
- package/icon/index.ts +1 -1
- package/icon/lib/AccentIcon.tsx +48 -10
- package/icon/lib/AppletIcon.tsx +53 -12
- package/icon/lib/Graphic.tsx +43 -10
- package/icon/lib/Svg.tsx +36 -19
- package/icon/lib/SystemIcon.tsx +134 -39
- package/icon/lib/SystemIconCircle.tsx +42 -47
- package/package.json +5 -5
- package/select/lib/hooks/useSelectInput.ts +24 -8
- package/tabs/lib/TabsItem.tsx +6 -13
- package/tabs/lib/useTabsModel.tsx +0 -1
- package/text/lib/LabelText.tsx +11 -63
- package/text/lib/Text.tsx +65 -62
- package/tooltip/lib/OverflowTooltip.tsx +2 -3
- package/dist/commonjs/icon/lib/Icon.d.ts +0 -9
- package/dist/commonjs/icon/lib/Icon.d.ts.map +0 -1
- package/dist/commonjs/icon/lib/Icon.js +0 -40
- package/dist/es6/icon/lib/Icon.d.ts +0 -9
- package/dist/es6/icon/lib/Icon.d.ts.map +0 -1
- package/dist/es6/icon/lib/Icon.js +0 -18
- package/icon/lib/Icon.tsx +0 -38
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { colors } from '@workday/canvas-kit-react/tokens';
|
|
3
3
|
import { CanvasIconTypes } from '@workday/design-assets-types';
|
|
4
|
-
import { Icon } from './Icon';
|
|
5
4
|
import { createComponent, getColor } from '@workday/canvas-kit-react/common';
|
|
5
|
+
import { createStencil, cssVar, handleCsProp, px2rem } from '@workday/canvas-kit-styling';
|
|
6
|
+
import { base } from '@workday/canvas-tokens-web';
|
|
7
|
+
import { Svg, svgStencil, transformColorNameToToken } from './Svg';
|
|
8
|
+
/**
|
|
9
|
+
* @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.
|
|
10
|
+
*/
|
|
6
11
|
export const accentIconStyles = ({ color = colors.blueberry500, transparent = false, }) => ({
|
|
7
12
|
'& .color-500': {
|
|
8
13
|
fill: getColor(color),
|
|
@@ -11,9 +16,28 @@ export const accentIconStyles = ({ color = colors.blueberry500, transparent = fa
|
|
|
11
16
|
fill: transparent ? 'transparent' : colors.frenchVanilla100,
|
|
12
17
|
},
|
|
13
18
|
});
|
|
19
|
+
export const accentIconStencil = createStencil({
|
|
20
|
+
extends: svgStencil,
|
|
21
|
+
vars: {
|
|
22
|
+
color: '',
|
|
23
|
+
},
|
|
24
|
+
base: { name: "8ab799", styles: "--cnvs-svg-size:3.5rem;& .color-500{fill:var(--cnvs-accent-icon-color, var(--cnvs-base-palette-blueberry-500));}& .french-vanilla-100{fill:var(--cnvs-base-palette-french-vanilla-100);}" },
|
|
25
|
+
modifiers: {
|
|
26
|
+
transparent: {
|
|
27
|
+
true: { name: "0b6c92", styles: "& .french-vanilla-100{fill:transparent;}" }
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}, "cnvs-accent-icon");
|
|
14
31
|
export const AccentIcon = createComponent('span')({
|
|
15
32
|
displayName: 'AccentIcon',
|
|
16
|
-
Component: ({ transparent
|
|
17
|
-
return (React.createElement(
|
|
33
|
+
Component: ({ transparent, size, icon, color, shouldMirror, ...elemProps }, ref, Element) => {
|
|
34
|
+
return (React.createElement(Svg, Object.assign({ src: icon, type: CanvasIconTypes.Accent, as: Element, ref: ref }, handleCsProp(elemProps, [
|
|
35
|
+
accentIconStencil({
|
|
36
|
+
color: transformColorNameToToken(color),
|
|
37
|
+
size: typeof size === 'number' ? px2rem(size) : undefined,
|
|
38
|
+
shouldMirror,
|
|
39
|
+
transparent,
|
|
40
|
+
}),
|
|
41
|
+
]))));
|
|
18
42
|
},
|
|
19
43
|
});
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { BrandingColor } from '@workday/canvas-kit-react/tokens';
|
|
2
2
|
import { CanvasAppletIcon } from '@workday/design-assets-types';
|
|
3
3
|
import { CSSObject } from '@emotion/styled';
|
|
4
|
-
import {
|
|
4
|
+
import { SvgProps } from './Svg';
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Interface `AppletIconStyles` will be removed in a future version. All props will be moved inside `AppletIconProps`.
|
|
7
|
+
*/
|
|
5
8
|
export interface AppletIconStyles {
|
|
6
9
|
/**
|
|
7
10
|
* The icon color hue. Must use a member of the `AppletIcon.Colors` static enum.
|
|
@@ -9,8 +12,11 @@ export interface AppletIconStyles {
|
|
|
9
12
|
*/
|
|
10
13
|
color?: BrandingColor;
|
|
11
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* @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.
|
|
17
|
+
*/
|
|
12
18
|
export declare const appletIconStyles: ({ color, }: AppletIconStyles) => CSSObject;
|
|
13
|
-
export interface AppletIconProps extends AppletIconStyles, Pick<
|
|
19
|
+
export interface AppletIconProps extends AppletIconStyles, Pick<SvgProps, 'shouldMirror' | 'cs'> {
|
|
14
20
|
/**
|
|
15
21
|
* The icon to display from `@workday/canvas-applet-icons-web`.
|
|
16
22
|
*/
|
|
@@ -21,6 +27,29 @@ export interface AppletIconProps extends AppletIconStyles, Pick<IconProps, 'shou
|
|
|
21
27
|
*/
|
|
22
28
|
size?: number;
|
|
23
29
|
}
|
|
30
|
+
export declare const appletIconStencil: import("@workday/canvas-kit-styling").Stencil<import("@workday/canvas-kit-styling").StencilModifierConfig<{
|
|
31
|
+
color200: string;
|
|
32
|
+
color300: string;
|
|
33
|
+
color400: string;
|
|
34
|
+
color500: string;
|
|
35
|
+
}, never>, {
|
|
36
|
+
color200: string;
|
|
37
|
+
color300: string;
|
|
38
|
+
color400: string;
|
|
39
|
+
color500: string;
|
|
40
|
+
}, import("@workday/canvas-kit-styling").Stencil<{
|
|
41
|
+
shouldMirror: {
|
|
42
|
+
true: {
|
|
43
|
+
transform: "scaleX(-1)";
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
}, {
|
|
47
|
+
/**
|
|
48
|
+
* The icon color hue. Must use a member of the `AppletIcon.Colors` static enum.
|
|
49
|
+
* @default AppletIcon.Colors.Blueberry
|
|
50
|
+
*/
|
|
51
|
+
size: string;
|
|
52
|
+
}, never, never>, never>;
|
|
24
53
|
export declare const AppletIcon: import("@workday/canvas-kit-react/common").ElementComponent<"span", AppletIconProps> & {
|
|
25
54
|
Colors: typeof BrandingColor;
|
|
26
55
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppletIcon.d.ts","sourceRoot":"","sources":["../../../../icon/lib/AppletIcon.tsx"],"names":[],"mappings":"AACA,OAAO,EAAS,aAAa,EAAc,MAAM,kCAAkC,CAAC;AACpF,OAAO,EAAC,gBAAgB,EAAkB,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"AppletIcon.d.ts","sourceRoot":"","sources":["../../../../icon/lib/AppletIcon.tsx"],"names":[],"mappings":"AACA,OAAO,EAAS,aAAa,EAAc,MAAM,kCAAkC,CAAC;AACpF,OAAO,EAAC,gBAAgB,EAAkB,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAM,QAAQ,EAAa,MAAM,OAAO,CAAC;AAKhD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,eAE1B,gBAAgB,KAAG,SAsCrB,CAAC;AAEF,MAAM,WAAW,eAAgB,SAAQ,gBAAgB,EAAE,IAAI,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9F;;OAEG;IACH,IAAI,EAAE,gBAAgB,CAAC;IACvB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;IAhE5B;;;OAGG;;wBA0FH,CAAC;AAEH,eAAO,MAAM,UAAU;;CAyBrB,CAAC"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { colors, BrandingColor } from '@workday/canvas-kit-react/tokens';
|
|
3
3
|
import { CanvasIconTypes } from '@workday/design-assets-types';
|
|
4
|
-
import {
|
|
4
|
+
import { Svg, svgStencil } from './Svg';
|
|
5
5
|
import { createComponent } from '@workday/canvas-kit-react/common';
|
|
6
|
+
import { handleCsProp, createStencil, px2rem, cssVar } from '@workday/canvas-kit-styling';
|
|
7
|
+
import { base } from '@workday/canvas-tokens-web';
|
|
8
|
+
/**
|
|
9
|
+
* @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.
|
|
10
|
+
*/
|
|
6
11
|
export const appletIconStyles = ({ color = BrandingColor.Blueberry, }) => {
|
|
7
12
|
// Check if valid color
|
|
8
13
|
if (!Object.keys(BrandingColor)
|
|
@@ -38,10 +43,28 @@ export const appletIconStyles = ({ color = BrandingColor.Blueberry, }) => {
|
|
|
38
43
|
},
|
|
39
44
|
};
|
|
40
45
|
};
|
|
46
|
+
export const appletIconStencil = createStencil({
|
|
47
|
+
extends: svgStencil,
|
|
48
|
+
vars: {
|
|
49
|
+
color200: '',
|
|
50
|
+
color300: '',
|
|
51
|
+
color400: '',
|
|
52
|
+
color500: '',
|
|
53
|
+
},
|
|
54
|
+
base: { name: "ce2e64", styles: "--cnvs-svg-size:5.75rem;& .color-100{fill:var(--cnvs-base-palette-french-vanilla-100);}& .color-200{fill:var(--cnvs-applet-icon-color200, var(--cnvs-base-palette-blueberry-200));}& .color-300{fill:var(--cnvs-applet-icon-color300, var(--cnvs-base-palette-blueberry-300));}& .color-400{fill:var(--cnvs-applet-icon-color400, var(--cnvs-base-palette-blueberry-400));}& .color-400-alpha-20{fill:var(--cnvs-applet-icon-color400, var(--cnvs-base-palette-blueberry-400));}& .color-500{fill:var(--cnvs-applet-icon-color500, var(--cnvs-base-palette-blueberry-400));}" }
|
|
55
|
+
}, "cnvs-applet-icon");
|
|
41
56
|
export const AppletIcon = createComponent('span')({
|
|
42
57
|
displayName: 'AppletIcon',
|
|
43
|
-
Component: ({ size
|
|
44
|
-
|
|
58
|
+
Component: ({ size, icon, color, ...elemProps }, ref, Element) => {
|
|
59
|
+
const colors = color && {
|
|
60
|
+
color200: base[`${color}200`],
|
|
61
|
+
color300: base[`${color}300`],
|
|
62
|
+
color400: base[`${color}400`],
|
|
63
|
+
color500: base[`${color}500`],
|
|
64
|
+
};
|
|
65
|
+
return (React.createElement(Svg, Object.assign({ src: icon, type: CanvasIconTypes.Applet, as: Element, ref: ref }, handleCsProp(elemProps, [
|
|
66
|
+
appletIconStencil({ ...colors, size: size ? px2rem(size) : undefined }),
|
|
67
|
+
]))));
|
|
45
68
|
},
|
|
46
69
|
subComponents: {
|
|
47
70
|
Colors: BrandingColor,
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { CanvasGraphic } from '@workday/design-assets-types';
|
|
2
2
|
import { CSSObject } from '@emotion/styled';
|
|
3
3
|
import { SvgProps } from './Svg';
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Interface `GraphicStyles` will be removed in a future version. `grow` prop will be moved inside `GraphicProps`.
|
|
6
|
+
*/
|
|
4
7
|
export interface GraphicStyles {
|
|
5
8
|
/**
|
|
6
9
|
* The width of the Graphic in `px`. The Graphic's `width` takes precedence over its `height` in order to preserve its proportions.
|
|
7
10
|
* @default width of graphic
|
|
11
|
+
* @deprecated Use `cs` to set width, `cs={{"& svg": {width: '1rem'}}}`
|
|
8
12
|
*/
|
|
9
13
|
width?: number | string;
|
|
10
14
|
/**
|
|
11
15
|
* The height of the Graphic in `px`. If the Graphic's `height` is set, its `width` will be set to `100%`.
|
|
12
16
|
* @default height of graphic
|
|
17
|
+
* @deprecated Use `cs` to set height, `cs={{"& svg": {height: '1rem'}}}`
|
|
13
18
|
*/
|
|
14
19
|
height?: number | string;
|
|
15
20
|
/**
|
|
@@ -18,12 +23,26 @@ export interface GraphicStyles {
|
|
|
18
23
|
*/
|
|
19
24
|
grow?: boolean;
|
|
20
25
|
}
|
|
21
|
-
export interface GraphicProps extends GraphicStyles, Pick<SvgProps, 'shouldMirror'> {
|
|
26
|
+
export interface GraphicProps extends GraphicStyles, Pick<SvgProps, 'shouldMirror' | 'cs'> {
|
|
22
27
|
/**
|
|
23
28
|
* The graphic to display from `@workday/canvas-graphics-web`.
|
|
24
29
|
*/
|
|
25
30
|
src: CanvasGraphic;
|
|
26
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated `graphicStyles` will be removed in in a future version as a part of implementation of stencils and new tokens. Consider to use `graphicStencil` instead.
|
|
34
|
+
*/
|
|
27
35
|
export declare const graphicStyles: ({ width, height, grow }: GraphicStyles) => CSSObject;
|
|
36
|
+
export declare const graphicStencil: import("@workday/canvas-kit-styling").Stencil<{
|
|
37
|
+
grow: {
|
|
38
|
+
true: {
|
|
39
|
+
width: string;
|
|
40
|
+
'& svg': {
|
|
41
|
+
width: string;
|
|
42
|
+
height: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
}, {}, never, never>;
|
|
28
47
|
export declare const Graphic: import("@workday/canvas-kit-react/common").ElementComponent<"span", GraphicProps>;
|
|
29
48
|
//# sourceMappingURL=Graphic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Graphic.d.ts","sourceRoot":"","sources":["../../../../icon/lib/Graphic.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAkB,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAM,QAAQ,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Graphic.d.ts","sourceRoot":"","sources":["../../../../icon/lib/Graphic.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAkB,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAM,QAAQ,EAAC,MAAM,OAAO,CAAC;AAIpC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,YAAa,SAAQ,aAAa,EAAE,IAAI,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAC;IACxF;;OAEG;IACH,GAAG,EAAE,aAAa,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,4BAA2B,aAAa,KAAG,SA4BpE,CAAC;AAOF,eAAO,MAAM,cAAc;;;;;;;;;;oBAkBzB,CAAC;AAEH,eAAO,MAAM,OAAO,mFAkBlB,CAAC"}
|
|
@@ -2,6 +2,10 @@ import * as React from 'react';
|
|
|
2
2
|
import { CanvasIconTypes } from '@workday/design-assets-types';
|
|
3
3
|
import { Svg } from './Svg';
|
|
4
4
|
import { createComponent } from '@workday/canvas-kit-react/common';
|
|
5
|
+
import { createStencil, createVars, cssVar, handleCsProp, px2rem } from '@workday/canvas-kit-styling';
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated `graphicStyles` will be removed in in a future version as a part of implementation of stencils and new tokens. Consider to use `graphicStencil` instead.
|
|
8
|
+
*/
|
|
5
9
|
export const graphicStyles = ({ width, height, grow }) => {
|
|
6
10
|
if (grow) {
|
|
7
11
|
return {
|
|
@@ -30,9 +34,27 @@ export const graphicStyles = ({ width, height, grow }) => {
|
|
|
30
34
|
}
|
|
31
35
|
return {};
|
|
32
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Part of supporting deprecated `height` and `width` props
|
|
39
|
+
*/
|
|
40
|
+
const graphicVars = createVars({ id: "cnvs-graphic", args: ["height", "width"] });
|
|
41
|
+
export const graphicStencil = createStencil({
|
|
42
|
+
base: { name: "a19511", styles: "& svg{width:var(--cnvs-graphic-width, 100%);height:var(--cnvs-graphic-height, 100%);}" },
|
|
43
|
+
modifiers: {
|
|
44
|
+
grow: {
|
|
45
|
+
true: { name: "f2369d", styles: "width:100%;& svg{width:100%;height:100%;}" }
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, "cnvs-graphic");
|
|
33
49
|
export const Graphic = createComponent('span')({
|
|
34
50
|
displayName: 'Graphic',
|
|
35
|
-
Component: ({ grow
|
|
36
|
-
return (React.createElement(Svg, Object.assign({
|
|
51
|
+
Component: ({ grow, width, height, ...elemProps }, ref, Element) => {
|
|
52
|
+
return (React.createElement(Svg, Object.assign({ type: CanvasIconTypes.Graphic, as: Element, ref: ref }, handleCsProp(elemProps, [
|
|
53
|
+
graphicStencil({ grow }),
|
|
54
|
+
{
|
|
55
|
+
[graphicVars.height]: typeof height === 'number' ? px2rem(height) : height,
|
|
56
|
+
[graphicVars.width]: typeof width === 'number' ? px2rem(width) : width,
|
|
57
|
+
},
|
|
58
|
+
]))));
|
|
37
59
|
},
|
|
38
60
|
});
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { CSSObject } from '@emotion/styled';
|
|
2
1
|
import { CanvasIcon, CanvasIconTypes } from '@workday/design-assets-types';
|
|
3
2
|
import { BoxProps } from '@workday/canvas-kit-react/layout';
|
|
4
3
|
export interface SvgProps extends BoxProps {
|
|
5
4
|
src: CanvasIcon;
|
|
6
|
-
styles?: CSSObject;
|
|
7
5
|
type: CanvasIconTypes;
|
|
8
6
|
/**
|
|
9
7
|
* If set to `true`, transform the SVG's x-axis to mirror the graphic
|
|
@@ -11,5 +9,17 @@ export interface SvgProps extends BoxProps {
|
|
|
11
9
|
*/
|
|
12
10
|
shouldMirror?: boolean;
|
|
13
11
|
}
|
|
12
|
+
export declare const svgStencil: import("@workday/canvas-kit-styling").Stencil<{
|
|
13
|
+
shouldMirror: {
|
|
14
|
+
true: {
|
|
15
|
+
transform: "scaleX(-1)";
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}, {
|
|
19
|
+
/** set width and height of svg element */
|
|
20
|
+
size: string;
|
|
21
|
+
}, never, never>;
|
|
22
|
+
/** @deprecated */
|
|
23
|
+
export declare const transformColorNameToToken: (color?: string | undefined) => string | undefined;
|
|
14
24
|
export declare const Svg: import("@workday/canvas-kit-react/common").ElementComponent<"span", SvgProps>;
|
|
15
25
|
//# sourceMappingURL=Svg.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Svg.d.ts","sourceRoot":"","sources":["../../../../icon/lib/Svg.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Svg.d.ts","sourceRoot":"","sources":["../../../../icon/lib/Svg.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAE,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAGzE,OAAO,EAAC,QAAQ,EAAc,MAAM,kCAAkC,CAAC;AAIvE,MAAM,WAAW,QAAS,SAAQ,QAAQ;IACxC,GAAG,EAAE,UAAU,CAAC;IAChB,IAAI,EAAE,eAAe,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,UAAU;;;;;;;IAEnB,0CAA0C;;gBAmB5C,CAAC;AAEH,kBAAkB;AAClB,eAAO,MAAM,yBAAyB,oDAKrC,CAAC;AAEF,eAAO,MAAM,GAAG,+EAkBd,CAAC"}
|
package/dist/es6/icon/lib/Svg.js
CHANGED
|
@@ -1,17 +1,31 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { validateIconType } from './utils';
|
|
3
|
-
import { createComponent
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
3
|
+
import { createComponent } from '@workday/canvas-kit-react/common';
|
|
4
|
+
import { mergeStyles } from '@workday/canvas-kit-react/layout';
|
|
5
|
+
import { createStencil } from '@workday/canvas-kit-styling';
|
|
6
|
+
import { base } from '@workday/canvas-tokens-web';
|
|
7
|
+
export const svgStencil = createStencil({
|
|
8
|
+
vars: {
|
|
9
|
+
/** set width and height of svg element */
|
|
10
|
+
size: '',
|
|
11
|
+
},
|
|
12
|
+
base: { name: "1ea8e4", styles: "box-sizing:border-box;display:inline-block;> svg{display:block;width:var(--cnvs-svg-size);height:var(--cnvs-svg-size);}" },
|
|
13
|
+
modifiers: {
|
|
14
|
+
shouldMirror: {
|
|
15
|
+
true: { name: "4302e3", styles: "transform:scaleX(-1);" }
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}, "cnvs-svg");
|
|
19
|
+
/** @deprecated */
|
|
20
|
+
export const transformColorNameToToken = (color) => {
|
|
21
|
+
if (color && color in base) {
|
|
22
|
+
return base[color];
|
|
23
|
+
}
|
|
24
|
+
return color;
|
|
25
|
+
};
|
|
12
26
|
export const Svg = createComponent('span')({
|
|
13
27
|
displayName: 'Svg',
|
|
14
|
-
Component: ({ src, type, ...elemProps }, ref, Element) => {
|
|
28
|
+
Component: ({ shouldMirror, src, type, ...elemProps }, ref, Element) => {
|
|
15
29
|
try {
|
|
16
30
|
validateIconType(src, type);
|
|
17
31
|
}
|
|
@@ -19,6 +33,6 @@ export const Svg = createComponent('span')({
|
|
|
19
33
|
console.error(e);
|
|
20
34
|
return null;
|
|
21
35
|
}
|
|
22
|
-
return (React.createElement(
|
|
36
|
+
return (React.createElement(Element, Object.assign({ ref: ref, dangerouslySetInnerHTML: { __html: src.svg } }, mergeStyles(elemProps, svgStencil({ shouldMirror })))));
|
|
23
37
|
},
|
|
24
38
|
});
|
|
@@ -1,46 +1,73 @@
|
|
|
1
1
|
import { CanvasSystemIcon } from '@workday/design-assets-types';
|
|
2
2
|
import { CSSObject } from '@emotion/styled';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { SvgProps } from './Svg';
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Interface `SystemIconStyles` will be removed in a future version. `accent`, `color`, background props will be moved inside `GraphicProps`.
|
|
6
|
+
*/
|
|
5
7
|
export interface SystemIconStyles {
|
|
6
8
|
/**
|
|
7
9
|
* The accent color of the SystemIcon. This overrides `color`.
|
|
8
10
|
*/
|
|
9
|
-
accent?:
|
|
11
|
+
accent?: string;
|
|
10
12
|
/**
|
|
11
13
|
* The accent color of the SystemIcon on hover. This overrides `colorHover`.
|
|
14
|
+
* @deprecated `accentHover` is deprecated and will be removed in a future version. Please use the following instead in your style overrides:
|
|
15
|
+
* ```tsx
|
|
16
|
+
* '&:hover': {
|
|
17
|
+
* [systemIconStencil.vars.accent]: desiredAccentHoverColor
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
12
20
|
*/
|
|
13
|
-
accentHover?:
|
|
21
|
+
accentHover?: string;
|
|
14
22
|
/**
|
|
15
23
|
* The background color of the SystemIcon.
|
|
16
24
|
* @default transparent
|
|
17
25
|
*/
|
|
18
|
-
background?:
|
|
26
|
+
background?: string;
|
|
19
27
|
/**
|
|
20
28
|
* The background color of the SystemIcon on hover.
|
|
21
29
|
* @default transparent
|
|
30
|
+
* @deprecated `backgroundHover` is deprecated and will be removed in a future version. Please use the following instead in your style overrides:
|
|
31
|
+
* ```tsx
|
|
32
|
+
* '&:hover': {
|
|
33
|
+
* [systemIconStencil.vars.background]: desiredBackgroundHoverColor
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
22
36
|
*/
|
|
23
|
-
backgroundHover?:
|
|
37
|
+
backgroundHover?: string;
|
|
24
38
|
/**
|
|
25
|
-
* The color of the SystemIcon. This defines `accent` and `fill`. `color` may be
|
|
26
|
-
* @default
|
|
39
|
+
* The color of the SystemIcon. This defines `accent` and `fill`. `color` may be overwritten by `accent` and `fill`.
|
|
40
|
+
* @default base.licorice200
|
|
27
41
|
*/
|
|
28
|
-
color?:
|
|
42
|
+
color?: string;
|
|
29
43
|
/**
|
|
30
|
-
* The hover color of the SystemIcon. This defines `accentHover` and `fillHover`. `colorHover` may be
|
|
31
|
-
* @default
|
|
44
|
+
* The hover color of the SystemIcon. This defines `accentHover` and `fillHover`. `colorHover` may be overwritten by `accentHover` and `fillHover`.
|
|
45
|
+
* @default base.licorice200
|
|
46
|
+
* @deprecated `colorHover` is deprecated and will be removed in a future version. Please use the following instead in your style overrides:
|
|
47
|
+
* ```tsx
|
|
48
|
+
* '&:hover': {
|
|
49
|
+
* [systemIconStencil.vars.color]: desiredColorHoverColor
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
32
52
|
*/
|
|
33
|
-
colorHover?:
|
|
53
|
+
colorHover?: string;
|
|
34
54
|
/**
|
|
35
55
|
* The fill color of the SystemIcon. This overrides `color`.
|
|
56
|
+
* @deprecated `fill` is deprecated and will be removed in a future version. Please use `color` and specify `accent` color if you want `accent` to be different from `color`.
|
|
36
57
|
*/
|
|
37
|
-
fill?:
|
|
58
|
+
fill?: string;
|
|
38
59
|
/**
|
|
39
60
|
* The fill color of the SystemIcon on hover. This overrides `colorHover`.
|
|
61
|
+
* @deprecated `fillHover` is deprecated and will be removed in a future version. Please use the following instead in your style overrides:
|
|
62
|
+
* ```tsx
|
|
63
|
+
* '&:hover': {
|
|
64
|
+
* [systemIconStencil.vars.fill]: desiredFillHoverColor
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
40
67
|
*/
|
|
41
|
-
fillHover?:
|
|
68
|
+
fillHover?: string;
|
|
42
69
|
}
|
|
43
|
-
export interface SystemIconProps extends SystemIconStyles, Omit<
|
|
70
|
+
export interface SystemIconProps extends SystemIconStyles, Omit<SvgProps, 'src' | 'type' | 'fill' | 'background' | 'color'> {
|
|
44
71
|
/**
|
|
45
72
|
* The icon to display from `@workday/canvas-system-icons-web`.
|
|
46
73
|
*/
|
|
@@ -48,8 +75,44 @@ export interface SystemIconProps extends SystemIconStyles, Omit<IconProps, 'src'
|
|
|
48
75
|
/**
|
|
49
76
|
* The size of the SystemIcon in `px`.
|
|
50
77
|
*/
|
|
51
|
-
size?: number | string
|
|
78
|
+
size?: number | string;
|
|
52
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* @deprecated This style utility function is deprecated and will be removed in a future version. We'll track usage over time to prevent unnecessary burden on upgrading. Most of the time, this function is used in conjunction with styling `SystemIcon`. There are a few ways to override the colors used in `SystemIcon`.
|
|
82
|
+
* - Pass props directly to the `SystemIcon` component: `<SystemIcon color={color} {...etc} />
|
|
83
|
+
* - Style overrides using the `systemIconStencil`:
|
|
84
|
+
* ```tsx
|
|
85
|
+
* // styling container
|
|
86
|
+
*
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
53
89
|
export declare const systemIconStyles: ({ accent, accentHover, background, backgroundHover, color, colorHover, fill, fillHover, }: SystemIconStyles) => CSSObject;
|
|
90
|
+
export declare const systemIconStencil: import("@workday/canvas-kit-styling").Stencil<import("@workday/canvas-kit-styling").StencilModifierConfig<{
|
|
91
|
+
/**
|
|
92
|
+
* This will set the icon's color (both `.wd-icon-fill` and `.wd-icon-accent` SVG layers). Most
|
|
93
|
+
* of the time, this is the only color you need to change. Icons also have an accent layer. If you
|
|
94
|
+
* wish to change the accent layer independently, also set the `accentColor` variable
|
|
95
|
+
*/
|
|
96
|
+
color: string;
|
|
97
|
+
accentColor: string;
|
|
98
|
+
backgroundColor: string;
|
|
99
|
+
}, never>, {
|
|
100
|
+
/**
|
|
101
|
+
* This will set the icon's color (both `.wd-icon-fill` and `.wd-icon-accent` SVG layers). Most
|
|
102
|
+
* of the time, this is the only color you need to change. Icons also have an accent layer. If you
|
|
103
|
+
* wish to change the accent layer independently, also set the `accentColor` variable
|
|
104
|
+
*/
|
|
105
|
+
color: string;
|
|
106
|
+
accentColor: string;
|
|
107
|
+
backgroundColor: string;
|
|
108
|
+
}, import("@workday/canvas-kit-styling").Stencil<{
|
|
109
|
+
shouldMirror: {
|
|
110
|
+
true: {
|
|
111
|
+
transform: "scaleX(-1)";
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
}, {
|
|
115
|
+
size: string;
|
|
116
|
+
}, never, never>, never>;
|
|
54
117
|
export declare const SystemIcon: import("@workday/canvas-kit-react/common").ElementComponent<"span", SystemIconProps>;
|
|
55
118
|
//# sourceMappingURL=SystemIcon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SystemIcon.d.ts","sourceRoot":"","sources":["../../../../icon/lib/SystemIcon.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,gBAAgB,EAAkB,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"SystemIcon.d.ts","sourceRoot":"","sources":["../../../../icon/lib/SystemIcon.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,gBAAgB,EAAkB,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAI1C,OAAO,EAAM,QAAQ,EAAwC,MAAM,OAAO,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;;;OASG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eACf,SAAQ,gBAAgB,EACtB,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,YAAY,GAAG,OAAO,CAAC;IAClE;;OAEG;IACH,IAAI,EAAE,gBAAgB,CAAC;IACvB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,8FAS1B,gBAAgB,KAAG,SAmBpB,CAAC;AAiBH,eAAO,MAAM,iBAAiB;IAG1B;;;;OAIG;;;;;IAJH;;;;OAIG;;;;;;;;;;;;wBAmCL,CAAC;AAEH,eAAO,MAAM,UAAU,sFA0CrB,CAAC"}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { iconColors } from '@workday/canvas-kit-react/tokens';
|
|
3
3
|
import { CanvasIconTypes } from '@workday/design-assets-types';
|
|
4
|
-
import { Icon } from './Icon';
|
|
5
4
|
import { createComponent, getColor } from '@workday/canvas-kit-react/common';
|
|
5
|
+
import { cssVar, createStencil, handleCsProp, px2rem, createVars } from '@workday/canvas-kit-styling';
|
|
6
|
+
import { base } from '@workday/canvas-tokens-web';
|
|
7
|
+
import { Svg, svgStencil, transformColorNameToToken } from './Svg';
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated This style utility function is deprecated and will be removed in a future version. We'll track usage over time to prevent unnecessary burden on upgrading. Most of the time, this function is used in conjunction with styling `SystemIcon`. There are a few ways to override the colors used in `SystemIcon`.
|
|
10
|
+
* - Pass props directly to the `SystemIcon` component: `<SystemIcon color={color} {...etc} />
|
|
11
|
+
* - Style overrides using the `systemIconStencil`:
|
|
12
|
+
* ```tsx
|
|
13
|
+
* // styling container
|
|
14
|
+
*
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
6
17
|
export const systemIconStyles = ({ accent, accentHover, background = 'transparent', backgroundHover = 'transparent', color = iconColors.standard, colorHover = iconColors.hover, fill, fillHover, }) => ({
|
|
7
18
|
'& .wd-icon-fill': {
|
|
8
19
|
fill: getColor(fill) || getColor(color),
|
|
@@ -23,19 +34,45 @@ export const systemIconStyles = ({ accent, accentHover, background = 'transparen
|
|
|
23
34
|
fill: getColor(backgroundHover),
|
|
24
35
|
},
|
|
25
36
|
});
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated These variables are being used for backward compatibility with existing hover props. Please use the following instead:
|
|
39
|
+
* ```tsx
|
|
40
|
+
* '&:hover': {
|
|
41
|
+
* [systemIconStencil.vars.color]: desiredHoverColor
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
const deprecatedSystemIconVars = createVars({ id: "cnvs-deprecated-system-icon", args: ["colorHover", "fillHover", "accentHover", "backgroundHover"] });
|
|
46
|
+
export const systemIconStencil = createStencil({
|
|
47
|
+
extends: svgStencil,
|
|
48
|
+
vars: {
|
|
49
|
+
/**
|
|
50
|
+
* This will set the icon's color (both `.wd-icon-fill` and `.wd-icon-accent` SVG layers). Most
|
|
51
|
+
* of the time, this is the only color you need to change. Icons also have an accent layer. If you
|
|
52
|
+
* wish to change the accent layer independently, also set the `accentColor` variable
|
|
53
|
+
*/
|
|
54
|
+
color: '',
|
|
55
|
+
accentColor: '',
|
|
56
|
+
backgroundColor: 'transparent',
|
|
57
|
+
},
|
|
58
|
+
base: { name: "67a1c3", styles: "--cnvs-system-icon-backgroundColor:transparent;& .wd-icon-fill{fill:var(--cnvs-system-icon-color, var(--cnvs-base-palette-licorice-200));}& .wd-icon-accent, & .wd-icon-accent2{fill:var(--cnvs-system-icon-accentColor, var(--cnvs-system-icon-color, var(--cnvs-base-palette-licorice-200)));}& .wd-icon-background{fill:var(--cnvs-system-icon-backgroundColor);}&:where(:hover, .hover) .wd-icon-fill{fill:var(--cnvs-deprecated-system-icon-fillHover, var(--cnvs-deprecated-system-icon-colorHover, var(--cnvs-system-icon-color, var(--cnvs-base-palette-licorice-200))));}&:where(:hover, .hover) .wd-icon-accent, & .wd-icon-accent2{fill:var(--cnvs-deprecated-system-icon-accentHover, var(--cnvs-deprecated-system-icon-colorHover, var(--cnvs-system-icon-accentColor, var(--cnvs-system-icon-color, var(--cnvs-base-palette-licorice-200)))));}&:where(:hover, .hover) .wd-icon-background{fill:var(--cnvs-deprecated-system-icon-backgroundHover, var(--cnvs-system-icon-backgroundColor));}" }
|
|
59
|
+
}, "cnvs-system-icon");
|
|
26
60
|
export const SystemIcon = createComponent('span')({
|
|
27
61
|
displayName: 'SystemIcon',
|
|
28
|
-
Component: ({ background
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
62
|
+
Component: ({ size, background, backgroundHover, color, colorHover, icon, accent, accentHover, fill, fillHover, ...elemProps }, ref, Element) => {
|
|
63
|
+
return (React.createElement(Svg, Object.assign({ as: Element, src: icon, type: CanvasIconTypes.System, ref: ref }, handleCsProp(elemProps, [
|
|
64
|
+
systemIconStencil({
|
|
65
|
+
size: typeof size === 'number' ? px2rem(size) : size,
|
|
66
|
+
color: transformColorNameToToken(fill || color),
|
|
67
|
+
accentColor: transformColorNameToToken(accent || color),
|
|
68
|
+
backgroundColor: transformColorNameToToken(background),
|
|
69
|
+
}),
|
|
70
|
+
{
|
|
71
|
+
[deprecatedSystemIconVars.colorHover]: colorHover && cssVar(colorHover),
|
|
72
|
+
[deprecatedSystemIconVars.fillHover]: fillHover && cssVar(fillHover),
|
|
73
|
+
[deprecatedSystemIconVars.accentHover]: accentHover && cssVar(accentHover),
|
|
74
|
+
[deprecatedSystemIconVars.backgroundHover]: backgroundHover && cssVar(backgroundHover),
|
|
75
|
+
},
|
|
76
|
+
]))));
|
|
40
77
|
},
|
|
41
78
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SystemIconProps } from './SystemIcon';
|
|
2
2
|
import { CanvasSystemIcon } from '@workday/design-assets-types';
|
|
3
|
-
import { SystemPropValues } from '@workday/canvas-kit-react/layout';
|
|
4
3
|
export declare enum SystemIconCircleSize {
|
|
5
4
|
xs = 16,
|
|
6
5
|
s = 24,
|
|
@@ -12,9 +11,9 @@ export declare enum SystemIconCircleSize {
|
|
|
12
11
|
export interface SystemIconCircleProps extends Pick<SystemIconProps, 'shouldMirror'> {
|
|
13
12
|
/**
|
|
14
13
|
* The background color of the SystemIconCircle from `@workday/canvas-colors-web`.
|
|
15
|
-
* @default
|
|
14
|
+
* @default base.soap300
|
|
16
15
|
*/
|
|
17
|
-
background?:
|
|
16
|
+
background?: string;
|
|
18
17
|
/**
|
|
19
18
|
* The icon to display from `@workday/canvas-accent-icons-web`.
|
|
20
19
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SystemIconCircle.d.ts","sourceRoot":"","sources":["../../../../icon/lib/SystemIconCircle.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SystemIconCircle.d.ts","sourceRoot":"","sources":["../../../../icon/lib/SystemIconCircle.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAa,eAAe,EAAoB,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAM9D,oBAAY,oBAAoB;IAC9B,EAAE,KAAK;IACP,CAAC,KAAK;IACN,CAAC,KAAK;IACN,CAAC,KAAK;IACN,EAAE,KAAK;IACP,GAAG,MAAM;CACV;AAED,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC;IAClF;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,IAAI,EAAE,gBAAgB,CAAC;IACvB;;;OAGG;IACH,IAAI,CAAC,EAAE,oBAAoB,GAAG,MAAM,CAAC;CACtC;AA6BD,eAAO,MAAM,gBAAgB,4FAwB3B,CAAC"}
|