@workday/canvas-kit-react 8.0.0-alpha.192-next.1 → 8.0.0-alpha.198-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.
Files changed (69) hide show
  1. package/button/index.ts +7 -1
  2. package/button/lib/BaseButton.tsx +7 -4
  3. package/button/lib/DeleteButton.tsx +2 -2
  4. package/button/lib/PrimaryButton.tsx +2 -2
  5. package/button/lib/SecondaryButton.tsx +2 -2
  6. package/button/lib/TertiaryButton.tsx +3 -3
  7. package/common/lib/utils/components.ts +5 -0
  8. package/dist/commonjs/button/index.d.ts +1 -1
  9. package/dist/commonjs/button/index.d.ts.map +1 -1
  10. package/dist/commonjs/button/index.js +3 -1
  11. package/dist/commonjs/button/lib/BaseButton.d.ts +7 -4
  12. package/dist/commonjs/button/lib/BaseButton.d.ts.map +1 -1
  13. package/dist/commonjs/button/lib/DeleteButton.d.ts +2 -1
  14. package/dist/commonjs/button/lib/DeleteButton.d.ts.map +1 -1
  15. package/dist/commonjs/button/lib/PrimaryButton.d.ts +2 -1
  16. package/dist/commonjs/button/lib/PrimaryButton.d.ts.map +1 -1
  17. package/dist/commonjs/button/lib/SecondaryButton.d.ts +2 -1
  18. package/dist/commonjs/button/lib/SecondaryButton.d.ts.map +1 -1
  19. package/dist/commonjs/button/lib/TertiaryButton.d.ts +2 -1
  20. package/dist/commonjs/button/lib/TertiaryButton.d.ts.map +1 -1
  21. package/dist/commonjs/button/lib/TertiaryButton.js +1 -1
  22. package/dist/commonjs/common/lib/utils/components.d.ts +2 -1
  23. package/dist/commonjs/common/lib/utils/components.d.ts.map +1 -1
  24. package/dist/commonjs/layout/index.d.ts +3 -3
  25. package/dist/commonjs/layout/index.d.ts.map +1 -1
  26. package/dist/commonjs/layout/index.js +3 -3
  27. package/dist/commonjs/layout/lib/Column.d.ts +13 -4
  28. package/dist/commonjs/layout/lib/Column.d.ts.map +1 -1
  29. package/dist/commonjs/layout/lib/Column.js +10 -7
  30. package/dist/commonjs/layout/lib/Layout.d.ts +26 -9
  31. package/dist/commonjs/layout/lib/Layout.d.ts.map +1 -1
  32. package/dist/commonjs/layout/lib/Layout.js +21 -10
  33. package/dist/commonjs/segmented-control/lib/SegmentedControlButton.d.ts +3 -1
  34. package/dist/commonjs/segmented-control/lib/SegmentedControlButton.d.ts.map +1 -1
  35. package/dist/commonjs/segmented-control/lib/SegmentedControlButton.js +11 -2
  36. package/dist/es6/button/index.d.ts +1 -1
  37. package/dist/es6/button/index.d.ts.map +1 -1
  38. package/dist/es6/button/index.js +1 -1
  39. package/dist/es6/button/lib/BaseButton.d.ts +7 -4
  40. package/dist/es6/button/lib/BaseButton.d.ts.map +1 -1
  41. package/dist/es6/button/lib/DeleteButton.d.ts +2 -1
  42. package/dist/es6/button/lib/DeleteButton.d.ts.map +1 -1
  43. package/dist/es6/button/lib/PrimaryButton.d.ts +2 -1
  44. package/dist/es6/button/lib/PrimaryButton.d.ts.map +1 -1
  45. package/dist/es6/button/lib/SecondaryButton.d.ts +2 -1
  46. package/dist/es6/button/lib/SecondaryButton.d.ts.map +1 -1
  47. package/dist/es6/button/lib/TertiaryButton.d.ts +2 -1
  48. package/dist/es6/button/lib/TertiaryButton.d.ts.map +1 -1
  49. package/dist/es6/button/lib/TertiaryButton.js +1 -1
  50. package/dist/es6/common/lib/utils/components.d.ts +2 -1
  51. package/dist/es6/common/lib/utils/components.d.ts.map +1 -1
  52. package/dist/es6/layout/index.d.ts +3 -3
  53. package/dist/es6/layout/index.d.ts.map +1 -1
  54. package/dist/es6/layout/index.js +3 -3
  55. package/dist/es6/layout/lib/Column.d.ts +13 -4
  56. package/dist/es6/layout/lib/Column.d.ts.map +1 -1
  57. package/dist/es6/layout/lib/Column.js +9 -6
  58. package/dist/es6/layout/lib/Layout.d.ts +26 -9
  59. package/dist/es6/layout/lib/Layout.d.ts.map +1 -1
  60. package/dist/es6/layout/lib/Layout.js +21 -10
  61. package/dist/es6/segmented-control/lib/SegmentedControlButton.d.ts +3 -1
  62. package/dist/es6/segmented-control/lib/SegmentedControlButton.d.ts.map +1 -1
  63. package/dist/es6/segmented-control/lib/SegmentedControlButton.js +12 -3
  64. package/layout/README.md +28 -27
  65. package/layout/index.ts +3 -3
  66. package/layout/lib/Column.tsx +22 -5
  67. package/layout/lib/Layout.tsx +37 -12
  68. package/package.json +3 -3
  69. package/segmented-control/lib/SegmentedControlButton.tsx +24 -5
