@workday/canvas-kit-react 8.6.0-360-next.0 → 8.6.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.
Files changed (77) hide show
  1. package/common/lib/utils/colorUtils.ts +20 -7
  2. package/common/lib/utils/components.ts +4 -0
  3. package/dist/commonjs/action-bar/lib/ActionBar.d.ts +5 -1
  4. package/dist/commonjs/action-bar/lib/ActionBar.d.ts.map +1 -1
  5. package/dist/commonjs/common/lib/utils/colorUtils.d.ts +7 -0
  6. package/dist/commonjs/common/lib/utils/colorUtils.d.ts.map +1 -1
  7. package/dist/commonjs/common/lib/utils/colorUtils.js +20 -7
  8. package/dist/commonjs/common/lib/utils/components.d.ts +3 -1
  9. package/dist/commonjs/common/lib/utils/components.d.ts.map +1 -1
  10. package/dist/commonjs/icon/lib/AccentIcon.d.ts +3 -2
  11. package/dist/commonjs/icon/lib/AccentIcon.d.ts.map +1 -1
  12. package/dist/commonjs/icon/lib/AccentIcon.js +1 -1
  13. package/dist/commonjs/icon/lib/SystemIcon.d.ts.map +1 -1
  14. package/dist/commonjs/icon/lib/SystemIcon.js +6 -7
  15. package/dist/commonjs/icon/lib/SystemIconCircle.d.ts +2 -1
  16. package/dist/commonjs/icon/lib/SystemIconCircle.d.ts.map +1 -1
  17. package/dist/commonjs/icon/lib/SystemIconCircle.js +1 -1
  18. package/dist/commonjs/icon/lib/utils.d.ts +0 -2
  19. package/dist/commonjs/icon/lib/utils.d.ts.map +1 -1
  20. package/dist/commonjs/icon/lib/utils.js +1 -9
  21. package/dist/commonjs/layout/lib/utils/position.d.ts +4 -0
  22. package/dist/commonjs/layout/lib/utils/position.d.ts.map +1 -1
  23. package/dist/commonjs/layout/lib/utils/position.js +5 -0
  24. package/dist/commonjs/menu/lib/Menu.d.ts +5 -1
  25. package/dist/commonjs/menu/lib/Menu.d.ts.map +1 -1
  26. package/dist/commonjs/menu/lib/MenuItem.d.ts +5 -1
  27. package/dist/commonjs/menu/lib/MenuItem.d.ts.map +1 -1
  28. package/dist/commonjs/menu/lib/MenuItem.js +2 -4
  29. package/dist/commonjs/popup/lib/PopupCard.d.ts.map +1 -1
  30. package/dist/commonjs/popup/lib/PopupCard.js +28 -1
  31. package/dist/commonjs/tabs/lib/Tabs.d.ts +5 -1
  32. package/dist/commonjs/tabs/lib/Tabs.d.ts.map +1 -1
  33. package/dist/commonjs/tabs/lib/TabsItem.d.ts +1 -1
  34. package/dist/commonjs/tokens/index.d.ts +2 -2
  35. package/dist/commonjs/tokens/index.d.ts.map +1 -1
  36. package/dist/es6/action-bar/lib/ActionBar.d.ts +5 -1
  37. package/dist/es6/action-bar/lib/ActionBar.d.ts.map +1 -1
  38. package/dist/es6/common/lib/utils/colorUtils.d.ts +7 -0
  39. package/dist/es6/common/lib/utils/colorUtils.d.ts.map +1 -1
  40. package/dist/es6/common/lib/utils/colorUtils.js +18 -6
  41. package/dist/es6/common/lib/utils/components.d.ts +3 -1
  42. package/dist/es6/common/lib/utils/components.d.ts.map +1 -1
  43. package/dist/es6/icon/lib/AccentIcon.d.ts +3 -2
  44. package/dist/es6/icon/lib/AccentIcon.d.ts.map +1 -1
  45. package/dist/es6/icon/lib/AccentIcon.js +2 -2
  46. package/dist/es6/icon/lib/SystemIcon.d.ts.map +1 -1
  47. package/dist/es6/icon/lib/SystemIcon.js +1 -2
  48. package/dist/es6/icon/lib/SystemIconCircle.d.ts +2 -1
  49. package/dist/es6/icon/lib/SystemIconCircle.d.ts.map +1 -1
  50. package/dist/es6/icon/lib/SystemIconCircle.js +2 -2
  51. package/dist/es6/icon/lib/utils.d.ts +0 -2
  52. package/dist/es6/icon/lib/utils.d.ts.map +1 -1
  53. package/dist/es6/icon/lib/utils.js +0 -7
  54. package/dist/es6/layout/lib/utils/position.d.ts +4 -0
  55. package/dist/es6/layout/lib/utils/position.d.ts.map +1 -1
  56. package/dist/es6/layout/lib/utils/position.js +5 -0
  57. package/dist/es6/menu/lib/Menu.d.ts +5 -1
  58. package/dist/es6/menu/lib/Menu.d.ts.map +1 -1
  59. package/dist/es6/menu/lib/MenuItem.d.ts +5 -1
  60. package/dist/es6/menu/lib/MenuItem.d.ts.map +1 -1
  61. package/dist/es6/menu/lib/MenuItem.js +2 -4
  62. package/dist/es6/popup/lib/PopupCard.d.ts.map +1 -1
  63. package/dist/es6/popup/lib/PopupCard.js +28 -1
  64. package/dist/es6/tabs/lib/Tabs.d.ts +5 -1
  65. package/dist/es6/tabs/lib/Tabs.d.ts.map +1 -1
  66. package/dist/es6/tabs/lib/TabsItem.d.ts +1 -1
  67. package/dist/es6/tokens/index.d.ts +2 -2
  68. package/dist/es6/tokens/index.d.ts.map +1 -1
  69. package/icon/lib/AccentIcon.tsx +5 -6
  70. package/icon/lib/SystemIcon.tsx +1 -2
  71. package/icon/lib/SystemIconCircle.tsx +4 -3
  72. package/icon/lib/utils.ts +0 -8
  73. package/layout/lib/utils/position.ts +9 -0
  74. package/menu/lib/MenuItem.tsx +4 -5
  75. package/package.json +3 -3
  76. package/popup/lib/PopupCard.tsx +31 -5
  77. package/tokens/index.ts +3 -3
