@workday/canvas-kit-react 11.0.0-alpha.767-next.0 → 11.0.0-alpha.770-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/lib/BaseButton.tsx +260 -204
- package/button/lib/Button.tsx +1 -4
- package/button/lib/DeleteButton.tsx +42 -38
- package/button/lib/PrimaryButton.tsx +74 -71
- package/button/lib/SecondaryButton.tsx +85 -87
- package/button/lib/TertiaryButton.tsx +214 -132
- package/dist/commonjs/button/lib/BaseButton.d.ts +70 -29
- package/dist/commonjs/button/lib/BaseButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/BaseButton.js +98 -55
- package/dist/commonjs/button/lib/Button.d.ts.map +1 -1
- package/dist/commonjs/button/lib/Button.js +1 -2
- package/dist/commonjs/button/lib/DeleteButton.d.ts +1 -1
- package/dist/commonjs/button/lib/DeleteButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/DeleteButton.js +9 -6
- package/dist/commonjs/button/lib/PrimaryButton.d.ts +0 -5
- package/dist/commonjs/button/lib/PrimaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/PrimaryButton.js +14 -10
- package/dist/commonjs/button/lib/SecondaryButton.d.ts +0 -5
- package/dist/commonjs/button/lib/SecondaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/SecondaryButton.js +13 -10
- package/dist/commonjs/button/lib/TertiaryButton.d.ts +0 -22
- package/dist/commonjs/button/lib/TertiaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/TertiaryButton.js +80 -35
- package/dist/es6/button/lib/BaseButton.d.ts +70 -29
- package/dist/es6/button/lib/BaseButton.d.ts.map +1 -1
- package/dist/es6/button/lib/BaseButton.js +99 -54
- package/dist/es6/button/lib/Button.d.ts.map +1 -1
- package/dist/es6/button/lib/Button.js +1 -2
- package/dist/es6/button/lib/DeleteButton.d.ts +1 -1
- package/dist/es6/button/lib/DeleteButton.d.ts.map +1 -1
- package/dist/es6/button/lib/DeleteButton.js +12 -9
- package/dist/es6/button/lib/PrimaryButton.d.ts +0 -5
- package/dist/es6/button/lib/PrimaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/PrimaryButton.js +15 -11
- package/dist/es6/button/lib/SecondaryButton.d.ts +0 -5
- package/dist/es6/button/lib/SecondaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/SecondaryButton.js +15 -12
- package/dist/es6/button/lib/TertiaryButton.d.ts +0 -22
- package/dist/es6/button/lib/TertiaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/TertiaryButton.js +82 -37
- package/package.json +4 -4
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import {buttonVars} from './BaseButton';
|
|
4
3
|
import {createComponent} from '@workday/canvas-kit-react/common';
|
|
5
|
-
import {mergeStyles} from '@workday/canvas-kit-react/layout';
|
|
6
4
|
import {systemIconStencil} from '@workday/canvas-kit-react/icon';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import {createStencil} from '@workday/canvas-kit-styling';
|
|
6
|
+
import {brand, system} from '@workday/canvas-tokens-web';
|
|
7
|
+
import {buttonStencil} from './BaseButton';
|
|
9
8
|
import {Button, ButtonProps} from './Button';
|
|
9
|
+
import {mergeStyles} from '@workday/canvas-kit-react/layout';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Extends all the style properties from Box to our buttons as well as props from ButtonProps.
|
|
@@ -20,71 +20,78 @@ export interface PrimaryButtonProps extends ButtonProps {
|
|
|
20
20
|
variant?: 'inverse';
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
[buttonVars.focus.background]: brand.primary.base,
|
|
31
|
-
[buttonVars.focus.border]: 'transparent',
|
|
32
|
-
[buttonVars.focus.label]: brand.primary.accent,
|
|
33
|
-
[buttonVars.focus.boxShadowInner]: base.frenchVanilla100,
|
|
34
|
-
[buttonVars.focus.boxShadowOuter]: brand.common.focusOutline,
|
|
35
|
-
[systemIconStencil.vars.color]: brand.primary.accent,
|
|
36
|
-
},
|
|
37
|
-
'&:hover, &.hover': {
|
|
38
|
-
[buttonVars.hover.background]: brand.primary.dark,
|
|
39
|
-
[buttonVars.hover.border]: 'transparent',
|
|
40
|
-
[buttonVars.hover.label]: brand.primary.accent,
|
|
23
|
+
const primaryButtonStencil = createStencil({
|
|
24
|
+
extends: buttonStencil,
|
|
25
|
+
base: {
|
|
26
|
+
// Base Styles
|
|
27
|
+
[buttonStencil.vars.background]: brand.primary.base,
|
|
28
|
+
[buttonStencil.vars.borderRadius]: system.shape.round,
|
|
29
|
+
[buttonStencil.vars.label]: brand.primary.accent,
|
|
41
30
|
[systemIconStencil.vars.color]: brand.primary.accent,
|
|
31
|
+
// Focus Styles
|
|
32
|
+
'&:focus-visible, &.focus': {
|
|
33
|
+
[buttonStencil.vars.background]: brand.primary.base,
|
|
34
|
+
[buttonStencil.vars.label]: brand.primary.accent,
|
|
35
|
+
[buttonStencil.vars.boxShadowInner]: system.color.fg.inverse,
|
|
36
|
+
[buttonStencil.vars.boxShadowOuter]: brand.common.focusOutline,
|
|
37
|
+
[systemIconStencil.vars.color]: brand.primary.accent,
|
|
38
|
+
},
|
|
39
|
+
// Hover Styles
|
|
40
|
+
'&:hover, &.hover': {
|
|
41
|
+
[buttonStencil.vars.background]: brand.primary.dark,
|
|
42
|
+
[buttonStencil.vars.label]: brand.primary.accent,
|
|
43
|
+
[systemIconStencil.vars.color]: brand.primary.accent,
|
|
44
|
+
},
|
|
45
|
+
// Active Styles
|
|
46
|
+
'&:active, &.active': {
|
|
47
|
+
[buttonStencil.vars.background]: brand.primary.darkest,
|
|
48
|
+
[buttonStencil.vars.label]: brand.primary.accent,
|
|
49
|
+
[systemIconStencil.vars.color]: brand.primary.accent,
|
|
50
|
+
},
|
|
51
|
+
// Disabled Styles
|
|
52
|
+
'&:disabled, &.disabled': {
|
|
53
|
+
[buttonStencil.vars.background]: brand.primary.base,
|
|
54
|
+
[buttonStencil.vars.label]: brand.primary.accent,
|
|
55
|
+
[buttonStencil.vars.opacity]: system.opacity.disabled,
|
|
56
|
+
[systemIconStencil.vars.color]: brand.primary.accent,
|
|
57
|
+
},
|
|
42
58
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
'&:active, &.active': {
|
|
78
|
-
[buttonVars.active.background]: base.soap400,
|
|
79
|
-
[buttonVars.active.label]: base.blackPepper500,
|
|
80
|
-
[systemIconStencil.vars.color]: base.blackPepper500,
|
|
81
|
-
},
|
|
82
|
-
'&:disabled, &.disabled': {
|
|
83
|
-
[buttonVars.disabled.background]: base.frenchVanilla100,
|
|
84
|
-
[buttonVars.disabled.label]: base.blackPepper400,
|
|
85
|
-
[systemIconStencil.vars.color]: base.blackPepper400,
|
|
59
|
+
modifiers: {
|
|
60
|
+
variant: {
|
|
61
|
+
// Inverse Styles
|
|
62
|
+
inverse: {
|
|
63
|
+
[buttonStencil.vars.background]: system.color.bg.default,
|
|
64
|
+
[buttonStencil.vars.borderRadius]: system.shape.round,
|
|
65
|
+
[buttonStencil.vars.label]: system.color.fg.strong,
|
|
66
|
+
[systemIconStencil.vars.color]: system.color.fg.strong,
|
|
67
|
+
// Focus Styles
|
|
68
|
+
'&:focus-visible, &.focus': {
|
|
69
|
+
[buttonStencil.vars.background]: system.color.bg.default,
|
|
70
|
+
[buttonStencil.vars.label]: system.color.fg.strong,
|
|
71
|
+
[buttonStencil.vars.boxShadowInner]: system.color.fg.strong,
|
|
72
|
+
[buttonStencil.vars.boxShadowOuter]: system.color.fg.inverse,
|
|
73
|
+
[systemIconStencil.vars.color]: system.color.fg.strong,
|
|
74
|
+
},
|
|
75
|
+
// Hover Styles
|
|
76
|
+
'&:hover, &.hover': {
|
|
77
|
+
[buttonStencil.vars.background]: system.color.bg.alt.default,
|
|
78
|
+
[buttonStencil.vars.label]: system.color.fg.stronger,
|
|
79
|
+
[systemIconStencil.vars.color]: system.color.fg.stronger,
|
|
80
|
+
},
|
|
81
|
+
// Active Styles
|
|
82
|
+
'&:active, &.active': {
|
|
83
|
+
[buttonStencil.vars.background]: system.color.bg.alt.strong,
|
|
84
|
+
[buttonStencil.vars.label]: system.color.fg.stronger,
|
|
85
|
+
[systemIconStencil.vars.color]: system.color.fg.stronger,
|
|
86
|
+
},
|
|
87
|
+
// Disabled Styles
|
|
88
|
+
'&:disabled, &.disabled': {
|
|
89
|
+
[buttonStencil.vars.background]: system.color.bg.default,
|
|
90
|
+
[buttonStencil.vars.label]: system.color.fg.strong,
|
|
91
|
+
[systemIconStencil.vars.color]: system.color.fg.strong,
|
|
92
|
+
},
|
|
86
93
|
},
|
|
87
|
-
}
|
|
94
|
+
},
|
|
88
95
|
},
|
|
89
96
|
});
|
|
90
97
|
|
|
@@ -92,11 +99,7 @@ export const PrimaryButton = createComponent('button')({
|
|
|
92
99
|
displayName: 'PrimaryButton',
|
|
93
100
|
Component: ({children, variant, ...elemProps}: PrimaryButtonProps, ref, Element) => {
|
|
94
101
|
return (
|
|
95
|
-
<Button
|
|
96
|
-
as={Element}
|
|
97
|
-
ref={ref}
|
|
98
|
-
{...mergeStyles(elemProps, [primaryStyles, primaryButtonModifiers({variant: variant})])}
|
|
99
|
-
>
|
|
102
|
+
<Button as={Element} ref={ref} {...mergeStyles(elemProps, primaryButtonStencil({variant}))}>
|
|
100
103
|
{children}
|
|
101
104
|
</Button>
|
|
102
105
|
);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {buttonStencil} from './BaseButton';
|
|
4
4
|
import {createComponent} from '@workday/canvas-kit-react/common';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {base, brand, system} from '@workday/canvas-tokens-web';
|
|
5
|
+
import {createStencil} from '@workday/canvas-kit-styling';
|
|
6
|
+
import {brand, system} from '@workday/canvas-tokens-web';
|
|
8
7
|
import {Button, ButtonProps} from './Button';
|
|
9
|
-
import {systemIconStencil} from '
|
|
8
|
+
import {systemIconStencil} from '@workday/canvas-kit-react/icon';
|
|
9
|
+
import {mergeStyles} from '@workday/canvas-kit-react/layout';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Extends all the style properties from Box to our buttons as well as props from ButtonProps.
|
|
@@ -20,85 +20,87 @@ export interface SecondaryButtonProps extends ButtonProps {
|
|
|
20
20
|
variant?: 'inverse';
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
23
|
+
const secondaryButtonStencil = createStencil({
|
|
24
|
+
extends: buttonStencil,
|
|
25
|
+
base: {
|
|
26
|
+
// Base Styles
|
|
27
|
+
[buttonStencil.vars.background]: 'transparent',
|
|
28
|
+
[buttonStencil.vars.border]: system.color.border.contrast.default,
|
|
29
|
+
[buttonStencil.vars.borderRadius]: system.shape.round,
|
|
30
|
+
[buttonStencil.vars.label]: system.color.fg.strong,
|
|
31
|
+
[systemIconStencil.vars.color]: system.color.fg.strong,
|
|
32
|
+
// Focus Styles
|
|
33
|
+
'&:focus-visible, &.focus': {
|
|
34
|
+
[buttonStencil.vars.background]: 'transparent',
|
|
35
|
+
[buttonStencil.vars.border]: system.color.border.contrast.default,
|
|
36
|
+
[buttonStencil.vars.label]: system.color.fg.strong,
|
|
37
|
+
[buttonStencil.vars.boxShadowInner]: system.color.fg.inverse,
|
|
38
|
+
[buttonStencil.vars.boxShadowOuter]: brand.common.focusOutline,
|
|
39
|
+
[systemIconStencil.vars.color]: system.color.fg.strong,
|
|
40
|
+
},
|
|
41
|
+
// Hover Styles
|
|
42
|
+
'&:hover, &.hover': {
|
|
43
|
+
[buttonStencil.vars.background]: system.color.bg.contrast.default,
|
|
44
|
+
[buttonStencil.vars.border]: system.color.border.contrast.default,
|
|
45
|
+
[buttonStencil.vars.label]: brand.primary.accent,
|
|
46
|
+
[systemIconStencil.vars.color]: brand.primary.accent,
|
|
47
|
+
},
|
|
48
|
+
// Active Styles
|
|
49
|
+
'&:active, &.active': {
|
|
50
|
+
[buttonStencil.vars.background]: system.color.bg.contrast.strong,
|
|
51
|
+
[buttonStencil.vars.border]: system.color.border.contrast.strong,
|
|
52
|
+
[buttonStencil.vars.label]: brand.primary.accent,
|
|
53
|
+
[systemIconStencil.vars.color]: brand.primary.accent,
|
|
54
|
+
},
|
|
55
|
+
// Disabled Styles
|
|
56
|
+
'&:disabled, &.disabled': {
|
|
57
|
+
[buttonStencil.vars.background]: 'transparent',
|
|
58
|
+
[buttonStencil.vars.border]: system.color.border.contrast.default,
|
|
59
|
+
[buttonStencil.vars.label]: system.color.fg.strong,
|
|
60
|
+
[buttonStencil.vars.opacity]: system.opacity.disabled,
|
|
61
|
+
[systemIconStencil.vars.color]: system.color.fg.strong,
|
|
62
|
+
},
|
|
60
63
|
},
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
[systemIconStencil.vars.color]: base.frenchVanilla100,
|
|
64
|
+
modifiers: {
|
|
65
|
+
variant: {
|
|
66
|
+
inverse: {
|
|
67
|
+
// Default Styles
|
|
68
|
+
[buttonStencil.vars.background]: 'transparent',
|
|
69
|
+
[buttonStencil.vars.border]: system.color.border.inverse,
|
|
70
|
+
[buttonStencil.vars.label]: system.color.fg.inverse,
|
|
71
|
+
[systemIconStencil.vars.color]: system.color.fg.inverse,
|
|
72
|
+
// Focus Styles
|
|
73
|
+
'&:focus-visible, &.focus': {
|
|
74
|
+
[buttonStencil.vars.background]: system.color.bg.default,
|
|
75
|
+
[buttonStencil.vars.border]: 'transparent',
|
|
76
|
+
[buttonStencil.vars.label]: system.color.fg.strong,
|
|
77
|
+
[buttonStencil.vars.boxShadowInner]: system.color.fg.strong,
|
|
78
|
+
[buttonStencil.vars.boxShadowOuter]: system.color.fg.inverse,
|
|
79
|
+
[systemIconStencil.vars.color]: system.color.fg.strong,
|
|
80
|
+
},
|
|
81
|
+
// Hover Styles
|
|
82
|
+
'&:hover, &.hover': {
|
|
83
|
+
[buttonStencil.vars.background]: system.color.bg.alt.default,
|
|
84
|
+
[buttonStencil.vars.border]: 'transparent',
|
|
85
|
+
[buttonStencil.vars.label]: system.color.fg.stronger,
|
|
86
|
+
[systemIconStencil.vars.color]: system.color.fg.stronger,
|
|
87
|
+
},
|
|
88
|
+
// Active Styles
|
|
89
|
+
'&:active, &.active': {
|
|
90
|
+
[buttonStencil.vars.background]: system.color.bg.alt.strong,
|
|
91
|
+
[buttonStencil.vars.border]: 'transparent',
|
|
92
|
+
[buttonStencil.vars.label]: system.color.fg.stronger,
|
|
93
|
+
[systemIconStencil.vars.color]: system.color.fg.stronger,
|
|
94
|
+
},
|
|
95
|
+
// Disabled Styles
|
|
96
|
+
'&:disabled, &.disabled': {
|
|
97
|
+
[buttonStencil.vars.background]: 'transparent',
|
|
98
|
+
[buttonStencil.vars.border]: system.color.border.inverse,
|
|
99
|
+
[buttonStencil.vars.label]: system.color.fg.inverse,
|
|
100
|
+
[systemIconStencil.vars.color]: system.color.fg.inverse,
|
|
101
|
+
},
|
|
100
102
|
},
|
|
101
|
-
}
|
|
103
|
+
},
|
|
102
104
|
},
|
|
103
105
|
});
|
|
104
106
|
|
|
@@ -106,11 +108,7 @@ export const SecondaryButton = createComponent('button')({
|
|
|
106
108
|
displayName: 'SecondaryButton',
|
|
107
109
|
Component: ({children, variant, ...elemProps}: SecondaryButtonProps, ref, Element) => {
|
|
108
110
|
return (
|
|
109
|
-
<Button
|
|
110
|
-
as={Element}
|
|
111
|
-
ref={ref}
|
|
112
|
-
{...mergeStyles(elemProps, [secondaryStyles, secondaryButtonModifiers({variant: variant})])}
|
|
113
|
-
>
|
|
111
|
+
<Button as={Element} ref={ref} {...mergeStyles(elemProps, secondaryButtonStencil({variant}))}>
|
|
114
112
|
{children}
|
|
115
113
|
</Button>
|
|
116
114
|
);
|