@workday/canvas-kit-react 10.0.0-alpha.538-next.0 → 10.0.0-alpha.540-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 +8 -11
- package/button/lib/BaseButton.tsx +274 -256
- package/button/lib/Button.tsx +67 -0
- package/button/lib/DeleteButton.tsx +42 -58
- package/button/lib/PrimaryButton.tsx +82 -149
- package/button/lib/SecondaryButton.tsx +87 -173
- package/button/lib/TertiaryButton.tsx +158 -223
- package/button/lib/ToolbarDropdownButton.tsx +11 -2
- package/button/lib/ToolbarIconButton.tsx +10 -2
- package/button/lib/parts/ButtonLabelIcon.tsx +1 -7
- package/button/lib/types.ts +6 -8
- package/checkbox/lib/Checkbox.tsx +24 -33
- package/common/lib/CanvasProvider.tsx +50 -24
- package/dist/commonjs/button/index.d.ts +8 -5
- package/dist/commonjs/button/index.d.ts.map +1 -1
- package/dist/commonjs/button/index.js +9 -13
- package/dist/commonjs/button/lib/BaseButton.d.ts +69 -5
- package/dist/commonjs/button/lib/BaseButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/BaseButton.js +199 -192
- package/dist/commonjs/button/lib/Button.d.ts +17 -0
- package/dist/commonjs/button/lib/Button.d.ts.map +1 -0
- package/dist/commonjs/button/lib/Button.js +42 -0
- package/dist/commonjs/button/lib/DeleteButton.d.ts +7 -9
- package/dist/commonjs/button/lib/DeleteButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/DeleteButton.js +29 -19
- package/dist/commonjs/button/lib/PrimaryButton.d.ts +15 -36
- package/dist/commonjs/button/lib/PrimaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/PrimaryButton.js +67 -79
- package/dist/commonjs/button/lib/SecondaryButton.d.ts +16 -43
- package/dist/commonjs/button/lib/SecondaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/SecondaryButton.js +71 -96
- package/dist/commonjs/button/lib/TertiaryButton.d.ts +35 -47
- package/dist/commonjs/button/lib/TertiaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/TertiaryButton.js +136 -134
- package/dist/commonjs/button/lib/ToolbarDropdownButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/ToolbarDropdownButton.js +11 -2
- package/dist/commonjs/button/lib/ToolbarIconButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/ToolbarIconButton.js +10 -2
- package/dist/commonjs/button/lib/parts/ButtonLabelIcon.d.ts +1 -7
- package/dist/commonjs/button/lib/parts/ButtonLabelIcon.d.ts.map +1 -1
- package/dist/commonjs/button/lib/types.d.ts +6 -7
- package/dist/commonjs/button/lib/types.d.ts.map +1 -1
- package/dist/commonjs/card/lib/Card.d.ts +1 -1
- package/dist/commonjs/card/lib/CardBody.d.ts +1 -1
- package/dist/commonjs/card/lib/CardBody.d.ts.map +1 -1
- package/dist/commonjs/checkbox/lib/Checkbox.d.ts.map +1 -1
- package/dist/commonjs/checkbox/lib/Checkbox.js +13 -17
- package/dist/commonjs/common/lib/CanvasProvider.d.ts +1 -8
- package/dist/commonjs/common/lib/CanvasProvider.d.ts.map +1 -1
- package/dist/commonjs/common/lib/CanvasProvider.js +31 -13
- package/dist/commonjs/dialog/lib/Dialog.d.ts +1 -1
- package/dist/commonjs/layout/lib/Box.d.ts +3 -2
- package/dist/commonjs/layout/lib/Box.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/Box.js +2 -1
- package/dist/commonjs/layout/lib/Flex.d.ts +1 -1
- package/dist/commonjs/layout/lib/Grid.d.ts +1 -1
- package/dist/commonjs/menu/lib/MenuItem.d.ts +1 -1
- package/dist/commonjs/popup/lib/Popup.d.ts +1 -1
- package/dist/commonjs/popup/lib/PopupBody.d.ts +1 -1
- package/dist/commonjs/popup/lib/PopupCloseIcon.js +1 -1
- package/dist/commonjs/radio/lib/Radio.d.ts.map +1 -1
- package/dist/commonjs/radio/lib/Radio.js +17 -22
- package/dist/commonjs/segmented-control/lib/SegmentedControlButton.d.ts.map +1 -1
- package/dist/commonjs/segmented-control/lib/SegmentedControlButton.js +3 -1
- package/dist/commonjs/table/lib/Table.d.ts +1 -2
- package/dist/commonjs/table/lib/Table.d.ts.map +1 -1
- package/dist/commonjs/table/lib/Table.js +1 -2
- package/dist/commonjs/table/lib/TableRow.d.ts +3 -6
- package/dist/commonjs/table/lib/TableRow.d.ts.map +1 -1
- package/dist/commonjs/table/lib/TableRow.js +3 -5
- package/dist/commonjs/tabs/lib/TabsItem.d.ts +1 -1
- package/dist/commonjs/text-area/lib/TextArea.d.ts.map +1 -1
- package/dist/commonjs/text-area/lib/TextArea.js +1 -1
- package/dist/commonjs/text-input/lib/TextInput.js +1 -1
- package/dist/commonjs/tokens/lib/space.d.ts +44 -31
- package/dist/commonjs/tokens/lib/space.d.ts.map +1 -1
- package/dist/commonjs/tokens/lib/space.js +22 -29
- package/dist/commonjs/tooltip/lib/TooltipContainer.js +2 -2
- package/dist/es6/button/index.d.ts +8 -5
- package/dist/es6/button/index.d.ts.map +1 -1
- package/dist/es6/button/index.js +8 -5
- package/dist/es6/button/lib/BaseButton.d.ts +69 -5
- package/dist/es6/button/lib/BaseButton.d.ts.map +1 -1
- package/dist/es6/button/lib/BaseButton.js +199 -192
- package/dist/es6/button/lib/Button.d.ts +17 -0
- package/dist/es6/button/lib/Button.d.ts.map +1 -0
- package/dist/es6/button/lib/Button.js +20 -0
- package/dist/es6/button/lib/DeleteButton.d.ts +7 -9
- package/dist/es6/button/lib/DeleteButton.d.ts.map +1 -1
- package/dist/es6/button/lib/DeleteButton.js +31 -21
- package/dist/es6/button/lib/PrimaryButton.d.ts +15 -36
- package/dist/es6/button/lib/PrimaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/PrimaryButton.js +67 -79
- package/dist/es6/button/lib/SecondaryButton.d.ts +16 -43
- package/dist/es6/button/lib/SecondaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/SecondaryButton.js +71 -95
- package/dist/es6/button/lib/TertiaryButton.d.ts +35 -47
- package/dist/es6/button/lib/TertiaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/TertiaryButton.js +137 -135
- package/dist/es6/button/lib/ToolbarDropdownButton.d.ts.map +1 -1
- package/dist/es6/button/lib/ToolbarDropdownButton.js +11 -2
- package/dist/es6/button/lib/ToolbarIconButton.d.ts.map +1 -1
- package/dist/es6/button/lib/ToolbarIconButton.js +10 -2
- package/dist/es6/button/lib/parts/ButtonLabelIcon.d.ts +1 -7
- package/dist/es6/button/lib/parts/ButtonLabelIcon.d.ts.map +1 -1
- package/dist/es6/button/lib/types.d.ts +6 -7
- package/dist/es6/button/lib/types.d.ts.map +1 -1
- package/dist/es6/card/lib/Card.d.ts +1 -1
- package/dist/es6/card/lib/CardBody.d.ts +1 -1
- package/dist/es6/card/lib/CardBody.d.ts.map +1 -1
- package/dist/es6/checkbox/lib/Checkbox.d.ts.map +1 -1
- package/dist/es6/checkbox/lib/Checkbox.js +14 -18
- package/dist/es6/common/lib/CanvasProvider.d.ts +1 -8
- package/dist/es6/common/lib/CanvasProvider.d.ts.map +1 -1
- package/dist/es6/common/lib/CanvasProvider.js +31 -13
- package/dist/es6/dialog/lib/Dialog.d.ts +1 -1
- package/dist/es6/layout/lib/Box.d.ts +3 -2
- package/dist/es6/layout/lib/Box.d.ts.map +1 -1
- package/dist/es6/layout/lib/Box.js +2 -1
- package/dist/es6/layout/lib/Flex.d.ts +1 -1
- package/dist/es6/layout/lib/Grid.d.ts +1 -1
- package/dist/es6/menu/lib/MenuItem.d.ts +1 -1
- package/dist/es6/popup/lib/Popup.d.ts +1 -1
- package/dist/es6/popup/lib/PopupBody.d.ts +1 -1
- package/dist/es6/popup/lib/PopupCloseIcon.js +1 -1
- package/dist/es6/radio/lib/Radio.d.ts.map +1 -1
- package/dist/es6/radio/lib/Radio.js +18 -23
- package/dist/es6/segmented-control/lib/SegmentedControlButton.d.ts.map +1 -1
- package/dist/es6/segmented-control/lib/SegmentedControlButton.js +3 -1
- package/dist/es6/table/lib/Table.d.ts +1 -2
- package/dist/es6/table/lib/Table.d.ts.map +1 -1
- package/dist/es6/table/lib/Table.js +1 -2
- package/dist/es6/table/lib/TableRow.d.ts +3 -6
- package/dist/es6/table/lib/TableRow.d.ts.map +1 -1
- package/dist/es6/table/lib/TableRow.js +4 -6
- package/dist/es6/tabs/lib/TabsItem.d.ts +1 -1
- package/dist/es6/text-area/lib/TextArea.d.ts.map +1 -1
- package/dist/es6/text-area/lib/TextArea.js +2 -2
- package/dist/es6/text-input/lib/TextInput.js +2 -2
- package/dist/es6/tokens/lib/space.d.ts +44 -31
- package/dist/es6/tokens/lib/space.d.ts.map +1 -1
- package/dist/es6/tokens/lib/space.js +22 -29
- package/dist/es6/tooltip/lib/TooltipContainer.js +3 -3
- package/layout/lib/Box.tsx +6 -4
- package/package.json +5 -3
- package/popup/lib/PopupCloseIcon.tsx +1 -1
- package/radio/lib/Radio.tsx +18 -34
- package/segmented-control/lib/SegmentedControlButton.tsx +3 -1
- package/table/lib/Table.tsx +1 -2
- package/table/lib/TableRow.tsx +5 -8
- package/text-area/lib/TextArea.tsx +2 -8
- package/text-input/lib/TextInput.tsx +2 -2
- package/tokens/README.md +25 -28
- package/tokens/lib/space.ts +53 -40
- package/tooltip/lib/TooltipContainer.tsx +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { createComponent, ErrorType, errorRing, styled, } from '@workday/canvas-kit-react/common';
|
|
3
|
-
import { borderRadius, inputColors,
|
|
3
|
+
import { borderRadius, inputColors, space, type } from '@workday/canvas-kit-react/tokens';
|
|
4
4
|
const StyledTextInput = styled('input')({
|
|
5
5
|
...type.levels.subtext.large,
|
|
6
6
|
border: `1px solid ${inputColors.border}`,
|
|
@@ -10,7 +10,7 @@ const StyledTextInput = styled('input')({
|
|
|
10
10
|
boxSizing: 'border-box',
|
|
11
11
|
height: 40,
|
|
12
12
|
transition: '0.2s box-shadow, 0.2s border-color',
|
|
13
|
-
padding:
|
|
13
|
+
padding: space.xxs,
|
|
14
14
|
margin: 0,
|
|
15
15
|
'&::placeholder': {
|
|
16
16
|
color: inputColors.placeholder,
|
|
@@ -37,46 +37,59 @@ export declare type CanvasSpaceValues = ValueOf<CanvasSpace>;
|
|
|
37
37
|
*
|
|
38
38
|
* */
|
|
39
39
|
export declare const space: CanvasSpace;
|
|
40
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Example using `space` with calc instead of deprecated `spaceNumbers`.
|
|
42
|
+
*
|
|
43
|
+
* ```tsx
|
|
44
|
+
* // With deprecated `spaceNumbers`
|
|
45
|
+
* {
|
|
46
|
+
* paddingLeft: spaceNumbers.xl + 2 // 42px
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* ```tsx
|
|
51
|
+
* // With `rem` based `space` tokens
|
|
52
|
+
* {
|
|
53
|
+
* padding: `calc(${space.xl} + 2px)` // 42px
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @deprecated ⚠️ `spaceNumbers` has been deprecated in a future major version. Please use our `rem` based [`space`](https://workday.github.io/canvas-kit/?path=/docs/tokens--space) tokens. In the case where you need to calculate a value, use [CSS calc()](https://developer.mozilla.org/en-US/docs/Web/CSS/calc).
|
|
58
|
+
*/
|
|
41
59
|
export declare type CanvasSpaceNumbers = {
|
|
42
60
|
zero: 0;
|
|
43
|
-
xxxs:
|
|
44
|
-
xxs:
|
|
45
|
-
xs:
|
|
46
|
-
s:
|
|
47
|
-
m:
|
|
48
|
-
l:
|
|
49
|
-
xl:
|
|
50
|
-
xxl:
|
|
51
|
-
xxxl:
|
|
61
|
+
xxxs: 4;
|
|
62
|
+
xxs: 8;
|
|
63
|
+
xs: 12;
|
|
64
|
+
s: 16;
|
|
65
|
+
m: 24;
|
|
66
|
+
l: 32;
|
|
67
|
+
xl: 40;
|
|
68
|
+
xxl: 64;
|
|
69
|
+
xxxl: 80;
|
|
52
70
|
};
|
|
53
|
-
/** The numeric rem values for CanvasSpaceNumbers (numbers)
|
|
71
|
+
/** The numeric rem values for CanvasSpaceNumbers (numbers)
|
|
72
|
+
* @deprecated ⚠️ `CanvasSpaceNumberValues` has been deprecated in a future major version. Please use our `rem` based [`space`](https://workday.github.io/canvas-kit/?path=/docs/tokens--space) tokens. In the case where you need to calculate a value, use [CSS calc()](https://developer.mozilla.org/en-US/docs/Web/CSS/calc).
|
|
73
|
+
*/
|
|
54
74
|
export declare type CanvasSpaceNumberValues = ValueOf<CanvasSpaceNumbers>;
|
|
55
75
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* - Here's an example usage to perform calculations:
|
|
59
|
-
* @example
|
|
76
|
+
* Example using `space` with calc instead of deprecated `spaceNumbers`.
|
|
77
|
+
*
|
|
60
78
|
* ```tsx
|
|
61
|
-
*
|
|
79
|
+
* // With deprecated `spaceNumbers`
|
|
80
|
+
* {
|
|
81
|
+
* paddingLeft: spaceNumbers.xl + 2 // 42px
|
|
82
|
+
* }
|
|
62
83
|
* ```
|
|
63
84
|
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* | 4px | 0.25rem | xxxs |
|
|
71
|
-
* | 8px | 0.5rem | xxs |
|
|
72
|
-
* | 12px | 0.75rem | xs |
|
|
73
|
-
* | 16px | 1rem | s |
|
|
74
|
-
* | 24px | 1.5rem | m |
|
|
75
|
-
* | 32px | 2rem | l |
|
|
76
|
-
* | 40px | 2.5rem | xl |
|
|
77
|
-
* | 64px | 4rem | xxl |
|
|
78
|
-
* | 80px | 5rem | xxxl |
|
|
85
|
+
* ```tsx
|
|
86
|
+
* // With `rem` based `space` tokens
|
|
87
|
+
* {
|
|
88
|
+
* padding: `calc(${space.xl} + 2px)` // 42px
|
|
89
|
+
* }
|
|
90
|
+
* ```
|
|
79
91
|
*
|
|
92
|
+
* @deprecated ⚠️ `spaceNumbers` has been deprecated in a future major version. Please use our `rem` based [`space`](https://workday.github.io/canvas-kit/?path=/docs/tokens--space) tokens. In the case where you need to calculate a value, use [CSS calc()](https://developer.mozilla.org/en-US/docs/Web/CSS/calc).
|
|
80
93
|
*/
|
|
81
94
|
export declare const spaceNumbers: CanvasSpaceNumbers;
|
|
82
95
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../../../tokens/lib/space.ts"],"names":[],"mappings":"AAAA,aAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAO7B,qEAAqE;AACrE,oBAAY,WAAW,GAAG;IACxB,IAAI,EAAE,GAAG,CAAC;IACV,IAAI,EAAE,SAAS,CAAC;IAChB,GAAG,EAAE,QAAQ,CAAC;IACd,EAAE,EAAE,SAAS,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,QAAQ,CAAC;IACZ,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,QAAQ,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,kCAAkC;AAClC,oBAAY,eAAe,GAAG,MAAM,WAAW,CAAC;AAEhD,+CAA+C;AAC/C,oBAAY,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAErD;;;;;;;;;;;;;;;;;;;KAmBK;AACL,eAAO,MAAM,KAAK,EAAE,WAWnB,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../../../tokens/lib/space.ts"],"names":[],"mappings":"AAAA,aAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAO7B,qEAAqE;AACrE,oBAAY,WAAW,GAAG;IACxB,IAAI,EAAE,GAAG,CAAC;IACV,IAAI,EAAE,SAAS,CAAC;IAChB,GAAG,EAAE,QAAQ,CAAC;IACd,EAAE,EAAE,SAAS,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,QAAQ,CAAC;IACZ,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,QAAQ,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,kCAAkC;AAClC,oBAAY,eAAe,GAAG,MAAM,WAAW,CAAC;AAEhD,+CAA+C;AAC/C,oBAAY,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAErD;;;;;;;;;;;;;;;;;;;KAmBK;AACL,eAAO,MAAM,KAAK,EAAE,WAWnB,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,oBAAY,kBAAkB,GAAG;IAC/B,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,EAAE,CAAC,CAAC;IACR,GAAG,EAAE,CAAC,CAAC;IACP,EAAE,EAAE,EAAE,CAAC;IACP,CAAC,EAAE,EAAE,CAAC;IACN,CAAC,EAAE,EAAE,CAAC;IACN,CAAC,EAAE,EAAE,CAAC;IACN,EAAE,EAAE,EAAE,CAAC;IACP,GAAG,EAAE,EAAE,CAAC;IACR,IAAI,EAAE,EAAE,CAAC;CACV,CAAC;AAEF;;GAEG;AACH,oBAAY,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAElE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,YAAY,EAAE,kBAW1B,CAAC"}
|
|
@@ -31,40 +31,33 @@ export const space = {
|
|
|
31
31
|
xxxl: '5rem',
|
|
32
32
|
};
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* - Here's an example usage to perform calculations:
|
|
37
|
-
* @example
|
|
34
|
+
* Example using `space` with calc instead of deprecated `spaceNumbers`.
|
|
35
|
+
*
|
|
38
36
|
* ```tsx
|
|
39
|
-
*
|
|
37
|
+
* // With deprecated `spaceNumbers`
|
|
38
|
+
* {
|
|
39
|
+
* paddingLeft: spaceNumbers.xl + 2 // 42px
|
|
40
|
+
* }
|
|
40
41
|
* ```
|
|
41
42
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* | 4px | 0.25rem | xxxs |
|
|
49
|
-
* | 8px | 0.5rem | xxs |
|
|
50
|
-
* | 12px | 0.75rem | xs |
|
|
51
|
-
* | 16px | 1rem | s |
|
|
52
|
-
* | 24px | 1.5rem | m |
|
|
53
|
-
* | 32px | 2rem | l |
|
|
54
|
-
* | 40px | 2.5rem | xl |
|
|
55
|
-
* | 64px | 4rem | xxl |
|
|
56
|
-
* | 80px | 5rem | xxxl |
|
|
43
|
+
* ```tsx
|
|
44
|
+
* // With `rem` based `space` tokens
|
|
45
|
+
* {
|
|
46
|
+
* padding: `calc(${space.xl} + 2px)` // 42px
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
57
49
|
*
|
|
50
|
+
* @deprecated ⚠️ `spaceNumbers` has been deprecated in a future major version. Please use our `rem` based [`space`](https://workday.github.io/canvas-kit/?path=/docs/tokens--space) tokens. In the case where you need to calculate a value, use [CSS calc()](https://developer.mozilla.org/en-US/docs/Web/CSS/calc).
|
|
58
51
|
*/
|
|
59
52
|
export const spaceNumbers = {
|
|
60
53
|
zero: 0,
|
|
61
|
-
xxxs:
|
|
62
|
-
xxs:
|
|
63
|
-
xs:
|
|
64
|
-
s:
|
|
65
|
-
m:
|
|
66
|
-
l:
|
|
67
|
-
xl:
|
|
68
|
-
xxl:
|
|
69
|
-
xxxl:
|
|
54
|
+
xxxs: 4,
|
|
55
|
+
xxs: 8,
|
|
56
|
+
xs: 12,
|
|
57
|
+
s: 16,
|
|
58
|
+
m: 24,
|
|
59
|
+
l: 32,
|
|
60
|
+
xl: 40,
|
|
61
|
+
xxl: 64,
|
|
62
|
+
xxxl: 80,
|
|
70
63
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { keyframes } from '@emotion/react';
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
|
-
import { borderRadius, colors, space,
|
|
3
|
+
import { borderRadius, colors, space, type } from '@workday/canvas-kit-react/tokens';
|
|
4
4
|
import { getTranslateFromOrigin } from '@workday/canvas-kit-react/common';
|
|
5
5
|
const tooltipAnimation = (transformOrigin) => {
|
|
6
6
|
const translate = getTranslateFromOrigin(transformOrigin, space.xxxs);
|
|
@@ -44,9 +44,9 @@ export const TooltipContainer = styled('div')({
|
|
|
44
44
|
},
|
|
45
45
|
// offset tooltips by 2 pixels when a keyboard focus ring is detected
|
|
46
46
|
'[data-whatinput=keyboard] &': {
|
|
47
|
-
padding:
|
|
47
|
+
padding: `calc(${space.s} - 0.125rem)`,
|
|
48
48
|
':before': {
|
|
49
|
-
margin:
|
|
49
|
+
margin: `calc(${space.xxxs} + 0.125rem)`,
|
|
50
50
|
},
|
|
51
51
|
},
|
|
52
52
|
// Hide tooltip when the reference element is either clipped or fully hidden
|
package/layout/lib/Box.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
3
|
import isPropValid from '@emotion/is-prop-valid';
|
|
4
4
|
import {createComponent, StyledType, useConstant} from '@workday/canvas-kit-react/common';
|
|
5
|
+
import {CSProps, handleCsProp} from '@workday/canvas-kit-styling';
|
|
5
6
|
|
|
6
7
|
// style props
|
|
7
8
|
import {background} from './utils/background';
|
|
@@ -34,9 +35,10 @@ import {CommonStyleProps} from './utils/styleProps';
|
|
|
34
35
|
* - space
|
|
35
36
|
* - text
|
|
36
37
|
*/
|
|
37
|
-
export type BoxProps = CommonStyleProps &
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
export type BoxProps = CommonStyleProps &
|
|
39
|
+
CSProps & {
|
|
40
|
+
children?: React.ReactNode;
|
|
41
|
+
};
|
|
40
42
|
|
|
41
43
|
const omittedProps = [
|
|
42
44
|
'display',
|
|
@@ -142,7 +144,7 @@ export const Box = createComponent('div')({
|
|
|
142
144
|
);
|
|
143
145
|
|
|
144
146
|
return (
|
|
145
|
-
<BoxComponent as={Element} ref={ref} {...elemProps}>
|
|
147
|
+
<BoxComponent as={Element} ref={ref} {...handleCsProp(elemProps)}>
|
|
146
148
|
{children}
|
|
147
149
|
</BoxComponent>
|
|
148
150
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-react",
|
|
3
|
-
"version": "10.0.0-alpha.
|
|
3
|
+
"version": "10.0.0-alpha.540-next.0",
|
|
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,8 +49,10 @@
|
|
|
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": "^10.0.0-alpha.
|
|
52
|
+
"@workday/canvas-kit-popup-stack": "^10.0.0-alpha.540-next.0",
|
|
53
|
+
"@workday/canvas-kit-styling": "^10.0.0-alpha.540-next.0",
|
|
53
54
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
55
|
+
"@workday/canvas-tokens-web": "0.1.6",
|
|
54
56
|
"@workday/design-assets-types": "^0.2.8",
|
|
55
57
|
"chroma-js": "^2.1.0",
|
|
56
58
|
"csstype": "^3.0.2",
|
|
@@ -66,5 +68,5 @@
|
|
|
66
68
|
"@workday/canvas-accent-icons-web": "^3.0.0",
|
|
67
69
|
"@workday/canvas-applet-icons-web": "^2.0.0"
|
|
68
70
|
},
|
|
69
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "fc8abdabca2c55aad11f09a8f05570bd55aa3478"
|
|
70
72
|
}
|
package/radio/lib/Radio.tsx
CHANGED
|
@@ -8,13 +8,7 @@ import {
|
|
|
8
8
|
Themeable,
|
|
9
9
|
useUniqueId,
|
|
10
10
|
} from '@workday/canvas-kit-react/common';
|
|
11
|
-
import {
|
|
12
|
-
borderRadius,
|
|
13
|
-
colors,
|
|
14
|
-
inputColors,
|
|
15
|
-
space,
|
|
16
|
-
spaceNumbers,
|
|
17
|
-
} from '@workday/canvas-kit-react/tokens';
|
|
11
|
+
import {borderRadius, colors, inputColors, space} from '@workday/canvas-kit-react/tokens';
|
|
18
12
|
import {LabelText} from '@workday/canvas-kit-react/text';
|
|
19
13
|
|
|
20
14
|
export interface RadioProps extends Themeable {
|
|
@@ -53,19 +47,12 @@ export interface RadioProps extends Themeable {
|
|
|
53
47
|
variant?: 'inverse' | undefined;
|
|
54
48
|
}
|
|
55
49
|
|
|
56
|
-
const radioBorderRadius =
|
|
57
|
-
const radioDot = space.xxs;
|
|
58
|
-
const radioHeight = (spaceNumbers.xl - spaceNumbers.xxxs) / 2;
|
|
59
|
-
const radioTapArea = space.m;
|
|
60
|
-
const radioContainerHeight = radioTapArea;
|
|
61
|
-
const radioLabelDistance = space.xs;
|
|
62
|
-
const radioWidth = radioHeight;
|
|
63
|
-
const rippleRadius = (spaceNumbers.l - radioWidth) / 2;
|
|
50
|
+
const radioBorderRadius = 9;
|
|
64
51
|
|
|
65
52
|
const RadioContainer = styled('div')({
|
|
66
53
|
display: 'flex',
|
|
67
54
|
alignItems: 'center',
|
|
68
|
-
minHeight:
|
|
55
|
+
minHeight: space.m,
|
|
69
56
|
position: 'relative',
|
|
70
57
|
});
|
|
71
58
|
|
|
@@ -76,17 +63,17 @@ const RadioContainer = styled('div')({
|
|
|
76
63
|
*/
|
|
77
64
|
const RadioInputWrapper = styled('div')<Pick<RadioProps, 'disabled'>>({
|
|
78
65
|
display: 'flex',
|
|
79
|
-
height:
|
|
80
|
-
width:
|
|
66
|
+
height: `calc(${space.s} + 2px)`,
|
|
67
|
+
width: `calc(${space.s} + 2px)`,
|
|
81
68
|
});
|
|
82
69
|
|
|
83
70
|
const RadioRipple = styled('span')<Pick<RadioProps, 'disabled' | 'variant'>>(
|
|
84
71
|
{
|
|
85
72
|
borderRadius: borderRadius.circle,
|
|
86
73
|
boxShadow: `0 0 0 0 ${colors.soap200}`,
|
|
87
|
-
height:
|
|
74
|
+
height: `calc(${space.s} + 2px)`,
|
|
88
75
|
transition: 'box-shadow 150ms ease-out',
|
|
89
|
-
width:
|
|
76
|
+
width: `calc(${space.s} + 2px)`,
|
|
90
77
|
position: 'absolute',
|
|
91
78
|
pointerEvents: 'none', // This is a decorative element we don't want it to block clicks to input
|
|
92
79
|
},
|
|
@@ -97,9 +84,9 @@ const RadioRipple = styled('span')<Pick<RadioProps, 'disabled' | 'variant'>>(
|
|
|
97
84
|
|
|
98
85
|
const RadioInput = styled('input')<RadioProps & StyledType>(
|
|
99
86
|
{
|
|
100
|
-
borderRadius:
|
|
101
|
-
width:
|
|
102
|
-
height:
|
|
87
|
+
borderRadius: `calc(${space.xxs} + 1px)`,
|
|
88
|
+
width: space.m,
|
|
89
|
+
height: space.m,
|
|
103
90
|
margin: 0,
|
|
104
91
|
marginTop: '-3px',
|
|
105
92
|
marginLeft: '-3px',
|
|
@@ -135,7 +122,9 @@ const RadioInput = styled('input')<RadioProps & StyledType>(
|
|
|
135
122
|
// `span:first-of-type` refers to `RadioRipple`, the light grey
|
|
136
123
|
// element that animates around the component on hover
|
|
137
124
|
'&:hover ~ span:first-of-type': {
|
|
138
|
-
boxShadow: disabled
|
|
125
|
+
boxShadow: disabled
|
|
126
|
+
? undefined
|
|
127
|
+
: `0 0 0 calc((${space.l} - (${space.s} + 2px)) / 2) ${colors.soap200}`,
|
|
139
128
|
},
|
|
140
129
|
|
|
141
130
|
// `div:first-of-type` refers to the `RadioBackground`, the visual facade of the
|
|
@@ -218,13 +207,13 @@ const RadioBackground = styled('div')<RadioProps>(
|
|
|
218
207
|
borderWidth: '1px',
|
|
219
208
|
boxSizing: 'border-box',
|
|
220
209
|
display: 'flex',
|
|
221
|
-
height:
|
|
210
|
+
height: `calc(${space.s} + 2px)`,
|
|
222
211
|
justifyContent: 'center',
|
|
223
212
|
padding: '0px 2px',
|
|
224
213
|
pointerEvents: 'none',
|
|
225
214
|
position: 'absolute',
|
|
226
215
|
transition: 'border 200ms ease, background 200ms',
|
|
227
|
-
width:
|
|
216
|
+
width: `calc(${space.s} + 2px)`,
|
|
228
217
|
},
|
|
229
218
|
({
|
|
230
219
|
checked,
|
|
@@ -261,10 +250,10 @@ const RadioCheck = styled('div')<Pick<RadioProps, 'checked' | 'variant'>>(
|
|
|
261
250
|
borderRadius: radioBorderRadius,
|
|
262
251
|
display: 'flex',
|
|
263
252
|
flexDirection: 'column',
|
|
264
|
-
height:
|
|
253
|
+
height: space.xxs,
|
|
265
254
|
pointerEvents: 'none',
|
|
266
255
|
transition: 'transform 200ms ease, opacity 200ms ease',
|
|
267
|
-
width:
|
|
256
|
+
width: space.xxs,
|
|
268
257
|
},
|
|
269
258
|
({theme, variant}) => ({
|
|
270
259
|
backgroundColor:
|
|
@@ -319,12 +308,7 @@ export const Radio = createComponent('input')({
|
|
|
319
308
|
</RadioBackground>
|
|
320
309
|
</RadioInputWrapper>
|
|
321
310
|
{label && (
|
|
322
|
-
<LabelText
|
|
323
|
-
paddingLeft={radioLabelDistance}
|
|
324
|
-
htmlFor={inputId}
|
|
325
|
-
disabled={disabled}
|
|
326
|
-
variant={variant}
|
|
327
|
-
>
|
|
311
|
+
<LabelText paddingLeft={space.xs} htmlFor={inputId} disabled={disabled} variant={variant}>
|
|
328
312
|
{label}
|
|
329
313
|
</LabelText>
|
|
330
314
|
)}
|
|
@@ -29,11 +29,13 @@ const getIconButtonColors = (toggled?: boolean): ButtonColors => {
|
|
|
29
29
|
icon: toggled ? colors.frenchVanilla100 : colors.licorice500,
|
|
30
30
|
},
|
|
31
31
|
focus: {
|
|
32
|
-
background: toggled ? colors.blueberry400 :
|
|
32
|
+
background: toggled ? colors.blueberry400 : colors.soap200,
|
|
33
33
|
icon: toggled ? colors.frenchVanilla100 : colors.licorice500,
|
|
34
|
+
border: toggled ? 'transparent' : colors.soap500,
|
|
34
35
|
},
|
|
35
36
|
disabled: {
|
|
36
37
|
background: toggled ? colors.soap100 : colors.soap100,
|
|
38
|
+
border: colors.soap500,
|
|
37
39
|
icon: colors.soap600,
|
|
38
40
|
opacity: '1',
|
|
39
41
|
},
|
package/table/lib/Table.tsx
CHANGED
|
@@ -17,8 +17,7 @@ const TableComponent = styled('table')(type.levels.subtext.large, {
|
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* @deprecated ⚠️ `Table` has been deprecated and will be removed in a future major version.
|
|
21
|
-
* Please consider using [`Table in Preview`](https://workday.github.io/canvas-kit/?path=/docs/preview-table--basic) instead.
|
|
20
|
+
* @deprecated ⚠️ `Table` has been deprecated and will be removed in a future major version. Please use [`Table`](https://workday.github.io/canvas-kit/?path=/docs/preview-table--basic) in Preview instead.
|
|
22
21
|
*/
|
|
23
22
|
export class Table extends React.Component<React.TableHTMLAttributes<HTMLTableElement>> {
|
|
24
23
|
public render() {
|
package/table/lib/TableRow.tsx
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import styled, {CSSObject} from '@emotion/styled';
|
|
3
3
|
import {rgba} from 'polished';
|
|
4
|
-
import {colors, space,
|
|
4
|
+
import {colors, space, statusColors} from '@workday/canvas-kit-react/tokens';
|
|
5
5
|
import {createComponent, StyledType} from '@workday/canvas-kit-react/common';
|
|
6
6
|
import {borderColor, borderWidth, cellBorder} from './Table';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* @deprecated ⚠️ `Table` has been deprecated and will be removed in a future major version.
|
|
10
|
-
* Please consider using [`Table in Preview`](https://workday.github.io/canvas-kit/?path=/docs/preview-table--basic) instead.
|
|
9
|
+
* @deprecated ⚠️ `Table` has been deprecated and will be removed in a future major version. Please use [`Table`](https://workday.github.io/canvas-kit/?path=/docs/preview-table--basic) in Preview instead.
|
|
11
10
|
*/
|
|
12
11
|
export enum TableRowState {
|
|
13
12
|
Error,
|
|
@@ -19,8 +18,7 @@ export enum TableRowState {
|
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
|
-
* @deprecated ⚠️ `Table` has been deprecated and will be removed in a future major version.
|
|
23
|
-
* Please consider using [`Table in Preview`](https://workday.github.io/canvas-kit/?path=/docs/preview-table--basic) instead.
|
|
21
|
+
* @deprecated ⚠️ `Table` has been deprecated and will be removed in a future major version. Please use [`Table`](https://workday.github.io/canvas-kit/?path=/docs/preview-table--basic) in Preview instead.
|
|
24
22
|
*/
|
|
25
23
|
export interface TableRowProps extends React.HTMLAttributes<HTMLTableRowElement> {
|
|
26
24
|
/**
|
|
@@ -108,7 +106,7 @@ const StyledTableRow = styled('tr')<TableRowProps>(
|
|
|
108
106
|
fontSize: 13,
|
|
109
107
|
borderRight: cellBorder,
|
|
110
108
|
borderBottom: cellBorder,
|
|
111
|
-
height:
|
|
109
|
+
height: `calc(${space.xl} + ${space.xxs})`,
|
|
112
110
|
boxSizing: 'border-box',
|
|
113
111
|
transition: 'background-color 0.2s',
|
|
114
112
|
},
|
|
@@ -201,8 +199,7 @@ const StyledTableRow = styled('tr')<TableRowProps>(
|
|
|
201
199
|
);
|
|
202
200
|
|
|
203
201
|
/**
|
|
204
|
-
* @deprecated ⚠️ `Table` has been deprecated and will be removed in a future major version.
|
|
205
|
-
* Please consider using [`Table in Preview`](https://workday.github.io/canvas-kit/?path=/docs/preview-table--basic) instead.
|
|
202
|
+
* @deprecated ⚠️ `Table` has been deprecated and will be removed in a future major version. Please use [`Table`](https://workday.github.io/canvas-kit/?path=/docs/preview-table--basic) in Preview instead.
|
|
206
203
|
*/
|
|
207
204
|
export const TableRow = createComponent('tr')({
|
|
208
205
|
displayName: 'TableRow',
|
|
@@ -8,13 +8,7 @@ import {
|
|
|
8
8
|
styled,
|
|
9
9
|
Themeable,
|
|
10
10
|
} from '@workday/canvas-kit-react/common';
|
|
11
|
-
import {
|
|
12
|
-
borderRadius,
|
|
13
|
-
inputColors,
|
|
14
|
-
space,
|
|
15
|
-
spaceNumbers,
|
|
16
|
-
type,
|
|
17
|
-
} from '@workday/canvas-kit-react/tokens';
|
|
11
|
+
import {borderRadius, inputColors, space, type} from '@workday/canvas-kit-react/tokens';
|
|
18
12
|
|
|
19
13
|
export interface TextAreaProps extends Themeable, GrowthBehavior {
|
|
20
14
|
/**
|
|
@@ -66,7 +60,7 @@ const StyledTextArea = styled('textarea')<TextAreaProps & StyledType>(
|
|
|
66
60
|
borderRadius: borderRadius.m,
|
|
67
61
|
boxSizing: 'border-box',
|
|
68
62
|
minHeight: space.xxl,
|
|
69
|
-
minWidth:
|
|
63
|
+
minWidth: `calc((${space.xxxl} * 3) + ${space.xl})`,
|
|
70
64
|
transition: '0.2s box-shadow, 0.2s border-color',
|
|
71
65
|
padding: space.xxs, // Compensate for border
|
|
72
66
|
margin: 0, // Fix Safari
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
styled,
|
|
9
9
|
Themeable,
|
|
10
10
|
} from '@workday/canvas-kit-react/common';
|
|
11
|
-
import {borderRadius, inputColors,
|
|
11
|
+
import {borderRadius, inputColors, space, type} from '@workday/canvas-kit-react/tokens';
|
|
12
12
|
|
|
13
13
|
export interface TextInputProps extends Themeable, GrowthBehavior {
|
|
14
14
|
/**
|
|
@@ -33,7 +33,7 @@ const StyledTextInput = styled('input')<
|
|
|
33
33
|
boxSizing: 'border-box',
|
|
34
34
|
height: 40,
|
|
35
35
|
transition: '0.2s box-shadow, 0.2s border-color',
|
|
36
|
-
padding:
|
|
36
|
+
padding: space.xxs, // Compensate for border
|
|
37
37
|
margin: 0, // Fix Safari
|
|
38
38
|
'&::placeholder': {
|
|
39
39
|
color: inputColors.placeholder,
|
package/tokens/README.md
CHANGED
|
@@ -130,45 +130,42 @@ Border Radius variables are in a "t-shirt size" format. Border Radius values are
|
|
|
130
130
|
|
|
131
131
|
## Space
|
|
132
132
|
|
|
133
|
-
Space variables are in a "t-shirt size" format. Space values are in `
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
|
137
|
-
|
|
|
138
|
-
| `xxxs` | `'0.25rem'` | `
|
|
139
|
-
| `xxs` | `'0.5rem'` | `
|
|
140
|
-
| `xs` | `'0.75rem'` | `
|
|
141
|
-
| `s` | `'1rem'` | `
|
|
142
|
-
| `m` | `'1.5rem'` | `
|
|
143
|
-
| `l` | `'2rem'` | `
|
|
144
|
-
| `xl` | `'2.5rem'` | `
|
|
145
|
-
| `xxl` | `'4rem'` | `
|
|
146
|
-
| `xxxl` | `'5rem'` | `
|
|
147
|
-
|
|
148
|
-
The following space types are also provided: `CanvasSpace`, `CanvasSpaceValues
|
|
149
|
-
`CanvasSpaceNumbers`, `CanvasSpaceNumberValues`
|
|
133
|
+
Space variables are in a "t-shirt size" format. Space values are in `rem` format (`space`)
|
|
134
|
+
|
|
135
|
+
| Variable | Size (rem) | Size (calculated pixels) |
|
|
136
|
+
| -------- | ----------- | ------------------------ |
|
|
137
|
+
| `zero` | `'0rem'` | `0px` |
|
|
138
|
+
| `xxxs` | `'0.25rem'` | `4px` |
|
|
139
|
+
| `xxs` | `'0.5rem'` | `8px` |
|
|
140
|
+
| `xs` | `'0.75rem'` | `12px` |
|
|
141
|
+
| `s` | `'1rem'` | `16px` |
|
|
142
|
+
| `m` | `'1.5rem'` | `24px` |
|
|
143
|
+
| `l` | `'2rem'` | `32px` |
|
|
144
|
+
| `xl` | `'2.5rem'` | `40px` |
|
|
145
|
+
| `xxl` | `'4rem'` | `64px` |
|
|
146
|
+
| `xxxl` | `'5rem'` | `80px` |
|
|
147
|
+
|
|
148
|
+
The following space types are also provided: `CanvasSpace`, `CanvasSpaceValues`.
|
|
150
149
|
|
|
151
150
|
Below are descriptions of these types:
|
|
152
151
|
|
|
153
|
-
| Name
|
|
154
|
-
|
|
|
155
|
-
| `CanvasSpace`
|
|
156
|
-
| `CanvasSpaceValues`
|
|
157
|
-
| `CanvasSpaceNumbers` | `spaceNumbers` object with numeric rem values |
|
|
158
|
-
| `CanvasSpaceNumberValues` | numeric rem values for CanvasSpaceNumbers |
|
|
152
|
+
| Name | Description |
|
|
153
|
+
| ------------------- | ------------------------------------- |
|
|
154
|
+
| `CanvasSpace` | `space` object with string rem values |
|
|
155
|
+
| `CanvasSpaceValues` | string rem values for CanvasSpace |
|
|
159
156
|
|
|
160
157
|
### Usage
|
|
161
158
|
|
|
162
159
|
```tsx
|
|
163
|
-
import {space
|
|
160
|
+
import {space} from '@workday/canvas-kit-react/tokens';
|
|
164
161
|
|
|
165
|
-
const iconSize = 1.
|
|
162
|
+
const iconSize = '1.25rem';
|
|
166
163
|
|
|
167
164
|
const buttonSyles = {
|
|
168
|
-
paddingTop: space.xs
|
|
169
|
-
|
|
165
|
+
paddingTop: `calc(${space.xs} + 2px)`,
|
|
166
|
+
paddingInlineStart: space.s,
|
|
170
167
|
paddingBottom: space.xs,
|
|
171
|
-
|
|
168
|
+
paddingInlineEnd: `calc(${space.s} + ${iconSize})`,
|
|
172
169
|
};
|
|
173
170
|
```
|
|
174
171
|
|