@@ -3,14 +3,15 @@ import {colors} from '@workday/canvas-kit-react/tokens';
3
3
  import {CanvasAccentIcon, CanvasIconTypes} from '@workday/design-assets-types';
4
4
  import {CSSObject} from '@emotion/styled';
5
5
  import {Icon, IconProps} from './Icon';
6
- import {createComponent} from '@workday/canvas-kit-react/common';
6
+ import {createComponent, getColor} from '@workday/canvas-kit-react/common';
7
+ import {SystemPropValues} from '@workday/canvas-kit-react/layout';
7
8
 
8
9
  export interface AccentIconStyles {
9
10
  /**
10
11
  * The fill color of the AccentIcon.
11
12
  * @default colors.blueberry500
12
13
  */
13
- color?: string;
14
+ color?: SystemPropValues['color'];
14
15
  /**
15
16
  * If true, set the background fill of the AccentIcon to `transparent`. If false, set the background fill of the AccentIcon to `colors.frenchVanilla100`.
16
17
  * @default false
@@ -18,9 +19,7 @@ export interface AccentIconStyles {
18
19
  transparent?: boolean;
19
20
  }
20
21
 
21
- export interface AccentIconProps
22
- extends AccentIconStyles,
23
- Omit<IconProps, 'src' | 'type' | 'color'> {
22
+ export interface AccentIconProps extends AccentIconStyles, Omit<IconProps, 'src' | 'type'> {
24
23
  /**
25
24
  * The icon to display from `@workday/canvas-accent-icons-web`.
26
25
  */
@@ -37,7 +36,7 @@ export const accentIconStyles = ({
37
36
  transparent = false,
38
37
  }: AccentIconStyles): CSSObject => ({
39
38
  '& .color-500': {
40
- fill: color,
39
+ fill: getColor(color),
41
40
  },
42
41
  '& .french-vanilla-100': {
43
42
  fill: transparent ? 'transparent' : colors.frenchVanilla100,
@@ -3,8 +3,7 @@ import {iconColors} from '@workday/canvas-kit-react/tokens';
3
3
  import {CanvasSystemIcon, CanvasIconTypes} from '@workday/design-assets-types';
4
4
  import {CSSObject} from '@emotion/styled';
5
5
  import {Icon, IconProps} from './Icon';
6
- import {createComponent} from '@workday/canvas-kit-react/common';
7
- import {getColor} from './utils';
6
+ import {createComponent, getColor} from '@workday/canvas-kit-react/common';
8
7
  import {SystemPropValues} from '@workday/canvas-kit-react/layout';
9
8
 
10
9
  export interface SystemIconStyles {
@@ -4,7 +4,8 @@ import isPropValid from '@emotion/is-prop-valid';
4
4
  import {colors, borderRadius} from '@workday/canvas-kit-react/tokens';
5
5
  import {SystemIcon, SystemIconProps} from './SystemIcon';
6
6
  import {CanvasSystemIcon} from '@workday/design-assets-types';
7
- import {createComponent, pickForegroundColor} from '@workday/canvas-kit-react/common';
7
+ import {createComponent, getColor, pickForegroundColor} from '@workday/canvas-kit-react/common';
8
+ import {SystemPropValues} from '@workday/canvas-kit-react/layout';
8
9
 
9
10
  export enum SystemIconCircleSize {
10
11
  xs = 16,
@@ -20,7 +21,7 @@ export interface SystemIconCircleProps extends Pick<SystemIconProps, 'shouldMirr
20
21
  * The background color of the SystemIconCircle from `@workday/canvas-colors-web`.
21
22
  * @default colors.soap300
22
23
  */
23
- background?: string;
24
+ background?: SystemPropValues['color'];
24
25
  /**
25
26
  * The icon to display from `@workday/canvas-accent-icons-web`.
26
27
  */
@@ -50,7 +51,7 @@ const Container = styled('div', {
50
51
  },
51
52
  },
52
53
  ({background}) => ({
53
- background: background,
54
+ background: getColor(background),
54
55
  }),
55
56
  ({size}) => ({
56
57
  width: size,
package/icon/lib/utils.ts CHANGED
@@ -1,15 +1,7 @@
1
1
  import {CanvasIcon, CanvasIconTypes} from '@workday/design-assets-types';
2
- import {CanvasColor, colors} from '@workday/canvas-kit-react/tokens';
3
2
 
4
3
  export function validateIconType(icon: CanvasIcon, expectedType: CanvasIconTypes) {
5
4
  if (icon.type !== expectedType) {
6
5
  throw `${icon.name}: Icon type "${icon.type}" does not match expected type "${expectedType}"`;
7
6
  }
8
7
  }
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
- }
@@ -30,6 +30,10 @@ export type PositionStyleProps = {
30
30
  * - no bidirectional support
31
31
  * */
32
32
  left?: number | string;
33
+ /**
34
+ * - sets [CSS inset property](https://developer.mozilla.org/en-US/docs/Web/CSS/inset)
35
+ */
36
+ inset?: number | string;
33
37
  /**
34
38
  * - sets [CSS inset-inline-start property](https://developer.mozilla.org/en-US/docs/Web/CSS/inset-inline-start)
35
39
  * - bidirectional support
@@ -73,6 +77,11 @@ export const positionStyleFnConfigs: StyleFnConfig[] = [
73
77
  properties: ['left'],
74
78
  system: 'none',
75
79
  },
80
+ {
81
+ name: 'inset',
82
+ properties: ['inset'],
83
+ system: 'none',
84
+ },
76
85
  {
77
86
  name: 'insetInlineStart',
78
87
  properties: ['insetInlineStart'],
@@ -44,11 +44,10 @@ const StyledItem = styled(Box.as('button'))<StyledType>(
44
44
  ({theme}) => {
45
45
  return {
46
46
  ...type.levels.subtext.large,
47
- '& > *:not(style) ~ *:not(style)': {
48
- marginLeft: space.xxs,
49
- },
50
- display: 'block',
47
+ display: 'grid',
48
+ alignItems: 'center',
51
49
  width: '100%',
50
+ gap: space.s,
52
51
  padding: `${space.xxs} ${space.s}`,
53
52
  boxSizing: 'border-box',
54
53
  cursor: 'pointer',
@@ -174,7 +173,7 @@ export const MenuItem = createSubcomponent('button')({
174
173
  modelHook: useMenuModel,
175
174
  elemPropsHook: useMenuItem,
176
175
  subComponents: {
177
- Icon: SystemIcon,
176
+ Icon: styled(SystemIcon)({alignSelf: 'start'}),
178
177
  Text: styled('span')({flexGrow: 1, alignSelf: 'center'}),
179
178
  },
180
179
  })<MenuItemProps>(({children, ...elemProps}, Element) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-react",
3
- "version": "8.6.0-360-next.0+976bd42a",
3
+ "version": "8.6.0",
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.6.0-360-next.0+976bd42a",
52
+ "@workday/canvas-kit-popup-stack": "^8.6.0",
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": "976bd42a81605b07988c33eb61cb6574345e6181"
70
+ "gitHead": "63db571e6d052f6c8d4a3ae6b39d16c3d7d6720f"
71
71
  }
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import {keyframes} from '@emotion/react';
3
3
 
4
4
  import {Card} from '@workday/canvas-kit-react/card';
5
- import {space, type, CanvasSpaceKeys} from '@workday/canvas-kit-react/tokens';
5
+ import {space, type} from '@workday/canvas-kit-react/tokens';
6
6
  import {
7
7
  styled,
8
8
  TransformOrigin,
@@ -62,6 +62,35 @@ const StyledPopupCard = styled(Card)<
62
62
  };
63
63
  });
64
64
 
65
+ function getSpace(value?: string | number) {
66
+ if (value && value in space) {
67
+ return space[value as keyof typeof space];
68
+ } else {
69
+ return value;
70
+ }
71
+ }
72
+
73
+ function getMaxHeight(margin?: string | number) {
74
+ // set the default margin offset to space.xl
75
+ let marginOffset: string | number = space.xl;
76
+
77
+ if (margin) {
78
+ // parse the margin prop
79
+ if (typeof margin === 'string') {
80
+ const marginValues = margin.split(' ');
81
+ const marginTop = getSpace(marginValues[0]);
82
+ // If provided, use the specific margin-bottom in the shorthand, otherwise use the margin-top value
83
+ const marginBottom = getSpace(marginValues[2]) || marginTop;
84
+
85
+ marginOffset = `(${marginTop} + ${marginBottom})`;
86
+ } else {
87
+ // if margin is a number, double it to get the offset
88
+ marginOffset = `${margin * 2}px`;
89
+ }
90
+ }
91
+ return `calc(100vh - ${marginOffset})`;
92
+ }
93
+
65
94
  export const PopupCard = createSubcomponent('div')({
66
95
  displayName: 'Popup.Card',
67
96
  modelHook: usePopupModel,
@@ -73,7 +102,6 @@ export const PopupCard = createSubcomponent('div')({
73
102
 
74
103
  // As is a Flex that will render an element of `Element`
75
104
  const As = useConstant(() => Flex.as(Element));
76
-
77
105
  return (
78
106
  <StyledPopupCard
79
107
  as={As}
@@ -84,9 +112,7 @@ export const PopupCard = createSubcomponent('div')({
84
112
  flexDirection="column"
85
113
  minHeight={0}
86
114
  padding="m"
87
- maxHeight={`calc(100vh - ${
88
- elemProps.margin ? space[elemProps.margin as CanvasSpaceKeys] || elemProps.margin : space.xl
89
- } * 2)`}
115
+ maxHeight={getMaxHeight(elemProps.margin)}
90
116
  overflowY="auto"
91
117
  {...type.levels.subtext.large}
92
118
  {...elemProps}
package/tokens/index.ts CHANGED
@@ -63,9 +63,6 @@ export {
63
63
  fontFamily,
64
64
  monoFontFamily,
65
65
  BrandingColor,
66
- CanvasDepth,
67
- CanvasDepthValues,
68
- CSSProperties,
69
66
  };
70
67
 
71
68
  export type {
@@ -73,6 +70,8 @@ export type {
73
70
  CanvasBorderRadiusKeys,
74
71
  CanvasBorderRadiusValues,
75
72
  CanvasColor,
73
+ CanvasDepth,
74
+ CanvasDepthValues,
76
75
  CanvasSpace,
77
76
  CanvasSpaceKeys,
78
77
  CanvasSpaceValues,
@@ -82,4 +81,5 @@ export type {
82
81
  CanvasTypeProperties,
83
82
  CanvasTypeVariants,
84
83
  CanvasTypeHierarchy,
84
+ CSSProperties,
85
85
  }