@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.
- package/button/index.ts +7 -1
- package/button/lib/BaseButton.tsx +7 -4
- package/button/lib/DeleteButton.tsx +2 -2
- package/button/lib/PrimaryButton.tsx +2 -2
- package/button/lib/SecondaryButton.tsx +2 -2
- package/button/lib/TertiaryButton.tsx +3 -3
- package/common/lib/utils/components.ts +5 -0
- package/dist/commonjs/button/index.d.ts +1 -1
- package/dist/commonjs/button/index.d.ts.map +1 -1
- package/dist/commonjs/button/index.js +3 -1
- package/dist/commonjs/button/lib/BaseButton.d.ts +7 -4
- package/dist/commonjs/button/lib/BaseButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/DeleteButton.d.ts +2 -1
- package/dist/commonjs/button/lib/DeleteButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/PrimaryButton.d.ts +2 -1
- package/dist/commonjs/button/lib/PrimaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/SecondaryButton.d.ts +2 -1
- package/dist/commonjs/button/lib/SecondaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/TertiaryButton.d.ts +2 -1
- package/dist/commonjs/button/lib/TertiaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/TertiaryButton.js +1 -1
- package/dist/commonjs/common/lib/utils/components.d.ts +2 -1
- package/dist/commonjs/common/lib/utils/components.d.ts.map +1 -1
- package/dist/commonjs/layout/index.d.ts +3 -3
- package/dist/commonjs/layout/index.d.ts.map +1 -1
- package/dist/commonjs/layout/index.js +3 -3
- package/dist/commonjs/layout/lib/Column.d.ts +13 -4
- package/dist/commonjs/layout/lib/Column.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/Column.js +10 -7
- package/dist/commonjs/layout/lib/Layout.d.ts +26 -9
- package/dist/commonjs/layout/lib/Layout.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/Layout.js +21 -10
- package/dist/commonjs/segmented-control/lib/SegmentedControlButton.d.ts +3 -1
- package/dist/commonjs/segmented-control/lib/SegmentedControlButton.d.ts.map +1 -1
- package/dist/commonjs/segmented-control/lib/SegmentedControlButton.js +11 -2
- package/dist/es6/button/index.d.ts +1 -1
- package/dist/es6/button/index.d.ts.map +1 -1
- package/dist/es6/button/index.js +1 -1
- package/dist/es6/button/lib/BaseButton.d.ts +7 -4
- package/dist/es6/button/lib/BaseButton.d.ts.map +1 -1
- package/dist/es6/button/lib/DeleteButton.d.ts +2 -1
- package/dist/es6/button/lib/DeleteButton.d.ts.map +1 -1
- package/dist/es6/button/lib/PrimaryButton.d.ts +2 -1
- package/dist/es6/button/lib/PrimaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/SecondaryButton.d.ts +2 -1
- package/dist/es6/button/lib/SecondaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/TertiaryButton.d.ts +2 -1
- package/dist/es6/button/lib/TertiaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/TertiaryButton.js +1 -1
- package/dist/es6/common/lib/utils/components.d.ts +2 -1
- package/dist/es6/common/lib/utils/components.d.ts.map +1 -1
- package/dist/es6/layout/index.d.ts +3 -3
- package/dist/es6/layout/index.d.ts.map +1 -1
- package/dist/es6/layout/index.js +3 -3
- package/dist/es6/layout/lib/Column.d.ts +13 -4
- package/dist/es6/layout/lib/Column.d.ts.map +1 -1
- package/dist/es6/layout/lib/Column.js +9 -6
- package/dist/es6/layout/lib/Layout.d.ts +26 -9
- package/dist/es6/layout/lib/Layout.d.ts.map +1 -1
- package/dist/es6/layout/lib/Layout.js +21 -10
- package/dist/es6/segmented-control/lib/SegmentedControlButton.d.ts +3 -1
- package/dist/es6/segmented-control/lib/SegmentedControlButton.d.ts.map +1 -1
- package/dist/es6/segmented-control/lib/SegmentedControlButton.js +12 -3
- package/layout/README.md +28 -27
- package/layout/index.ts +3 -3
- package/layout/lib/Column.tsx +22 -5
- package/layout/lib/Layout.tsx +37 -12
- package/package.json +3 -3
- package/segmented-control/lib/SegmentedControlButton.tsx +24 -5
package/layout/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import {DeprecatedLayout} from './lib/Layout';
|
|
2
|
+
import {DeprecatedColumn} from './lib/Column';
|
|
3
3
|
|
|
4
|
-
export {
|
|
4
|
+
export { DeprecatedLayout, DeprecatedColumn};
|
|
5
5
|
export * from './lib/Box';
|
|
6
6
|
export * from './lib/utils/border';
|
|
7
7
|
export * from './lib/utils/color';
|
package/layout/lib/Column.tsx
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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
|
|
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
|
-
})<
|
|
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
|
|
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
|
|
package/layout/lib/Layout.tsx
CHANGED
|
@@ -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 {
|
|
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
|
-
|
|
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
|
|
18
|
+
* The children of the DeprecatedLayout (cannot be empty).
|
|
11
19
|
*/
|
|
12
|
-
children: React.ReactElement<
|
|
20
|
+
children: React.ReactElement<DeprecatedColumnProps>[] | React.ReactNode;
|
|
13
21
|
/**
|
|
14
|
-
* The spacing of the
|
|
22
|
+
* The spacing of the DeprecatedLayout children.
|
|
15
23
|
*/
|
|
16
24
|
spacing?: number;
|
|
17
25
|
/**
|
|
18
|
-
* The padding of the
|
|
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
|
|
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
|
-
})<
|
|
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
|
-
|
|
62
|
-
|
|
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 ===
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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": "
|
|
71
|
+
"gitHead": "ff5616e10b2d5d7cceccaea1c6f9d9b742ef1779"
|
|
72
72
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
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
|
|
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
|
-
|
|
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=
|
|
123
|
+
<BaseButton.Icon size={props.size || 'large'} icon={icon} />
|
|
105
124
|
</StyledButton>
|
|
106
125
|
);
|
|
107
126
|
},
|