@workday/canvas-kit-react 8.4.4 → 8.5.0-313-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.
@@ -1,45 +1,46 @@
1
1
  import { CanvasSystemIcon } from '@workday/design-assets-types';
2
2
  import { CSSObject } from '@emotion/styled';
3
3
  import { IconProps } from './Icon';
4
+ import { SystemPropValues } from '@workday/canvas-kit-react/layout';
4
5
  export interface SystemIconStyles {
5
6
  /**
6
7
  * The accent color of the SystemIcon. This overrides `color`.
7
8
  */
8
- accent?: string;
9
+ accent?: SystemPropValues['color'];
9
10
  /**
10
11
  * The accent color of the SystemIcon on hover. This overrides `colorHover`.
11
12
  */
12
- accentHover?: string;
13
+ accentHover?: SystemPropValues['color'];
13
14
  /**
14
15
  * The background color of the SystemIcon.
15
16
  * @default transparent
16
17
  */
17
- background?: string;
18
+ background?: SystemPropValues['color'];
18
19
  /**
19
20
  * The background color of the SystemIcon on hover.
20
21
  * @default transparent
21
22
  */
22
- backgroundHover?: string;
23
+ backgroundHover?: SystemPropValues['color'];
23
24
  /**
24
25
  * The color of the SystemIcon. This defines `accent` and `fill`. `color` may be overriden by `accent` and `fill`.
25
26
  * @default iconColors.standard
26
27
  */
27
- color?: string;
28
+ color?: SystemPropValues['color'];
28
29
  /**
29
30
  * The hover color of the SystemIcon. This defines `accentHover` and `fillHover`. `colorHover` may be overriden by `accentHover` and `fillHover`.
30
31
  * @default iconColors.hover
31
32
  */
32
- colorHover?: string;
33
+ colorHover?: SystemPropValues['color'];
33
34
  /**
34
35
  * The fill color of the SystemIcon. This overrides `color`.
35
36
  */
36
- fill?: string;
37
+ fill?: SystemPropValues['color'];
37
38
  /**
38
39
  * The fill color of the SystemIcon on hover. This overrides `colorHover`.
39
40
  */
40
- fillHover?: string;
41
+ fillHover?: SystemPropValues['color'];
41
42
  }