package/layout/index.ts CHANGED
@@ -1,7 +1,7 @@
1
- import {Layout} from './lib/Layout';
2
- import {Column} from './lib/Column';
1
+ import {DeprecatedLayout} from './lib/Layout';
2
+ import {DeprecatedColumn} from './lib/Column';
3
3
 
4
- export { Layout, Column};
4
+ export { DeprecatedLayout, DeprecatedColumn};
5
5
  export * from './lib/Box';
6
6
  export * from './lib/utils/border';
7
7
  export * from './lib/utils/color';
@@ -2,13 +2,21 @@ import * as React from 'react';
2
2
  import styled from '@emotion/styled';
3
3
  import isPropValid from '@emotion/is-prop-valid';
4
4
 
5
- export interface ColumnProps {
5
+ /**
6
+ * ### Deprecated Layout Column Props
7
+ *
8
+ * As of Canvas Kit v8, Layout is being soft-deprecated.
9
+ * It will be hard-deprecated (completely removed) in v9. Please see the
10
+ * [upgrade guide](https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page)
11
+ * for more information.
12
+ */
13
+ export interface DeprecatedColumnProps {
6
14
  /**
7
- * The children of the Column (cannot be empty).
15
+ * The children of the DeprecatedColumn (cannot be empty).
8
16
  */
9
17
  children?: React.ReactNode;
10
18
  /**
11
- * The left and right padding of the Column (inherits from Layout prop).
19
+ * The left and right padding of the DeprecatedColumn (inherits from Layout prop).
12
20
  * @default 12
13
21
  */
14
22
  spacing?: number;
@@ -24,7 +32,7 @@ export interface ColumnProps {
24
32
 
25
33
  const ColumnContainer = styled('div', {
26
34
  shouldForwardProp: prop => isPropValid(prop) && prop !== 'spacing',
27
- })<ColumnProps>(
35
+ })<DeprecatedColumnProps>(
28
36
  {
29
37
  '&:first-of-type': {
30
38
  paddingLeft: 0,
@@ -58,7 +66,16 @@ const ColumnContainer = styled('div', {
58
66
  }
59
67
  );
60
68
 
61
- export class Column extends React.Component<ColumnProps> {
69
+ export class DeprecatedColumn extends React.Component<DeprecatedColumnProps> {
70
+ componentDidMount() {
71
+ console.warn(
72
+ `This component is being deprecated and will be removed in Canvas Kit V9.\n
73
+ For more information, please see the V8 upgrade guide:\n
74
+ https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page
75
+ `
76
+ );
77
+ }
78
+
62
79
  public render() {
63
80
  const {children, spacing, columns, width, ...elemProps} = this.props;
64
81
 
@@ -1,26 +1,34 @@
1
1
  import * as React from 'react';
2
2
  import styled from '@emotion/styled';
3
3
  import {GenericStyle} from '@workday/canvas-kit-react/common';
4
- import {Column, ColumnProps} from './Column';
4
+ import {DeprecatedColumn, DeprecatedColumnProps} from './Column';
5
5
  import {canvas, spaceNumbers} from '@workday/canvas-kit-react/tokens';
6
6
  import isPropValid from '@emotion/is-prop-valid';
7
7
 
8
- export interface LayoutProps {
8
+ /**
9
+ * ### Deprecated Layout Props
10
+ *
11
+ * As of Canvas Kit v8, Layout is being soft-deprecated.
12
+ * It will be hard-deprecated (completely removed) in v9. Please see the
13
+ * [upgrade guide](https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page)
14
+ * for more information.
15
+ */
16
+ export interface DeprecatedLayoutProps {
9
17
  /**
10
- * The children of the Layout (cannot be empty).
18
+ * The children of the DeprecatedLayout (cannot be empty).
11
19
  */
12
- children: React.ReactElement<ColumnProps>[] | React.ReactNode;
20
+ children: React.ReactElement<DeprecatedColumnProps>[] | React.ReactNode;
13
21
  /**
14
- * The spacing of the Layout children.
22
+ * The spacing of the DeprecatedLayout children.
15
23
  */
16
24
  spacing?: number;
17
25
  /**
18
- * The padding of the Layout's outside container.
26
+ * The padding of the DeprecatedLayout's outside container.
19
27
  * @default 12
20
28
  */
21
29
  gutter?: number | string;
22
30
  /**
23
- * If true, set the max width of the Layout container to `1280px`.
31
+ * If true, set the max width of the DeprecatedLayout container to `1280px`.
24
32
  * @default false
25
33
  */
26
34
  capWidth?: boolean;
@@ -37,7 +45,7 @@ const LayoutStyles: GenericStyle = {
37
45
 
38
46
  const LayoutContainer = styled('div', {
39
47
  shouldForwardProp: prop => isPropValid(prop) && prop !== 'spacing',
40
- })<LayoutProps>(
48
+ })<DeprecatedLayoutProps>(
41
49
  LayoutStyles.styles,
42
50
  ({gutter}) => {
43
51
  if (gutter === 0) {
@@ -58,15 +66,32 @@ const LayoutContainer = styled('div', {
58
66
  }
59
67
  );
60
68
 
61
- export class Layout extends React.Component<LayoutProps> {
62
- public static Column = Column;
69
+ /**
70
+ * ### Deprecated Layout
71
+ *
72
+ * As of Canvas Kit v8, Layout is being soft-deprecated.
73
+ * It will be hard-deprecated (completely removed) in v9. Please see the
74
+ * [upgrade guide](https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page)
75
+ * for more information.
76
+ */
77
+ export class DeprecatedLayout extends React.Component<DeprecatedLayoutProps> {
78
+ componentDidMount() {
79
+ console.warn(
80
+ `This component is being deprecated and will be removed in Canvas Kit V9.\n
81
+ For more information, please see the V8 upgrade guide:\n
82
+ https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page
83
+ `
84
+ );
85
+ }
86
+
87
+ public static Column = DeprecatedColumn;
63
88
 
64
89
  private renderChild = (child: React.ReactNode, spacing: number): React.ReactNode => {
65
90
  if (!React.isValidElement(child)) {
66
91
  return;
67
92
  }
68
93
 
69
- if (child.type === Column) {
94
+ if (child.type === DeprecatedColumn) {
70
95
  const childProps = child.props;
71
96
 
72
97
  if (childProps.spacing || childProps.spacing === 0) {
@@ -96,4 +121,4 @@ export class Layout extends React.Component<LayoutProps> {
96
121
  }
97
122
  }
98
123
 
99
- Layout.Column = Column;
124
+ DeprecatedLayout.Column = DeprecatedColumn;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-react",
3
- "version": "8.0.0-alpha.192-next.1+f60e379b",
3
+ "version": "8.0.0-alpha.198-next.0+ff5616e1",
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.0.0-alpha.192-next.1+f60e379b",
52
+ "@workday/canvas-kit-popup-stack": "^8.0.0-alpha.198-next.0+ff5616e1",
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",
@@ -68,5 +68,5 @@
68
68
  "@workday/canvas-accent-icons-web": "^3.0.0",
69
69
  "@workday/canvas-applet-icons-web": "^2.0.0"
70
70
  },
71
- "gitHead": "f60e379b0083b092707830478248ba5d78b2c96e"
71
+ "gitHead": "ff5616e10b2d5d7cceccaea1c6f9d9b742ef1779"
72
72
  }
@@ -1,5 +1,10 @@
1
1
  import React from 'react';
2
- import {BaseButton, ButtonColors} from '@workday/canvas-kit-react/button';
2
+ import {
3
+ BaseButton,
4
+ ButtonColors,
5
+ ButtonSizes,
6
+ ButtonContainerProps,
7
+ } from '@workday/canvas-kit-react/button';
3
8
  import {
4
9
  createComponent,
5
10
  mouseFocusBehavior,
@@ -35,12 +40,22 @@ const getIconButtonColors = (toggled?: boolean): ButtonColors => {
35
40
  };
36
41
  };
37
42
 
38
- const StyledButton = styled(BaseButton)<StyledType>(
43
+ const getSizeStyles = (size?: ButtonSizes) => {
44
+ const sizeValue =
45
+ size === 'large' ? `calc(${space.xl} + ${space.xxs})` : size === 'small' ? space.l : space.xl;
46
+
47
+ return {
48
+ width: sizeValue,
49
+ height: sizeValue,
50
+ };
51
+ };
52
+
53
+ const StyledButton = styled(BaseButton)<ButtonContainerProps & StyledType>(
39
54
  {
40
55
  borderRadius: borderRadius.zero,
41
56
  border: `1px solid ${colors.soap500}`,
42
57
  borderLeft: 'none',
43
- minWidth: space.xl,
58
+
44
59
  '&:first-of-type': {
45
60
  borderRadius: `${borderRadius.m} 0 0 ${borderRadius.m}`,
46
61
  borderLeft: `1px solid ${colors.soap500}`,
@@ -79,13 +94,17 @@ const StyledButton = styled(BaseButton)<StyledType>(
79
94
  background: theme.canvas.palette.primary.main,
80
95
  },
81
96
  },
97
+ }),
98
+ ({size}: ButtonContainerProps) => ({
99
+ ...getSizeStyles(size),
82
100
  })
83
101
  );
84
102
 
85
- export interface SegmentedControlButtonProps {
103
+ export interface SegmentedControlButtonProps extends ButtonContainerProps {
86
104
  toggled?: boolean;
87
105
  icon: CanvasSystemIcon;
88
106
  value?: string | number;
107
+ size?: 'small' | 'medium' | 'large';
89
108
  }
90
109
 
91
110
  export const SegmentedControlButton = createComponent('button')({
@@ -101,7 +120,7 @@ export const SegmentedControlButton = createComponent('button')({
101
120
  ref={ref}
102
121
  {...props}
103
122
  >
104
- <BaseButton.Icon size="large" icon={icon} />
123
+ <BaseButton.Icon size={props.size || 'large'} icon={icon} />
105
124
  </StyledButton>
106
125
  );
107
126
  },