@workday/canvas-kit-react 11.0.0-alpha.760-next.0 → 11.0.0-alpha.764-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/checkbox/lib/CheckBackground.tsx +17 -15
- package/checkbox/lib/CheckboxCheck.tsx +15 -18
- package/checkbox/lib/CheckboxContainer.tsx +22 -22
- package/checkbox/lib/CheckboxInput.tsx +37 -78
- package/checkbox/lib/CheckboxRipple.tsx +12 -10
- package/dist/commonjs/checkbox/lib/CheckBackground.d.ts +19 -1
- package/dist/commonjs/checkbox/lib/CheckBackground.d.ts.map +1 -1
- package/dist/commonjs/checkbox/lib/CheckBackground.js +10 -7
- package/dist/commonjs/checkbox/lib/CheckboxCheck.d.ts.map +1 -1
- package/dist/commonjs/checkbox/lib/CheckboxCheck.js +8 -6
- package/dist/commonjs/checkbox/lib/CheckboxContainer.d.ts +0 -1
- package/dist/commonjs/checkbox/lib/CheckboxContainer.d.ts.map +1 -1
- package/dist/commonjs/checkbox/lib/CheckboxContainer.js +5 -4
- package/dist/commonjs/checkbox/lib/CheckboxInput.d.ts.map +1 -1
- package/dist/commonjs/checkbox/lib/CheckboxInput.js +7 -12
- package/dist/commonjs/checkbox/lib/CheckboxRipple.d.ts.map +1 -1
- package/dist/commonjs/checkbox/lib/CheckboxRipple.js +4 -2
- package/dist/commonjs/select/lib/Select.d.ts +4 -4
- package/dist/commonjs/select/lib/Select.d.ts.map +1 -1
- package/dist/commonjs/select/lib/Select.js +6 -6
- package/dist/es6/checkbox/lib/CheckBackground.d.ts +19 -1
- package/dist/es6/checkbox/lib/CheckBackground.d.ts.map +1 -1
- package/dist/es6/checkbox/lib/CheckBackground.js +10 -7
- package/dist/es6/checkbox/lib/CheckboxCheck.d.ts.map +1 -1
- package/dist/es6/checkbox/lib/CheckboxCheck.js +10 -8
- package/dist/es6/checkbox/lib/CheckboxContainer.d.ts +0 -1
- package/dist/es6/checkbox/lib/CheckboxContainer.d.ts.map +1 -1
- package/dist/es6/checkbox/lib/CheckboxContainer.js +5 -4
- package/dist/es6/checkbox/lib/CheckboxInput.d.ts.map +1 -1
- package/dist/es6/checkbox/lib/CheckboxInput.js +10 -15
- package/dist/es6/checkbox/lib/CheckboxRipple.d.ts.map +1 -1
- package/dist/es6/checkbox/lib/CheckboxRipple.js +5 -3
- package/dist/es6/select/lib/Select.d.ts +4 -4
- package/dist/es6/select/lib/Select.d.ts.map +1 -1
- package/dist/es6/select/lib/Select.js +6 -6
- package/package.json +4 -4
- package/select/lib/Select.tsx +6 -5
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import {createComponent, ErrorType} from '@workday/canvas-kit-react/common';
|
|
3
|
-
import {calc, createStencil,
|
|
4
|
-
import {
|
|
3
|
+
import {calc, createStencil, px2rem} from '@workday/canvas-kit-styling';
|
|
4
|
+
import {brand, system} from '@workday/canvas-tokens-web';
|
|
5
5
|
|
|
6
6
|
interface CheckBackgroundProps {
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
error?: ErrorType;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export const
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
export const checkboxBackgroundStencil = createStencil({
|
|
12
|
+
vars: {
|
|
13
|
+
errorRingColorInner: '',
|
|
14
|
+
errorRingColorOuter: '',
|
|
15
|
+
},
|
|
14
16
|
base: {
|
|
15
17
|
alignItems: 'center',
|
|
16
|
-
backgroundColor:
|
|
18
|
+
backgroundColor: system.color.bg.default,
|
|
17
19
|
borderRadius: system.shape.half,
|
|
18
20
|
boxSizing: 'border-box',
|
|
19
21
|
display: 'flex',
|
|
@@ -24,18 +26,18 @@ const checkboxBackgroundStencil = createStencil({
|
|
|
24
26
|
position: 'absolute',
|
|
25
27
|
transition: 'border 200ms ease, background 200ms',
|
|
26
28
|
width: calc.add(system.space.x4, px2rem(2)),
|
|
27
|
-
border: `${px2rem(1)} solid ${
|
|
29
|
+
border: `${px2rem(1)} solid ${system.color.border.input.default}`,
|
|
28
30
|
},
|
|
29
31
|
modifiers: {
|
|
30
32
|
error: {
|
|
31
|
-
error: {
|
|
32
|
-
[
|
|
33
|
-
[
|
|
34
|
-
},
|
|
35
|
-
alert: {
|
|
36
|
-
[
|
|
37
|
-
[
|
|
38
|
-
},
|
|
33
|
+
error: ({errorRingColorInner, errorRingColorOuter}) => ({
|
|
34
|
+
[errorRingColorInner]: brand.error.base,
|
|
35
|
+
[errorRingColorOuter]: 'transparent',
|
|
36
|
+
}),
|
|
37
|
+
alert: ({errorRingColorInner, errorRingColorOuter}) => ({
|
|
38
|
+
[errorRingColorInner]: brand.alert.base,
|
|
39
|
+
[errorRingColorOuter]: brand.alert.darkest,
|
|
40
|
+
}),
|
|
39
41
|
},
|
|
40
42
|
},
|
|
41
43
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import {ErrorType, createComponent} from '@workday/canvas-kit-react/common';
|
|
3
|
-
import {createStencil,
|
|
3
|
+
import {createStencil, calc, px2rem} from '@workday/canvas-kit-styling';
|
|
4
4
|
import {brand, system} from '@workday/canvas-tokens-web';
|
|
5
|
-
import {SystemIcon} from '@workday/canvas-kit-react/icon';
|
|
5
|
+
import {SystemIcon, systemIconStencil} from '@workday/canvas-kit-react/icon';
|
|
6
6
|
import {checkSmallIcon} from '@workday/canvas-system-icons-web';
|
|
7
7
|
import {CheckBackground} from './CheckBackground';
|
|
8
8
|
|
|
@@ -24,24 +24,26 @@ const checkboxCheckStencil = createStencil({
|
|
|
24
24
|
marginInlineStart: calc.negate(px2rem(6)),
|
|
25
25
|
transition: 'margin 200ms ease',
|
|
26
26
|
},
|
|
27
|
-
opacity:
|
|
27
|
+
opacity: system.opacity.zero,
|
|
28
28
|
transform: 'scale(0.5)',
|
|
29
29
|
},
|
|
30
30
|
modifiers: {
|
|
31
31
|
checked: {
|
|
32
32
|
true: {
|
|
33
|
-
|
|
33
|
+
[systemIconStencil.vars.color]: brand.primary.accent,
|
|
34
|
+
opacity: system.opacity.full,
|
|
34
35
|
transform: 'scale(1)',
|
|
35
36
|
},
|
|
36
37
|
},
|
|
37
38
|
indeterminate: {
|
|
38
39
|
true: {
|
|
39
|
-
opacity:
|
|
40
|
+
opacity: system.opacity.full,
|
|
40
41
|
transform: 'scale(1)',
|
|
41
42
|
},
|
|
42
43
|
},
|
|
43
44
|
variant: {
|
|
44
45
|
inverse: {
|
|
46
|
+
[systemIconStencil.vars.color]: brand.primary.base,
|
|
45
47
|
'& > div': {
|
|
46
48
|
backgroundColor: brand.primary.base,
|
|
47
49
|
},
|
|
@@ -50,10 +52,12 @@ const checkboxCheckStencil = createStencil({
|
|
|
50
52
|
},
|
|
51
53
|
});
|
|
52
54
|
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
const indeterminateBoxStencil = createStencil({
|
|
56
|
+
base: {
|
|
57
|
+
width: px2rem(10),
|
|
58
|
+
height: calc.divide(system.space.x1, 2),
|
|
59
|
+
backgroundColor: brand.primary.accent,
|
|
60
|
+
},
|
|
57
61
|
});
|
|
58
62
|
|
|
59
63
|
export const CheckboxCheck = createComponent('div')({
|
|
@@ -63,16 +67,9 @@ export const CheckboxCheck = createComponent('div')({
|
|
|
63
67
|
<CheckBackground error={error}>
|
|
64
68
|
<div {...checkboxCheckStencil({checked, indeterminate, variant})}>
|
|
65
69
|
{indeterminate ? (
|
|
66
|
-
<div
|
|
70
|
+
<div {...indeterminateBoxStencil()} />
|
|
67
71
|
) : (
|
|
68
|
-
checked &&
|
|
69
|
-
<SystemIcon
|
|
70
|
-
icon={checkSmallIcon}
|
|
71
|
-
color={
|
|
72
|
-
variant === 'inverse' ? cssVar(brand.primary.base) : cssVar(brand.primary.accent)
|
|
73
|
-
}
|
|
74
|
-
/>
|
|
75
|
-
)
|
|
72
|
+
checked && <SystemIcon icon={checkSmallIcon} />
|
|
76
73
|
)}
|
|
77
74
|
</div>
|
|
78
75
|
</CheckBackground>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import {createComponent} from '@workday/canvas-kit-react/common';
|
|
3
|
-
import {CSProps, calc,
|
|
3
|
+
import {CSProps, calc, createStencil, px2rem} from '@workday/canvas-kit-styling';
|
|
4
4
|
import {system} from '@workday/canvas-tokens-web';
|
|
5
5
|
import {LabelText} from '@workday/canvas-kit-react/text';
|
|
6
6
|
|
|
@@ -12,27 +12,27 @@ interface CheckboxContainerProps extends CSProps {
|
|
|
12
12
|
variant?: 'inverse';
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const checkboxContainerStyles = createStyles({
|
|
18
|
-
display: 'flex',
|
|
19
|
-
alignItems: 'center',
|
|
20
|
-
minHeight: system.space.x6,
|
|
21
|
-
position: 'relative',
|
|
22
|
-
/**
|
|
23
|
-
* Using a wrapper prevents the browser default behavior of trigging
|
|
24
|
-
* :hover on the checkbox when you hover on it's corresponding label.
|
|
25
|
-
* This stops the ripple from showing when you hover on the label.
|
|
26
|
-
*/
|
|
27
|
-
'&>div': {
|
|
15
|
+
const checkboxContainerStencil = createStencil({
|
|
16
|
+
base: {
|
|
28
17
|
display: 'flex',
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
minHeight: system.space.x6,
|
|
20
|
+
position: 'relative',
|
|
21
|
+
/**
|
|
22
|
+
* Using a wrapper prevents the browser default behavior of trigging
|
|
23
|
+
* :hover on the checkbox when you hover on it's corresponding label.
|
|
24
|
+
* This stops the ripple from showing when you hover on the label.
|
|
25
|
+
*/
|
|
26
|
+
'&>div': {
|
|
27
|
+
display: 'flex',
|
|
28
|
+
height: calc.add(system.space.x4, px2rem(2)),
|
|
29
|
+
minWidth: calc.add(system.space.x4, px2rem(2)),
|
|
30
|
+
marginTop: px2rem(3),
|
|
31
|
+
alignSelf: 'flex-start',
|
|
32
|
+
},
|
|
33
|
+
'& > label': {
|
|
34
|
+
paddingInlineStart: system.space.x3,
|
|
35
|
+
},
|
|
36
36
|
},
|
|
37
37
|
});
|
|
38
38
|
|
|
@@ -40,7 +40,7 @@ export const CheckboxContainer = createComponent('div')({
|
|
|
40
40
|
displayName: 'CheckboxContainer',
|
|
41
41
|
Component: ({children, disabled, id, label, variant}: CheckboxContainerProps) => {
|
|
42
42
|
return (
|
|
43
|
-
<div
|
|
43
|
+
<div {...checkboxContainerStencil()}>
|
|
44
44
|
<div>{children}</div>
|
|
45
45
|
{label && (
|
|
46
46
|
<LabelText
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import {createComponent, focusRing, ErrorType} from '@workday/canvas-kit-react/common';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
cssVar,
|
|
8
|
-
handleCsProp,
|
|
9
|
-
px2rem,
|
|
10
|
-
CSProps,
|
|
11
|
-
} from '@workday/canvas-kit-styling';
|
|
12
|
-
import {base, brand, system} from '@workday/canvas-tokens-web';
|
|
13
|
-
import {backgroundVars} from './CheckBackground';
|
|
4
|
+
import {calc, createStencil, handleCsProp, px2rem, CSProps} from '@workday/canvas-kit-styling';
|
|
5
|
+
import {brand, system} from '@workday/canvas-tokens-web';
|
|
6
|
+
import {checkboxBackgroundStencil} from './CheckBackground';
|
|
14
7
|
|
|
15
8
|
export interface CheckboxProps extends CSProps {
|
|
16
9
|
/**
|
|
@@ -65,29 +58,29 @@ const checkboxInputStencil = createStencil({
|
|
|
65
58
|
marginTop: calc.negate(px2rem(3)),
|
|
66
59
|
marginInlineStart: calc.negate(px2rem(3)),
|
|
67
60
|
position: 'absolute',
|
|
68
|
-
opacity:
|
|
61
|
+
opacity: system.opacity.zero,
|
|
69
62
|
|
|
70
63
|
'&:not(:disabled)': {
|
|
71
64
|
cursor: 'pointer',
|
|
72
65
|
},
|
|
73
66
|
|
|
74
|
-
'&:where(:hover
|
|
75
|
-
boxShadow: `0 0 0 ${px2rem(7)} ${
|
|
67
|
+
'&:where(:hover,.hover) ~ span:first-of-type': {
|
|
68
|
+
boxShadow: `0 0 0 ${px2rem(7)} ${system.color.bg.alt.soft}`,
|
|
76
69
|
},
|
|
77
70
|
|
|
78
71
|
// Disabled State
|
|
79
72
|
'&:not(:where(:checked, :indeterminate, :disabled, :focus-visible, .focus)):where(:hover, .hover, :active, .active) ~ div:first-of-type':
|
|
80
73
|
{
|
|
81
|
-
borderColor:
|
|
74
|
+
borderColor: system.color.border.input.strong,
|
|
82
75
|
},
|
|
83
76
|
'&:where(:checked, :indeterminate) ~ div:first-of-type': {
|
|
84
77
|
borderColor: brand.primary.base,
|
|
85
78
|
backgroundColor: brand.primary.base,
|
|
86
79
|
},
|
|
87
80
|
'&:disabled ~ div:first-of-type': {
|
|
88
|
-
borderColor:
|
|
89
|
-
backgroundColor:
|
|
90
|
-
opacity:
|
|
81
|
+
borderColor: system.color.border.input.disabled,
|
|
82
|
+
backgroundColor: system.color.bg.alt.softer,
|
|
83
|
+
opacity: system.opacity.full,
|
|
91
84
|
},
|
|
92
85
|
'&:disabled:where(:checked, :indeterminate) ~ div:first-of-type': {
|
|
93
86
|
borderColor: brand.primary.light,
|
|
@@ -115,7 +108,7 @@ const checkboxInputStencil = createStencil({
|
|
|
115
108
|
width: 2,
|
|
116
109
|
separation: 2,
|
|
117
110
|
animate: false,
|
|
118
|
-
outerColor:
|
|
111
|
+
outerColor: brand.common.focusOutline,
|
|
119
112
|
}),
|
|
120
113
|
borderColor: brand.primary.base,
|
|
121
114
|
borderWidth: px2rem(2),
|
|
@@ -133,36 +126,36 @@ const checkboxInputStencil = createStencil({
|
|
|
133
126
|
},
|
|
134
127
|
|
|
135
128
|
'& ~ div:first-of-type': {
|
|
136
|
-
borderColor:
|
|
129
|
+
borderColor: system.color.border.input.inverse,
|
|
137
130
|
},
|
|
138
131
|
|
|
139
132
|
// Disabled State for inverse variant
|
|
140
133
|
'&:not(:where(:checked, :indeterminate, :disabled, :focus-visible, .focus)):where(:hover, .hover, :active, .active) ~ div:first-of-type':
|
|
141
134
|
{
|
|
142
|
-
borderColor:
|
|
135
|
+
borderColor: system.color.border.input.inverse,
|
|
143
136
|
},
|
|
144
137
|
'&:where(:checked, :indeterminate) ~ div:first-of-type': {
|
|
145
|
-
borderColor:
|
|
146
|
-
backgroundColor:
|
|
138
|
+
borderColor: system.color.border.input.inverse,
|
|
139
|
+
backgroundColor: system.color.bg.default,
|
|
147
140
|
},
|
|
148
141
|
'&:disabled ~ div:first-of-type': {
|
|
149
|
-
backgroundColor:
|
|
142
|
+
backgroundColor: system.color.bg.alt.default,
|
|
150
143
|
opacity: system.opacity.disabled,
|
|
151
144
|
},
|
|
152
145
|
'&:disabled:where(:checked, :indeterminate) ~ div:first-of-type': {
|
|
153
|
-
borderColor:
|
|
154
|
-
backgroundColor:
|
|
146
|
+
borderColor: system.color.border.input.inverse,
|
|
147
|
+
backgroundColor: system.color.bg.alt.default,
|
|
155
148
|
},
|
|
156
149
|
|
|
157
150
|
// Focus state for inverse variant
|
|
158
151
|
'&:where(:focus-visible, .focus) ~ div:first-of-type': {
|
|
159
|
-
borderColor:
|
|
152
|
+
borderColor: system.color.border.contrast.default,
|
|
160
153
|
...focusRing({
|
|
161
154
|
width: 2,
|
|
162
155
|
separation: 0,
|
|
163
156
|
animate: false,
|
|
164
|
-
innerColor:
|
|
165
|
-
outerColor:
|
|
157
|
+
innerColor: system.color.fg.strong,
|
|
158
|
+
outerColor: system.color.fg.inverse,
|
|
166
159
|
}),
|
|
167
160
|
},
|
|
168
161
|
'&:checked:focus-visible, &:checked.focus, &:indeterminate:focus-visible, &:indeterminate.focus':
|
|
@@ -172,10 +165,10 @@ const checkboxInputStencil = createStencil({
|
|
|
172
165
|
width: 2,
|
|
173
166
|
separation: 2,
|
|
174
167
|
animate: false,
|
|
175
|
-
innerColor:
|
|
176
|
-
outerColor:
|
|
168
|
+
innerColor: system.color.fg.strong,
|
|
169
|
+
outerColor: system.color.fg.inverse,
|
|
177
170
|
}),
|
|
178
|
-
borderColor:
|
|
171
|
+
borderColor: system.color.border.inverse,
|
|
179
172
|
},
|
|
180
173
|
},
|
|
181
174
|
},
|
|
@@ -188,74 +181,40 @@ const checkboxInputStencil = createStencil({
|
|
|
188
181
|
},
|
|
189
182
|
},
|
|
190
183
|
error: {
|
|
191
|
-
|
|
184
|
+
true: {
|
|
192
185
|
'&:not(:where(:focus-visible, .focus)) ~ div:first-of-type': {
|
|
193
|
-
borderColor:
|
|
186
|
+
borderColor: checkboxBackgroundStencil.vars.errorRingColorInner,
|
|
194
187
|
boxShadow: `
|
|
195
|
-
0 0 0 ${px2rem(1)} ${
|
|
196
|
-
0 0 0 ${px2rem(2)} ${
|
|
188
|
+
0 0 0 ${px2rem(1)} ${checkboxBackgroundStencil.vars.errorRingColorInner},
|
|
189
|
+
0 0 0 ${px2rem(2)} ${checkboxBackgroundStencil.vars.errorRingColorOuter}`,
|
|
197
190
|
},
|
|
198
191
|
'&:where(:checked, :indeterminate) ~ div:first-of-type': {
|
|
199
192
|
borderColor: 'transparent',
|
|
200
193
|
boxShadow: `
|
|
201
|
-
0 0 0 ${px2rem(2)} ${
|
|
202
|
-
0 0 0 ${px2rem(4)} ${
|
|
203
|
-
0 0 0 ${px2rem(5)} ${
|
|
194
|
+
0 0 0 ${px2rem(2)} ${system.color.fg.inverse},
|
|
195
|
+
0 0 0 ${px2rem(4)} ${checkboxBackgroundStencil.vars.errorRingColorInner},
|
|
196
|
+
0 0 0 ${px2rem(5)} ${checkboxBackgroundStencil.vars.errorRingColorOuter}`,
|
|
204
197
|
},
|
|
205
198
|
'&:not(:where(:checked, :indeterminate, :disabled, :focus-visible, .focus)):where(:hover, .hover, :active, .active) ~ div:first-of-type':
|
|
206
199
|
{
|
|
207
|
-
borderColor:
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
alert: {
|
|
211
|
-
'&:not(:where(:focus-visible, .focus)) ~ div:first-of-type': {
|
|
212
|
-
border: `${px2rem(1)} solid ${backgroundVars.inner}`,
|
|
213
|
-
boxShadow: `
|
|
214
|
-
0 0 0 ${px2rem(1)} ${backgroundVars.inner},
|
|
215
|
-
0 0 0 ${px2rem(2)} ${backgroundVars.outer}`,
|
|
216
|
-
},
|
|
217
|
-
'&:not(where(:checked, :indeterminate, :disabled, :focus-visible, .focus)):where(:hover, .hover, :active, .active) ~ div:first-of-type':
|
|
218
|
-
{
|
|
219
|
-
borderColor: backgroundVars.inner,
|
|
200
|
+
borderColor: checkboxBackgroundStencil.vars.errorRingColorInner,
|
|
220
201
|
},
|
|
221
|
-
'&:where(:checked, :indeterminate) ~ div:first-of-type': {
|
|
222
|
-
borderColor: 'transparent',
|
|
223
|
-
boxShadow: `
|
|
224
|
-
0 0 0 ${px2rem(2)} ${base.frenchVanilla100},
|
|
225
|
-
0 0 0 ${px2rem(4)} ${backgroundVars.inner},
|
|
226
|
-
0 0 0 ${px2rem(5)} ${backgroundVars.outer}`,
|
|
227
|
-
},
|
|
228
202
|
},
|
|
229
203
|
},
|
|
230
204
|
},
|
|
231
205
|
compound: [
|
|
232
206
|
{
|
|
233
|
-
modifiers: {variant: 'inverse', error:
|
|
234
|
-
styles: {
|
|
235
|
-
'&:not(:where(:focus-visible, .focus)) ~ div:first-of-type': {
|
|
236
|
-
border: `${px2rem(1)} solid ${base.soap300}`,
|
|
237
|
-
},
|
|
238
|
-
'&:not(where(:checked, :indeterminate, :disabled, :focus-visible, .focus)):where(:hover, .hover, :active, .active) ~ div:first-of-type':
|
|
239
|
-
{
|
|
240
|
-
borderColor: base.soap300,
|
|
241
|
-
},
|
|
242
|
-
'&:where(:checked, :indeterminate) ~ div:first-of-type': {
|
|
243
|
-
borderColor: base.soap300,
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
modifiers: {variant: 'inverse', error: 'alert'},
|
|
207
|
+
modifiers: {variant: 'inverse', error: true},
|
|
249
208
|
styles: {
|
|
250
209
|
'&:not(:where(:focus-visible, .focus)) ~ div:first-of-type': {
|
|
251
|
-
border: `${px2rem(1)} solid ${
|
|
210
|
+
border: `${px2rem(1)} solid ${system.color.border.input.inverse}`,
|
|
252
211
|
},
|
|
253
212
|
'&:not(where(:checked, :indeterminate, :disabled, :focus-visible, .focus)):where(:hover, .hover, :active, .active) ~ div:first-of-type':
|
|
254
213
|
{
|
|
255
|
-
borderColor:
|
|
214
|
+
borderColor: system.color.border.input.inverse,
|
|
256
215
|
},
|
|
257
216
|
'&:where(:checked, :indeterminate) ~ div:first-of-type': {
|
|
258
|
-
borderColor:
|
|
217
|
+
borderColor: system.color.border.input.inverse,
|
|
259
218
|
},
|
|
260
219
|
},
|
|
261
220
|
},
|
|
@@ -272,7 +231,7 @@ export const CheckboxInput = createComponent('input')({
|
|
|
272
231
|
type="checkbox"
|
|
273
232
|
ref={ref}
|
|
274
233
|
aria-checked={indeterminate ? 'mixed' : checked}
|
|
275
|
-
{...handleCsProp(elemProps, checkboxInputStencil({variant, disabled, error}))}
|
|
234
|
+
{...handleCsProp(elemProps, checkboxInputStencil({variant, disabled, error: !!error}))}
|
|
276
235
|
/>
|
|
277
236
|
);
|
|
278
237
|
},
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import {createComponent} from '@workday/canvas-kit-react/common';
|
|
3
|
-
import {calc,
|
|
3
|
+
import {calc, createStencil, px2rem} from '@workday/canvas-kit-styling';
|
|
4
4
|
import {system} from '@workday/canvas-tokens-web';
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
const checkboxRippleStencil = createStencil({
|
|
7
|
+
base: {
|
|
8
|
+
borderRadius: system.shape.round,
|
|
9
|
+
boxShadow: 'none',
|
|
10
|
+
height: calc.add(system.space.x4, px2rem(2)),
|
|
11
|
+
width: calc.add(system.space.x4, px2rem(2)),
|
|
12
|
+
transition: 'box-shadow 150ms ease-out',
|
|
13
|
+
position: 'absolute',
|
|
14
|
+
pointerEvents: 'none',
|
|
15
|
+
},
|
|
14
16
|
});
|
|
15
17
|
|
|
16
18
|
export const CheckboxRipple = createComponent('span')({
|
|
17
19
|
displayName: 'CheckboxRipple',
|
|
18
20
|
Component: elemProps => {
|
|
19
|
-
return <span
|
|
21
|
+
return <span {...checkboxRippleStencil()} />;
|
|
20
22
|
},
|
|
21
23
|
});
|
|
@@ -4,7 +4,25 @@ interface CheckBackgroundProps {
|
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
error?: ErrorType;
|
|
6
6
|
}
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const checkboxBackgroundStencil: import("@workday/canvas-kit-styling").Stencil<{
|
|
8
|
+
error: {
|
|
9
|
+
error: ({ errorRingColorInner, errorRingColorOuter }: {
|
|
10
|
+
errorRingColorInner: string;
|
|
11
|
+
errorRingColorOuter: string;
|
|
12
|
+
}) => {
|
|
13
|
+
[x: string]: string;
|
|
14
|
+
};
|
|
15
|
+
alert: ({ errorRingColorInner, errorRingColorOuter }: {
|
|
16
|
+
errorRingColorInner: string;
|
|
17
|
+
errorRingColorOuter: string;
|
|
18
|
+
}) => {
|
|
19
|
+
[x: string]: "--cnvs-brand-alert-base" | "--cnvs-brand-alert-darkest";
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}, {
|
|
23
|
+
errorRingColorInner: string;
|
|
24
|
+
errorRingColorOuter: string;
|
|
25
|
+
}, never, never>;
|
|
8
26
|
export declare const CheckBackground: import("@workday/canvas-kit-react/common").ElementComponent<"div", CheckBackgroundProps>;
|
|
9
27
|
export {};
|
|
10
28
|
//# sourceMappingURL=CheckBackground.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckBackground.d.ts","sourceRoot":"","sources":["../../../../checkbox/lib/CheckBackground.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAkB,SAAS,EAAC,MAAM,kCAAkC,CAAC;AAI5E,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"CheckBackground.d.ts","sourceRoot":"","sources":["../../../../checkbox/lib/CheckBackground.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAkB,SAAS,EAAC,MAAM,kCAAkC,CAAC;AAI5E,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;gBAgCpC,CAAC;AAEH,eAAO,MAAM,eAAe,0FAK1B,CAAC"}
|
|
@@ -19,24 +19,27 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.CheckBackground = exports.
|
|
22
|
+
exports.CheckBackground = exports.checkboxBackgroundStencil = void 0;
|
|
23
23
|
const React = __importStar(require("react"));
|
|
24
24
|
const common_1 = require("@workday/canvas-kit-react/common");
|
|
25
25
|
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
|
|
26
26
|
const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
|
|
27
|
-
exports.
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
exports.checkboxBackgroundStencil = canvas_kit_styling_1.createStencil({
|
|
28
|
+
vars: {
|
|
29
|
+
errorRingColorInner: '',
|
|
30
|
+
errorRingColorOuter: '',
|
|
31
|
+
},
|
|
32
|
+
base: { name: "0a4d8d", styles: "align-items:center;background-color:var(--cnvs-sys-color-bg-default);border-radius:var(--cnvs-sys-shape-half);box-sizing:border-box;display:flex;height:calc(var(--cnvs-sys-space-x4) + 0.125rem);justify-content:center;padding:var(--cnvs-sys-space-zero) calc(var(--cnvs-sys-space-x1) / 2);pointer-events:none;position:absolute;transition:border 200ms ease, background 200ms;width:calc(var(--cnvs-sys-space-x4) + 0.125rem);border:0.0625rem solid var(--cnvs-sys-color-border-input-default);" },
|
|
30
33
|
modifiers: {
|
|
31
34
|
error: {
|
|
32
|
-
error: { name: "
|
|
33
|
-
alert: { name: "
|
|
35
|
+
error: { name: "82be64", styles: "--cnvs-checkbox-background-errorRingColorInner:var(--cnvs-brand-error-base);--cnvs-checkbox-background-errorRingColorOuter:transparent;" },
|
|
36
|
+
alert: { name: "1d0852", styles: "--cnvs-checkbox-background-errorRingColorInner:var(--cnvs-brand-alert-base);--cnvs-checkbox-background-errorRingColorOuter:var(--cnvs-brand-alert-darkest);" }
|
|
34
37
|
}
|
|
35
38
|
}
|
|
36
39
|
}, "cnvs-checkbox-background");
|
|
37
40
|
exports.CheckBackground = common_1.createComponent('div')({
|
|
38
41
|
displayName: 'CheckBackground',
|
|
39
42
|
Component: ({ error, children }) => {
|
|
40
|
-
return React.createElement("div", Object.assign({}, checkboxBackgroundStencil({ error })), children);
|
|
43
|
+
return React.createElement("div", Object.assign({}, exports.checkboxBackgroundStencil({ error })), children);
|
|
41
44
|
},
|
|
42
45
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxCheck.d.ts","sourceRoot":"","sources":["../../../../checkbox/lib/CheckboxCheck.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAkB,MAAM,kCAAkC,CAAC;AAO5E,UAAU,kBAAkB;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;
|
|
1
|
+
{"version":3,"file":"CheckboxCheck.d.ts","sourceRoot":"","sources":["../../../../checkbox/lib/CheckboxCheck.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAkB,MAAM,kCAAkC,CAAC;AAO5E,UAAU,kBAAkB;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAiDD,eAAO,MAAM,aAAa,wFAexB,CAAC"}
|
|
@@ -28,24 +28,26 @@ const icon_1 = require("@workday/canvas-kit-react/icon");
|
|
|
28
28
|
const canvas_system_icons_web_1 = require("@workday/canvas-system-icons-web");
|
|
29
29
|
const CheckBackground_1 = require("./CheckBackground");
|
|
30
30
|
const checkboxCheckStencil = canvas_kit_styling_1.createStencil({
|
|
31
|
-
base: { name: "
|
|
31
|
+
base: { name: "2673c1", styles: "display:flex;flex-direction:column;max-width:100%;pointer-events:none;transition:transform 200ms ease, opacity 200ms ease;span{margin-inline-start:calc(0.375rem * -1);transition:margin 200ms ease;}opacity:var(--cnvs-sys-opacity-zero);transform:scale(0.5);" },
|
|
32
32
|
modifiers: {
|
|
33
33
|
checked: {
|
|
34
|
-
true: { name: "
|
|
34
|
+
true: { name: "b7568b", styles: "--cnvs-system-icon-color:var(--cnvs-brand-primary-accent);opacity:var(--cnvs-sys-opacity-full);transform:scale(1);" }
|
|
35
35
|
},
|
|
36
36
|
indeterminate: {
|
|
37
|
-
true: { name: "
|
|
37
|
+
true: { name: "7ccfda", styles: "opacity:var(--cnvs-sys-opacity-full);transform:scale(1);" }
|
|
38
38
|
},
|
|
39
39
|
variant: {
|
|
40
|
-
inverse: { name: "
|
|
40
|
+
inverse: { name: "1dac33", styles: "--cnvs-system-icon-color:var(--cnvs-brand-primary-base);& > div{background-color:var(--cnvs-brand-primary-base);}" }
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}, "cnvs-checkbox-check");
|
|
44
|
-
const
|
|
44
|
+
const indeterminateBoxStencil = canvas_kit_styling_1.createStencil({
|
|
45
|
+
base: { name: "d394e3", styles: "width:0.625rem;height:calc(var(--cnvs-sys-space-x1) / 2);background-color:var(--cnvs-brand-primary-accent);" }
|
|
46
|
+
}, "cnvs-indeterminate-box");
|
|
45
47
|
exports.CheckboxCheck = common_1.createComponent('div')({
|
|
46
48
|
displayName: 'CheckboxCheck',
|
|
47
49
|
Component: ({ checked, error, indeterminate, variant }) => {
|
|
48
50
|
return (React.createElement(CheckBackground_1.CheckBackground, { error: error },
|
|
49
|
-
React.createElement("div", Object.assign({}, checkboxCheckStencil({ checked, indeterminate, variant })), indeterminate ? (React.createElement("div", {
|
|
51
|
+
React.createElement("div", Object.assign({}, checkboxCheckStencil({ checked, indeterminate, variant })), indeterminate ? (React.createElement("div", Object.assign({}, indeterminateBoxStencil()))) : (checked && React.createElement(icon_1.SystemIcon, { icon: canvas_system_icons_web_1.checkSmallIcon })))));
|
|
50
52
|
},
|
|
51
53
|
});
|
|
@@ -7,7 +7,6 @@ interface CheckboxContainerProps extends CSProps {
|
|
|
7
7
|
label: string;
|
|
8
8
|
variant?: 'inverse';
|
|
9
9
|
}
|
|
10
|
-
export declare const inputVars: import("@workday/canvas-kit-styling").CsVars<"errorInner" | "errorOuter" | "alertInner" | "alertOuter", never>;
|
|
11
10
|
export declare const CheckboxContainer: import("@workday/canvas-kit-react/common").ElementComponent<"div", CheckboxContainerProps>;
|
|
12
11
|
export {};
|
|
13
12
|
//# sourceMappingURL=CheckboxContainer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxContainer.d.ts","sourceRoot":"","sources":["../../../../checkbox/lib/CheckboxContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"CheckboxContainer.d.ts","sourceRoot":"","sources":["../../../../checkbox/lib/CheckboxContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,OAAO,EAA8B,MAAM,6BAA6B,CAAC;AAIjF,UAAU,sBAAuB,SAAQ,OAAO;IAC9C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AA0BD,eAAO,MAAM,iBAAiB,4FAmB5B,CAAC"}
|
|
@@ -19,18 +19,19 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.CheckboxContainer =
|
|
22
|
+
exports.CheckboxContainer = void 0;
|
|
23
23
|
const React = __importStar(require("react"));
|
|
24
24
|
const common_1 = require("@workday/canvas-kit-react/common");
|
|
25
25
|
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
|
|
26
26
|
const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
|
|
27
27
|
const text_1 = require("@workday/canvas-kit-react/text");
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
const checkboxContainerStencil = canvas_kit_styling_1.createStencil({
|
|
29
|
+
base: { name: "96fa81", styles: "display:flex;align-items:center;min-height:var(--cnvs-sys-space-x6);position:relative;&>div{display:flex;height:calc(var(--cnvs-sys-space-x4) + 0.125rem);min-width:calc(var(--cnvs-sys-space-x4) + 0.125rem);margin-top:0.1875rem;align-self:flex-start;}& > label{padding-inline-start:var(--cnvs-sys-space-x3);}" }
|
|
30
|
+
}, "cnvs-checkbox-container");
|
|
30
31
|
exports.CheckboxContainer = common_1.createComponent('div')({
|
|
31
32
|
displayName: 'CheckboxContainer',
|
|
32
33
|
Component: ({ children, disabled, id, label, variant }) => {
|
|
33
|
-
return (React.createElement("div", {
|
|
34
|
+
return (React.createElement("div", Object.assign({}, checkboxContainerStencil()),
|
|
34
35
|
React.createElement("div", null, children),
|
|
35
36
|
label && (React.createElement(text_1.LabelText, { htmlFor: id, disabled: disabled, variant: variant, style: { cursor: disabled ? 'default' : 'pointer' } }, label))));
|
|
36
37
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxInput.d.ts","sourceRoot":"","sources":["../../../../checkbox/lib/CheckboxInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAA6B,SAAS,EAAC,MAAM,kCAAkC,CAAC;AAEvF,OAAO,
|
|
1
|
+
{"version":3,"file":"CheckboxInput.d.ts","sourceRoot":"","sources":["../../../../checkbox/lib/CheckboxInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAA6B,SAAS,EAAC,MAAM,kCAAkC,CAAC;AAEvF,OAAO,EAA4C,OAAO,EAAC,MAAM,6BAA6B,CAAC;AAI/F,MAAM,WAAW,aAAc,SAAQ,OAAO;IAC5C;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC5D;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACjC;AA8KD,eAAO,MAAM,aAAa,qFAcxB,CAAC"}
|