@workday/canvas-kit-react 10.0.0-alpha.446-next.0 → 10.0.0-alpha.447-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 +4 -4
- package/checkbox/lib/Checkbox.tsx +18 -12
- package/dist/commonjs/button/lib/BaseButton.d.ts +1 -1
- package/dist/commonjs/button/lib/BaseButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/BaseButton.js +4 -4
- package/dist/commonjs/checkbox/lib/Checkbox.d.ts.map +1 -1
- package/dist/commonjs/checkbox/lib/Checkbox.js +11 -11
- package/dist/commonjs/radio/lib/Radio.d.ts.map +1 -1
- package/dist/commonjs/radio/lib/Radio.js +13 -13
- package/dist/commonjs/select/lib/Select.d.ts.map +1 -1
- package/dist/commonjs/select/lib/Select.js +1 -1
- package/dist/commonjs/table/lib/TableRow.js +1 -1
- package/dist/commonjs/text-area/lib/TextArea.d.ts.map +1 -1
- package/dist/commonjs/text-area/lib/TextArea.js +3 -3
- package/dist/commonjs/text-input/lib/TextInput.js +1 -1
- package/dist/commonjs/tokens/index.d.ts.map +1 -1
- package/dist/commonjs/tokens/lib/depth.d.ts +6 -6
- package/dist/commonjs/tokens/lib/depth.d.ts.map +1 -1
- package/dist/commonjs/tokens/lib/depth.js +6 -6
- package/dist/commonjs/tokens/lib/space.d.ts +65 -27
- package/dist/commonjs/tokens/lib/space.d.ts.map +1 -1
- package/dist/commonjs/tokens/lib/space.js +61 -23
- package/dist/commonjs/tooltip/lib/TooltipContainer.js +8 -8
- package/dist/es6/button/lib/BaseButton.d.ts +1 -1
- package/dist/es6/button/lib/BaseButton.d.ts.map +1 -1
- package/dist/es6/button/lib/BaseButton.js +4 -4
- package/dist/es6/checkbox/lib/Checkbox.d.ts.map +1 -1
- package/dist/es6/checkbox/lib/Checkbox.js +12 -12
- package/dist/es6/radio/lib/Radio.d.ts.map +1 -1
- package/dist/es6/radio/lib/Radio.js +14 -14
- package/dist/es6/select/lib/Select.d.ts.map +1 -1
- package/dist/es6/select/lib/Select.js +2 -2
- package/dist/es6/table/lib/TableRow.js +1 -1
- package/dist/es6/text-area/lib/TextArea.d.ts.map +1 -1
- package/dist/es6/text-area/lib/TextArea.js +4 -4
- package/dist/es6/text-input/lib/TextInput.js +1 -1
- package/dist/es6/tokens/index.d.ts.map +1 -1
- package/dist/es6/tokens/index.js +1 -1
- package/dist/es6/tokens/lib/depth.d.ts +6 -6
- package/dist/es6/tokens/lib/depth.d.ts.map +1 -1
- package/dist/es6/tokens/lib/depth.js +6 -6
- package/dist/es6/tokens/lib/space.d.ts +65 -27
- package/dist/es6/tokens/lib/space.d.ts.map +1 -1
- package/dist/es6/tokens/lib/space.js +61 -23
- package/dist/es6/tooltip/lib/TooltipContainer.js +8 -8
- package/package.json +3 -3
- package/radio/lib/Radio.tsx +20 -14
- package/select/lib/Select.tsx +2 -9
- package/table/lib/TableRow.tsx +1 -1
- package/text-area/lib/TextArea.tsx +10 -4
- package/text-input/lib/TextInput.tsx +1 -1
- package/tokens/README.md +19 -19
- package/tokens/index.ts +1 -2
- package/tokens/lib/depth.ts +16 -12
- package/tokens/lib/space.ts +84 -46
- package/tooltip/lib/TooltipContainer.tsx +8 -8
package/tokens/lib/space.ts
CHANGED
|
@@ -5,73 +5,111 @@ type ValueOf<T> = T[keyof T];
|
|
|
5
5
|
// but writing it this way removes the `readonly` in the hint,
|
|
6
6
|
// which adds a lot of visual noise and can be confusing for folks.
|
|
7
7
|
|
|
8
|
-
/** Type for the `space` object with keys and
|
|
8
|
+
/** Type for the `space` object with keys and rem values (strings) */
|
|
9
9
|
export type CanvasSpace = {
|
|
10
|
-
zero: '
|
|
11
|
-
xxxs: '
|
|
12
|
-
xxs: '
|
|
13
|
-
xs: '
|
|
14
|
-
s: '
|
|
15
|
-
m: '
|
|
16
|
-
l: '
|
|
17
|
-
xl: '
|
|
18
|
-
xxl: '
|
|
19
|
-
xxxl: '
|
|
10
|
+
zero: '0';
|
|
11
|
+
xxxs: '0.25rem';
|
|
12
|
+
xxs: '0.5rem';
|
|
13
|
+
xs: '0.75rem';
|
|
14
|
+
s: '1rem';
|
|
15
|
+
m: '1.5rem';
|
|
16
|
+
l: '2rem';
|
|
17
|
+
xl: '2.5rem';
|
|
18
|
+
xxl: '4rem';
|
|
19
|
+
xxxl: '5rem';
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
/** Type for `CanvasSpace` keys */
|
|
23
23
|
export type CanvasSpaceKeys = keyof CanvasSpace;
|
|
24
24
|
|
|
25
|
-
/** The
|
|
25
|
+
/** The rem values for CanvasSpace (strings) */
|
|
26
26
|
export type CanvasSpaceValues = ValueOf<CanvasSpace>;
|
|
27
27
|
|
|
28
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* An object of space keys and rem values (strings)
|
|
30
|
+
*
|
|
31
|
+
* Below is a table to show the equivalent values from `px` to `rem`.
|
|
32
|
+
* This is based on the default browser font size which is `16px`.
|
|
33
|
+
*
|
|
34
|
+
* | px Value | rem Value | space token |
|
|
35
|
+
* | --------- | --------- | ----------- |
|
|
36
|
+
* | 0 | 0 | zero |
|
|
37
|
+
* | 4px | 0.25rem | xxxs |
|
|
38
|
+
* | 8px | 0.5rem | xxs |
|
|
39
|
+
* | 12px | 0.75rem | xs |
|
|
40
|
+
* | 16px | 1rem | s |
|
|
41
|
+
* | 24px | 1.5rem | m |
|
|
42
|
+
* | 32px | 2rem | l |
|
|
43
|
+
* | 40px | 2.5rem | xl |
|
|
44
|
+
* | 64px | 4rem | xxl |
|
|
45
|
+
* | 80px | 5rem | xxxl |
|
|
46
|
+
*
|
|
47
|
+
* */
|
|
29
48
|
export const space: CanvasSpace = {
|
|
30
|
-
zero: '
|
|
31
|
-
xxxs: '
|
|
32
|
-
xxs: '
|
|
33
|
-
xs: '
|
|
34
|
-
s: '
|
|
35
|
-
m: '
|
|
36
|
-
l: '
|
|
37
|
-
xl: '
|
|
38
|
-
xxl: '
|
|
39
|
-
xxxl: '
|
|
49
|
+
zero: '0',
|
|
50
|
+
xxxs: '0.25rem',
|
|
51
|
+
xxs: '0.5rem',
|
|
52
|
+
xs: '0.75rem',
|
|
53
|
+
s: '1rem',
|
|
54
|
+
m: '1.5rem',
|
|
55
|
+
l: '2rem',
|
|
56
|
+
xl: '2.5rem',
|
|
57
|
+
xxl: '4rem',
|
|
58
|
+
xxxl: '5rem',
|
|
40
59
|
};
|
|
41
60
|
|
|
42
|
-
/** Type for the `spaceNumbers` object with keys and numeric
|
|
61
|
+
/** Type for the `spaceNumbers` object with keys and numeric rem values (numbers) */
|
|
43
62
|
export type CanvasSpaceNumbers = {
|
|
44
63
|
zero: 0;
|
|
45
|
-
xxxs:
|
|
46
|
-
xxs:
|
|
47
|
-
xs:
|
|
48
|
-
s:
|
|
49
|
-
m:
|
|
50
|
-
l:
|
|
51
|
-
xl:
|
|
52
|
-
xxl:
|
|
53
|
-
xxxl:
|
|
64
|
+
xxxs: 0.25;
|
|
65
|
+
xxs: 0.5;
|
|
66
|
+
xs: 0.75;
|
|
67
|
+
s: 1;
|
|
68
|
+
m: 1.5;
|
|
69
|
+
l: 2;
|
|
70
|
+
xl: 2.5;
|
|
71
|
+
xxl: 4;
|
|
72
|
+
xxxl: 5;
|
|
54
73
|
};
|
|
55
74
|
|
|
56
|
-
/** The numeric
|
|
75
|
+
/** The numeric rem values for CanvasSpaceNumbers (numbers) */
|
|
57
76
|
export type CanvasSpaceNumberValues = ValueOf<CanvasSpaceNumbers>;
|
|
58
77
|
|
|
59
78
|
/**
|
|
60
|
-
* An object of space keys and their numeric
|
|
61
|
-
* - These are helpful when you need a raw numeric
|
|
79
|
+
* An object of space keys and their numeric rem values (numbers)
|
|
80
|
+
* - These are helpful when you need a raw numeric rem value.
|
|
62
81
|
* - Here's an example usage to perform calculations:
|
|
63
82
|
* @example
|
|
64
|
-
*
|
|
83
|
+
* ```tsx
|
|
84
|
+
* const buttonPaddingLeft = `${spaceNumbers.s + iconSize}rem`;
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* Below is a table to show the equivalent values from `px` to `rem`.
|
|
88
|
+
* This is based on the default browser font size which is `16px`.
|
|
89
|
+
*
|
|
90
|
+
* | px Value | rem Value | space token |
|
|
91
|
+
* | --------- | --------- | ----------- |
|
|
92
|
+
* | 0 | 0 | zero |
|
|
93
|
+
* | 4px | 0.25rem | xxxs |
|
|
94
|
+
* | 8px | 0.5rem | xxs |
|
|
95
|
+
* | 12px | 0.75rem | xs |
|
|
96
|
+
* | 16px | 1rem | s |
|
|
97
|
+
* | 24px | 1.5rem | m |
|
|
98
|
+
* | 32px | 2rem | l |
|
|
99
|
+
* | 40px | 2.5rem | xl |
|
|
100
|
+
* | 64px | 4rem | xxl |
|
|
101
|
+
* | 80px | 5rem | xxxl |
|
|
102
|
+
*
|
|
65
103
|
*/
|
|
66
104
|
export const spaceNumbers: CanvasSpaceNumbers = {
|
|
67
105
|
zero: 0,
|
|
68
|
-
xxxs:
|
|
69
|
-
xxs:
|
|
70
|
-
xs:
|
|
71
|
-
s:
|
|
72
|
-
m:
|
|
73
|
-
l:
|
|
74
|
-
xl:
|
|
75
|
-
xxl:
|
|
76
|
-
xxxl:
|
|
106
|
+
xxxs: 0.25,
|
|
107
|
+
xxs: 0.5,
|
|
108
|
+
xs: 0.75,
|
|
109
|
+
s: 1,
|
|
110
|
+
m: 1.5,
|
|
111
|
+
l: 2,
|
|
112
|
+
xl: 2.5,
|
|
113
|
+
xxl: 4,
|
|
114
|
+
xxxl: 5,
|
|
77
115
|
};
|
|
@@ -50,7 +50,7 @@ export const TooltipContainer = styled('div')<TooltipContainerProps>(
|
|
|
50
50
|
...type.levels.subtext.medium,
|
|
51
51
|
display: 'inline-flex',
|
|
52
52
|
position: 'relative',
|
|
53
|
-
padding:
|
|
53
|
+
padding: space.xs,
|
|
54
54
|
color: colors.frenchVanilla100,
|
|
55
55
|
a: {
|
|
56
56
|
color: colors.frenchVanilla100,
|
|
@@ -61,7 +61,7 @@ export const TooltipContainer = styled('div')<TooltipContainerProps>(
|
|
|
61
61
|
content: '""',
|
|
62
62
|
borderRadius: borderRadius.m,
|
|
63
63
|
zIndex: -1,
|
|
64
|
-
margin:
|
|
64
|
+
margin: space.xxxs,
|
|
65
65
|
backgroundColor: 'rgba(0,0,0,.85)',
|
|
66
66
|
position: 'absolute',
|
|
67
67
|
top: 0,
|
|
@@ -72,9 +72,9 @@ export const TooltipContainer = styled('div')<TooltipContainerProps>(
|
|
|
72
72
|
|
|
73
73
|
// offset tooltips by 2 pixels when a keyboard focus ring is detected
|
|
74
74
|
'[data-whatinput=keyboard] &': {
|
|
75
|
-
padding: spaceNumbers.
|
|
75
|
+
padding: `${spaceNumbers.s - 0.125}rem`,
|
|
76
76
|
':before': {
|
|
77
|
-
margin: spaceNumbers.xxxs +
|
|
77
|
+
margin: `${spaceNumbers.xxxs + 0.125}rem`,
|
|
78
78
|
},
|
|
79
79
|
},
|
|
80
80
|
|
|
@@ -86,16 +86,16 @@ export const TooltipContainer = styled('div')<TooltipContainerProps>(
|
|
|
86
86
|
|
|
87
87
|
// Fix offsets based on placement
|
|
88
88
|
'[data-popper-placement="top-start"] &, [data-popper-placement="bottom-start"] &': {
|
|
89
|
-
left:
|
|
89
|
+
left: `-${space.xxxs}`,
|
|
90
90
|
},
|
|
91
91
|
'[data-popper-placement="top-end"] &, [data-popper-placement="bottom-end"] &': {
|
|
92
|
-
right:
|
|
92
|
+
right: `-${space.xxxs}`,
|
|
93
93
|
},
|
|
94
94
|
'[data-popper-placement="left-start"] &, [data-popper-placement="right-start"] &': {
|
|
95
|
-
top:
|
|
95
|
+
top: `-${space.xxxs}`,
|
|
96
96
|
},
|
|
97
97
|
'[data-popper-placement="left-end"] &, [data-popper-placement="right-end"] &': {
|
|
98
|
-
bottom:
|
|
98
|
+
bottom: `-${space.xxxs}`,
|
|
99
99
|
},
|
|
100
100
|
},
|
|
101
101
|
({transformOrigin = defaultTransformOrigin}) => {
|