42
- export interface SystemIconProps extends SystemIconStyles, Omit<IconProps, 'src' | 'color' | 'fill' | 'type' | 'background'> {
43
+ export interface SystemIconProps extends SystemIconStyles, Omit<IconProps, 'src' | 'fill' | 'type'> {
43
44
  /**
44
45
  * The icon to display from `@workday/canvas-system-icons-web`.
45
46
  */
@@ -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;AAC1C,OAAO,EAAO,SAAS,EAAC,MAAM,QAAQ,CAAC;AAGvC,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eACf,SAAQ,gBAAgB,EACtB,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,YAAY,CAAC;IACnE;;OAEG;IACH,IAAI,EAAE,gBAAgB,CAAC;IACvB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,gBAAgB,8FAS1B,gBAAgB,KAAG,SAmBpB,CAAC;AAEH,eAAO,MAAM,UAAU,kEA4CrB,CAAC"}
1
+ {"version":3,"file":"SystemIcon.d.ts","sourceRoot":"","sources":["../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 = require("@workday/canvas-kit-react/tokens");
47
47
  var design_assets_types_1 = require("@workday/design-assets-types");
48
48
  var Icon_1 = require("./Icon");
49
49
  var common_1 = require("@workday/canvas-kit-react/common");
50
+ var utils_1 = require("./utils");
50
51
  var systemIconStyles = function (_a) {
51
52
  var accent = _a.accent, accentHover = _a.accentHover, _b = _a.background, background = _b === void 0 ? 'transparent' : _b, _c = _a.backgroundHover, backgroundHover = _c === void 0 ? 'transparent' : _c, _d = _a.color, color = _d === void 0 ? tokens_1.iconColors.standard : _d, _e = _a.colorHover, colorHover = _e === void 0 ? tokens_1.iconColors.hover : _e, fill = _a.fill, fillHover = _a.fillHover;
52
53
  return ({
53
54
  '& .wd-icon-fill': {
54
- fill: fill || color,
55
+ fill: utils_1.getColor(fill) || utils_1.getColor(color),
55
56
  },
56
57
  ':hover .wd-icon-fill': {
57
- fill: fillHover || colorHover,
58
+ fill: utils_1.getColor(fillHover) || utils_1.getColor(colorHover),
58
59
  },
59
60
  '& .wd-icon-accent, & .wd-icon-accent2': {
60
- fill: accent || color,
61
+ fill: utils_1.getColor(accent) || utils_1.getColor(color),
61
62
  },
62
63
  ':hover .wd-icon-accent, :hover .wd-icon-accent2': {
63
- fill: accentHover || colorHover,
64
+ fill: utils_1.getColor(accentHover) || utils_1.getColor(colorHover),
64
65
  },
65
66
  '& .wd-icon-background': {
66
- fill: background,
67
+ fill: utils_1.getColor(background),
67
68
  },
68
69
  ':hover .wd-icon-background': {
69
- fill: backgroundHover,
70
+ fill: utils_1.getColor(backgroundHover),
70
71
  },
71
72
  });
72
73
  };
@@ -1,3 +1,5 @@
1
1
  import { CanvasIcon, CanvasIconTypes } from '@workday/design-assets-types';
2
+ import { CanvasColor } from '@workday/canvas-kit-react/tokens';
2
3
  export declare function validateIconType(icon: CanvasIcon, expectedType: CanvasIconTypes): void;
4
+ export declare function getColor(value?: CanvasColor | string): string | undefined;
3
5
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../icon/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAEzE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,eAAe,QAI/E"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../icon/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,eAAe,EAAC,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAC,WAAW,EAAS,MAAM,kCAAkC,CAAC;AAErE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,eAAe,QAI/E;AAED,wBAAgB,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,GAAG,MAAM,sBAKpD"}
@@ -1,9 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateIconType = void 0;
3
+ exports.getColor = exports.validateIconType = void 0;
4
+ var tokens_1 = require("@workday/canvas-kit-react/tokens");
4
5
  function validateIconType(icon, expectedType) {
5
6
  if (icon.type !== expectedType) {
6
7
  throw icon.name + ": Icon type \"" + icon.type + "\" does not match expected type \"" + expectedType + "\"";
7
8
  }
8
9
  }
9
10
  exports.validateIconType = validateIconType;
11
+ function getColor(value) {
12
+ if (value in tokens_1.colors) {
13
+ return tokens_1.colors[value];
14
+ }
15
+ return value;
16
+ }
17
+ exports.getColor = getColor;
@@ -12,6 +12,7 @@ export * from './lib/utils/grid';
12
12
  export * from './lib/utils/gridItem';
13
13
  export * from './lib/utils/layout';
14
14
  export * from './lib/utils/other';
15
+ export * from './lib/utils/systemProps';
15
16
  export * from './lib/utils/position';
16
17
  export { SpaceStyleProps, spaceStyleFnConfigs } from './lib/utils/space';
17
18
  export { AllStyleProps, CommonStyleProps } from './lib/utils/styleProps';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAC,CAAC;AAC7C,cAAc,WAAW,CAAC;AAC1B,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAC,eAAe,EAAE,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AACvE,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAC,eAAe,EAAE,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,wBAAwB,CAAC;AACvE,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACvF,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAC,CAAC;AAC7C,cAAc,WAAW,CAAC;AAC1B,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAC,eAAe,EAAE,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AACvE,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAC,eAAe,EAAE,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,wBAAwB,CAAC;AACvE,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACvF,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
@@ -27,6 +27,7 @@ __exportStar(require("./lib/utils/grid"), exports);
27
27
  __exportStar(require("./lib/utils/gridItem"), exports);
28
28
  __exportStar(require("./lib/utils/layout"), exports);
29
29
  __exportStar(require("./lib/utils/other"), exports);
30
+ __exportStar(require("./lib/utils/systemProps"), exports);
30
31
  __exportStar(require("./lib/utils/position"), exports);
31
32
  var space_1 = require("./lib/utils/space");
32
33
  Object.defineProperty(exports, "spaceStyleFnConfigs", { enumerable: true, get: function () { return space_1.spaceStyleFnConfigs; } });
@@ -1,45 +1,46 @@
1
1
  import { CanvasSystemIcon } from '@workday/design-assets-types';
2
2
  import { CSSObject } from '@emotion/styled';
3
3
  import { IconProps } from './Icon';
4
+ import { SystemPropValues } from '@workday/canvas-kit-react/layout';
4
5
  export interface SystemIconStyles {
5
6
  /**
6
7
  * The accent color of the SystemIcon. This overrides `color`.
7
8
  */
8
- accent?: string;
9
+ accent?: SystemPropValues['color'];
9
10
  /**
10
11
  * The accent color of the SystemIcon on hover. This overrides `colorHover`.
11
12
  */
12
- accentHover?: string;
13
+ accentHover?: SystemPropValues['color'];
13
14
  /**
14
15
  * The background color of the SystemIcon.
15
16
  * @default transparent
16
17
  */
17
- background?: string;
18
+ background?: SystemPropValues['color'];
18
19
  /**
19
20
  * The background color of the SystemIcon on hover.
20
21
  * @default transparent
21
22
  */
22
- backgroundHover?: string;
23
+ backgroundHover?: SystemPropValues['color'];
23
24
  /**
24
25
  * The color of the SystemIcon. This defines `accent` and `fill`. `color` may be overriden by `accent` and `fill`.
25
26
  * @default iconColors.standard
26
27
  */
27
- color?: string;
28
+ color?: SystemPropValues['color'];
28
29
  /**
29
30
  * The hover color of the SystemIcon. This defines `accentHover` and `fillHover`. `colorHover` may be overriden by `accentHover` and `fillHover`.
30
31
  * @default iconColors.hover
31
32
  */
32
- colorHover?: string;
33
+ colorHover?: SystemPropValues['color'];
33
34
  /**
34
35
  * The fill color of the SystemIcon. This overrides `color`.
35
36
  */
36
- fill?: string;
37
+ fill?: SystemPropValues['color'];
37
38
  /**
38
39
  * The fill color of the SystemIcon on hover. This overrides `colorHover`.
39
40
  */
40
- fillHover?: string;
41
+ fillHover?: SystemPropValues['color'];
41
42
  }
42
- export interface SystemIconProps extends SystemIconStyles, Omit<IconProps, 'src' | 'color' | 'fill' | 'type' | 'background'> {
43
+ export interface SystemIconProps extends SystemIconStyles, Omit<IconProps, 'src' | 'fill' | 'type'> {
43
44
  /**
44
45
  * The icon to display from `@workday/canvas-system-icons-web`.
45
46
  */
@@ -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;AAC1C,OAAO,EAAO,SAAS,EAAC,MAAM,QAAQ,CAAC;AAGvC,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eACf,SAAQ,gBAAgB,EACtB,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,YAAY,CAAC;IACnE;;OAEG;IACH,IAAI,EAAE,gBAAgB,CAAC;IACvB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,gBAAgB,8FAS1B,gBAAgB,KAAG,SAmBpB,CAAC;AAEH,eAAO,MAAM,UAAU,kEA4CrB,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;AAC1C,OAAO,EAAO,SAAS,EAAC,MAAM,QAAQ,CAAC;AAGvC,OAAO,EAAC,gBAAgB,EAAC,MAAM,kCAAkC,CAAC;AAElE,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,MAAM,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACnC;;OAEG;IACH,WAAW,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACxC;;;OAGG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACvC;;;OAGG;IACH,eAAe,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC5C;;;OAGG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAClC;;;OAGG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACvC;;OAEG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACjC;;OAEG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,eACf,SAAQ,gBAAgB,EACtB,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;IAC1C;;OAEG;IACH,IAAI,EAAE,gBAAgB,CAAC;IACvB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,gBAAgB,8FAS1B,gBAAgB,KAAG,SAmBpB,CAAC;AAEH,eAAO,MAAM,UAAU,kEA4CrB,CAAC"}
@@ -25,26 +25,27 @@ import { iconColors } from '@workday/canvas-kit-react/tokens';
25
25
  import { CanvasIconTypes } from '@workday/design-assets-types';
26
26
  import { Icon } from './Icon';
27
27
  import { createComponent } from '@workday/canvas-kit-react/common';
28
+ import { getColor } from './utils';
28
29
  export var systemIconStyles = function (_a) {
29
30
  var accent = _a.accent, accentHover = _a.accentHover, _b = _a.background, background = _b === void 0 ? 'transparent' : _b, _c = _a.backgroundHover, backgroundHover = _c === void 0 ? 'transparent' : _c, _d = _a.color, color = _d === void 0 ? iconColors.standard : _d, _e = _a.colorHover, colorHover = _e === void 0 ? iconColors.hover : _e, fill = _a.fill, fillHover = _a.fillHover;
30
31
  return ({
31
32
  '& .wd-icon-fill': {
32
- fill: fill || color,
33
+ fill: getColor(fill) || getColor(color),
33
34
  },
34
35
  ':hover .wd-icon-fill': {
35
- fill: fillHover || colorHover,
36
+ fill: getColor(fillHover) || getColor(colorHover),
36
37
  },
37
38
  '& .wd-icon-accent, & .wd-icon-accent2': {
38
- fill: accent || color,
39
+ fill: getColor(accent) || getColor(color),
39
40
  },
40
41
  ':hover .wd-icon-accent, :hover .wd-icon-accent2': {
41
- fill: accentHover || colorHover,
42
+ fill: getColor(accentHover) || getColor(colorHover),
42
43
  },
43
44
  '& .wd-icon-background': {
44
- fill: background,
45
+ fill: getColor(background),
45
46
  },
46
47
  ':hover .wd-icon-background': {
47
- fill: backgroundHover,
48
+ fill: getColor(backgroundHover),
48
49
  },
49
50
  });
50
51
  };
@@ -1,3 +1,5 @@
1
1
  import { CanvasIcon, CanvasIconTypes } from '@workday/design-assets-types';
2
+ import { CanvasColor } from '@workday/canvas-kit-react/tokens';
2
3
  export declare function validateIconType(icon: CanvasIcon, expectedType: CanvasIconTypes): void;
4
+ export declare function getColor(value?: CanvasColor | string): string | undefined;
3
5
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../icon/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAEzE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,eAAe,QAI/E"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../icon/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,eAAe,EAAC,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAC,WAAW,EAAS,MAAM,kCAAkC,CAAC;AAErE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,eAAe,QAI/E;AAED,wBAAgB,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,GAAG,MAAM,sBAKpD"}
@@ -1,5 +1,12 @@
1
+ import { colors } from '@workday/canvas-kit-react/tokens';
1
2
  export function validateIconType(icon, expectedType) {
2
3
  if (icon.type !== expectedType) {
3
4
  throw icon.name + ": Icon type \"" + icon.type + "\" does not match expected type \"" + expectedType + "\"";
4
5
  }
5
6
  }
7
+ export function getColor(value) {
8
+ if (value in colors) {
9
+ return colors[value];
10
+ }
11
+ return value;
12
+ }
@@ -12,6 +12,7 @@ export * from './lib/utils/grid';
12
12
  export * from './lib/utils/gridItem';
13
13
  export * from './lib/utils/layout';
14
14
  export * from './lib/utils/other';
15
+ export * from './lib/utils/systemProps';
15
16
  export * from './lib/utils/position';
16
17
  export { SpaceStyleProps, spaceStyleFnConfigs } from './lib/utils/space';
17
18
  export { AllStyleProps, CommonStyleProps } from './lib/utils/styleProps';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAC,CAAC;AAC7C,cAAc,WAAW,CAAC;AAC1B,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAC,eAAe,EAAE,mBAAmB,EAAC,MAAM,mBAAmB,CAA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yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAC,eAAe,EAAE,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,wBAAwB,CAAC;AACvE,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACvF,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
@@ -12,6 +12,7 @@ export * from './lib/utils/grid';
12
12
  export * from './lib/utils/gridItem';
13
13
  export * from './lib/utils/layout';
14
14
  export * from './lib/utils/other';
15
+ export * from './lib/utils/systemProps';
15
16
  export * from './lib/utils/position';
16
17
  export { spaceStyleFnConfigs } from './lib/utils/space';
17
18
  export * from './lib/utils/text';
@@ -4,49 +4,51 @@ import {CanvasSystemIcon, CanvasIconTypes} from '@workday/design-assets-types';
4
4
  import {CSSObject} from '@emotion/styled';
5
5
  import {Icon, IconProps} from './Icon';
6
6
  import {createComponent} from '@workday/canvas-kit-react/common';
7
+ import {getColor} from './utils';
8
+ import {SystemPropValues} from '@workday/canvas-kit-react/layout';
7
9
 
8
10
  export interface SystemIconStyles {
9
11
  /**
10
12
  * The accent color of the SystemIcon. This overrides `color`.
11
13
  */
12
- accent?: string;
14
+ accent?: SystemPropValues['color'];
13
15
  /**
14
16
  * The accent color of the SystemIcon on hover. This overrides `colorHover`.
15
17
  */
16
- accentHover?: string;
18
+ accentHover?: SystemPropValues['color'];
17
19
  /**
18
20
  * The background color of the SystemIcon.
19
21
  * @default transparent
20
22
  */
21
- background?: string;
23
+ background?: SystemPropValues['color'];
22
24
  /**
23
25
  * The background color of the SystemIcon on hover.
24
26
  * @default transparent
25
27
  */
26
- backgroundHover?: string;
28
+ backgroundHover?: SystemPropValues['color'];
27
29
  /**
28
30
  * The color of the SystemIcon. This defines `accent` and `fill`. `color` may be overriden by `accent` and `fill`.
29
31
  * @default iconColors.standard
30
32
  */
31
- color?: string;
33
+ color?: SystemPropValues['color'];
32
34
  /**
33
35
  * The hover color of the SystemIcon. This defines `accentHover` and `fillHover`. `colorHover` may be overriden by `accentHover` and `fillHover`.
34
36
  * @default iconColors.hover
35
37
  */
36
- colorHover?: string;
38
+ colorHover?: SystemPropValues['color'];
37
39
  /**
38
40
  * The fill color of the SystemIcon. This overrides `color`.
39
41
  */
40
- fill?: string;
42
+ fill?: SystemPropValues['color'];
41
43
  /**
42
44
  * The fill color of the SystemIcon on hover. This overrides `colorHover`.
43
45
  */
44
- fillHover?: string;
46
+ fillHover?: SystemPropValues['color'];
45
47
  }
46
48
 
47
49
  export interface SystemIconProps
48
50
  extends SystemIconStyles,
49
- Omit<IconProps, 'src' | 'color' | 'fill' | 'type' | 'background'> {
51
+ Omit<IconProps, 'src' | 'fill' | 'type'> {
50
52
  /**
51
53
  * The icon to display from `@workday/canvas-system-icons-web`.
52
54
  */
@@ -69,22 +71,22 @@ export const systemIconStyles = ({
69
71
  fillHover,
70
72
  }: SystemIconStyles): CSSObject => ({
71
73
  '& .wd-icon-fill': {
72
- fill: fill || color,
74
+ fill: getColor(fill) || getColor(color),
73
75
  },
74
76
  ':hover .wd-icon-fill': {
75
- fill: fillHover || colorHover,
77
+ fill: getColor(fillHover) || getColor(colorHover),
76
78
  },
77
79
  '& .wd-icon-accent, & .wd-icon-accent2': {
78
- fill: accent || color,
80
+ fill: getColor(accent) || getColor(color),
79
81
  },
80
82
  ':hover .wd-icon-accent, :hover .wd-icon-accent2': {
81
- fill: accentHover || colorHover,
83
+ fill: getColor(accentHover) || getColor(colorHover),
82
84
  },
83
85
  '& .wd-icon-background': {
84
- fill: background,
86
+ fill: getColor(background),
85
87
  },
86
88
  ':hover .wd-icon-background': {
87
- fill: backgroundHover,
89
+ fill: getColor(backgroundHover),
88
90
  },
89
91
  });
90
92
 
package/icon/lib/utils.ts CHANGED
@@ -1,7 +1,15 @@
1
1
  import {CanvasIcon, CanvasIconTypes} from '@workday/design-assets-types';
2
+ import {CanvasColor, colors} from '@workday/canvas-kit-react/tokens';
2
3
 
3
4
  export function validateIconType(icon: CanvasIcon, expectedType: CanvasIconTypes) {
4
5
  if (icon.type !== expectedType) {
5
6
  throw `${icon.name}: Icon type "${icon.type}" does not match expected type "${expectedType}"`;
6
7
  }
7
8
  }
9
+
10
+ export function getColor(value?: CanvasColor | string) {
11
+ if (value! in colors) {
12
+ return colors[value as keyof typeof colors];
13
+ }
14
+ return value;
15
+ }
package/layout/index.ts CHANGED
@@ -13,6 +13,7 @@ export * from './lib/utils/grid';
13
13
  export * from './lib/utils/gridItem';
14
14
  export * from './lib/utils/layout';
15
15
  export * from './lib/utils/other';
16
+ export * from './lib/utils/systemProps';
16
17
  export * from './lib/utils/position';
17
18
  export {SpaceStyleProps, spaceStyleFnConfigs} from './lib/utils/space';
18
19
  export {AllStyleProps, CommonStyleProps} from './lib/utils/styleProps';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-react",
3
- "version": "8.4.4",
3
+ "version": "8.5.0-313-next.0+2ff85113",
4
4
  "description": "The parent module that contains all Workday Canvas Kit React components",
5
5
  "author": "Workday, Inc. (https://www.workday.com)",
6
6
  "license": "Apache-2.0",
@@ -49,7 +49,7 @@
49
49
  "@emotion/styled": "^11.6.0",
50
50
  "@popperjs/core": "^2.5.4",
51
51
  "@workday/canvas-colors-web": "^2.0.0",
52
- "@workday/canvas-kit-popup-stack": "^8.4.4",
52
+ "@workday/canvas-kit-popup-stack": "^8.5.0-313-next.0+2ff85113",
53
53
  "@workday/canvas-system-icons-web": "^3.0.0",
54
54
  "@workday/design-assets-types": "^0.2.8",
55
55
  "chroma-js": "^2.1.0",
@@ -67,5 +67,5 @@
67
67
  "@workday/canvas-accent-icons-web": "^3.0.0",
68
68
  "@workday/canvas-applet-icons-web": "^2.0.0"
69
69
  },
70
- "gitHead": "006cbb935cf6779b654e238fd088dabe95875b1a"
70
+ "gitHead": "2ff85113385db28d809f20c1134fe62bb752a952"
71
71
  }