@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.
Files changed (155) hide show
  1. package/button/index.ts +8 -11
  2. package/button/lib/BaseButton.tsx +274 -256
  3. package/button/lib/Button.tsx +67 -0
  4. package/button/lib/DeleteButton.tsx +42 -58
  5. package/button/lib/PrimaryButton.tsx +82 -149
  6. package/button/lib/SecondaryButton.tsx +87 -173
  7. package/button/lib/TertiaryButton.tsx +158 -223
  8. package/button/lib/ToolbarDropdownButton.tsx +11 -2
  9. package/button/lib/ToolbarIconButton.tsx +10 -2
  10. package/button/lib/parts/ButtonLabelIcon.tsx +1 -7
  11. package/button/lib/types.ts +6 -8
  12. package/checkbox/lib/Checkbox.tsx +24 -33
  13. package/common/lib/CanvasProvider.tsx +50 -24
  14. package/dist/commonjs/button/index.d.ts +8 -5
  15. package/dist/commonjs/button/index.d.ts.map +1 -1
  16. package/dist/commonjs/button/index.js +9 -13
  17. package/dist/commonjs/button/lib/BaseButton.d.ts +69 -5
  18. package/dist/commonjs/button/lib/BaseButton.d.ts.map +1 -1
  19. package/dist/commonjs/button/lib/BaseButton.js +199 -192
  20. package/dist/commonjs/button/lib/Button.d.ts +17 -0
  21. package/dist/commonjs/button/lib/Button.d.ts.map +1 -0
  22. package/dist/commonjs/button/lib/Button.js +42 -0
  23. package/dist/commonjs/button/lib/DeleteButton.d.ts +7 -9
  24. package/dist/commonjs/button/lib/DeleteButton.d.ts.map +1 -1
  25. package/dist/commonjs/button/lib/DeleteButton.js +29 -19
  26. package/dist/commonjs/button/lib/PrimaryButton.d.ts +15 -36
  27. package/dist/commonjs/button/lib/PrimaryButton.d.ts.map +1 -1
  28. package/dist/commonjs/button/lib/PrimaryButton.js +67 -79
  29. package/dist/commonjs/button/lib/SecondaryButton.d.ts +16 -43
  30. package/dist/commonjs/button/lib/SecondaryButton.d.ts.map +1 -1
  31. package/dist/commonjs/button/lib/SecondaryButton.js +71 -96
  32. package/dist/commonjs/button/lib/TertiaryButton.d.ts +35 -47
  33. package/dist/commonjs/button/lib/TertiaryButton.d.ts.map +1 -1
  34. package/dist/commonjs/button/lib/TertiaryButton.js +136 -134
  35. package/dist/commonjs/button/lib/ToolbarDropdownButton.d.ts.map +1 -1
  36. package/dist/commonjs/button/lib/ToolbarDropdownButton.js +11 -2
  37. package/dist/commonjs/button/lib/ToolbarIconButton.d.ts.map +1 -1
  38. package/dist/commonjs/button/lib/ToolbarIconButton.js +10 -2
  39. package/dist/commonjs/button/lib/parts/ButtonLabelIcon.d.ts +1 -7
  40. package/dist/commonjs/button/lib/parts/ButtonLabelIcon.d.ts.map +1 -1
  41. package/dist/commonjs/button/lib/types.d.ts +6 -7
  42. package/dist/commonjs/button/lib/types.d.ts.map +1 -1
  43. package/dist/commonjs/card/lib/Card.d.ts +1 -1
  44. package/dist/commonjs/card/lib/CardBody.d.ts +1 -1
  45. package/dist/commonjs/card/lib/CardBody.d.ts.map +1 -1
  46. package/dist/commonjs/checkbox/lib/Checkbox.d.ts.map +1 -1
  47. package/dist/commonjs/checkbox/lib/Checkbox.js +13 -17
  48. package/dist/commonjs/common/lib/CanvasProvider.d.ts +1 -8
  49. package/dist/commonjs/common/lib/CanvasProvider.d.ts.map +1 -1
  50. package/dist/commonjs/common/lib/CanvasProvider.js +31 -13
  51. package/dist/commonjs/dialog/lib/Dialog.d.ts +1 -1
  52. package/dist/commonjs/layout/lib/Box.d.ts +3 -2
  53. package/dist/commonjs/layout/lib/Box.d.ts.map +1 -1
  54. package/dist/commonjs/layout/lib/Box.js +2 -1
  55. package/dist/commonjs/layout/lib/Flex.d.ts +1 -1
  56. package/dist/commonjs/layout/lib/Grid.d.ts +1 -1
  57. package/dist/commonjs/menu/lib/MenuItem.d.ts +1 -1
  58. package/dist/commonjs/popup/lib/Popup.d.ts +1 -1
  59. package/dist/commonjs/popup/lib/PopupBody.d.ts +1 -1
  60. package/dist/commonjs/popup/lib/PopupCloseIcon.js +1 -1
  61. package/dist/commonjs/radio/lib/Radio.d.ts.map +1 -1
  62. package/dist/commonjs/radio/lib/Radio.js +17 -22
  63. package/dist/commonjs/segmented-control/lib/SegmentedControlButton.d.ts.map +1 -1
  64. package/dist/commonjs/segmented-control/lib/SegmentedControlButton.js +3 -1
  65. package/dist/commonjs/table/lib/Table.d.ts +1 -2
  66. package/dist/commonjs/table/lib/Table.d.ts.map +1 -1
  67. package/dist/commonjs/table/lib/Table.js +1 -2
  68. package/dist/commonjs/table/lib/TableRow.d.ts +3 -6
  69. package/dist/commonjs/table/lib/TableRow.d.ts.map +1 -1
  70. package/dist/commonjs/table/lib/TableRow.js +3 -5
  71. package/dist/commonjs/tabs/lib/TabsItem.d.ts +1 -1
  72. package/dist/commonjs/text-area/lib/TextArea.d.ts.map +1 -1
  73. package/dist/commonjs/text-area/lib/TextArea.js +1 -1
  74. package/dist/commonjs/text-input/lib/TextInput.js +1 -1
  75. package/dist/commonjs/tokens/lib/space.d.ts +44 -31
  76. package/dist/commonjs/tokens/lib/space.d.ts.map +1 -1
  77. package/dist/commonjs/tokens/lib/space.js +22 -29
  78. package/dist/commonjs/tooltip/lib/TooltipContainer.js +2 -2
  79. package/dist/es6/button/index.d.ts +8 -5
  80. package/dist/es6/button/index.d.ts.map +1 -1
  81. package/dist/es6/button/index.js +8 -5
  82. package/dist/es6/button/lib/BaseButton.d.ts +69 -5
  83. package/dist/es6/button/lib/BaseButton.d.ts.map +1 -1
  84. package/dist/es6/button/lib/BaseButton.js +199 -192
  85. package/dist/es6/button/lib/Button.d.ts +17 -0
  86. package/dist/es6/button/lib/Button.d.ts.map +1 -0
  87. package/dist/es6/button/lib/Button.js +20 -0
  88. package/dist/es6/button/lib/DeleteButton.d.ts +7 -9
  89. package/dist/es6/button/lib/DeleteButton.d.ts.map +1 -1
  90. package/dist/es6/button/lib/DeleteButton.js +31 -21
  91. package/dist/es6/button/lib/PrimaryButton.d.ts +15 -36
  92. package/dist/es6/button/lib/PrimaryButton.d.ts.map +1 -1
  93. package/dist/es6/button/lib/PrimaryButton.js +67 -79
  94. package/dist/es6/button/lib/SecondaryButton.d.ts +16 -43
  95. package/dist/es6/button/lib/SecondaryButton.d.ts.map +1 -1
  96. package/dist/es6/button/lib/SecondaryButton.js +71 -95
  97. package/dist/es6/button/lib/TertiaryButton.d.ts +35 -47
  98. package/dist/es6/button/lib/TertiaryButton.d.ts.map +1 -1
  99. package/dist/es6/button/lib/TertiaryButton.js +137 -135
  100. package/dist/es6/button/lib/ToolbarDropdownButton.d.ts.map +1 -1
  101. package/dist/es6/button/lib/ToolbarDropdownButton.js +11 -2
  102. package/dist/es6/button/lib/ToolbarIconButton.d.ts.map +1 -1
  103. package/dist/es6/button/lib/ToolbarIconButton.js +10 -2
  104. package/dist/es6/button/lib/parts/ButtonLabelIcon.d.ts +1 -7
  105. package/dist/es6/button/lib/parts/ButtonLabelIcon.d.ts.map +1 -1
  106. package/dist/es6/button/lib/types.d.ts +6 -7
  107. package/dist/es6/button/lib/types.d.ts.map +1 -1
  108. package/dist/es6/card/lib/Card.d.ts +1 -1
  109. package/dist/es6/card/lib/CardBody.d.ts +1 -1
  110. package/dist/es6/card/lib/CardBody.d.ts.map +1 -1
  111. package/dist/es6/checkbox/lib/Checkbox.d.ts.map +1 -1
  112. package/dist/es6/checkbox/lib/Checkbox.js +14 -18
  113. package/dist/es6/common/lib/CanvasProvider.d.ts +1 -8
  114. package/dist/es6/common/lib/CanvasProvider.d.ts.map +1 -1
  115. package/dist/es6/common/lib/CanvasProvider.js +31 -13
  116. package/dist/es6/dialog/lib/Dialog.d.ts +1 -1
  117. package/dist/es6/layout/lib/Box.d.ts +3 -2
  118. package/dist/es6/layout/lib/Box.d.ts.map +1 -1
  119. package/dist/es6/layout/lib/Box.js +2 -1
  120. package/dist/es6/layout/lib/Flex.d.ts +1 -1
  121. package/dist/es6/layout/lib/Grid.d.ts +1 -1
  122. package/dist/es6/menu/lib/MenuItem.d.ts +1 -1
  123. package/dist/es6/popup/lib/Popup.d.ts +1 -1
  124. package/dist/es6/popup/lib/PopupBody.d.ts +1 -1
  125. package/dist/es6/popup/lib/PopupCloseIcon.js +1 -1
  126. package/dist/es6/radio/lib/Radio.d.ts.map +1 -1
  127. package/dist/es6/radio/lib/Radio.js +18 -23
  128. package/dist/es6/segmented-control/lib/SegmentedControlButton.d.ts.map +1 -1
  129. package/dist/es6/segmented-control/lib/SegmentedControlButton.js +3 -1
  130. package/dist/es6/table/lib/Table.d.ts +1 -2
  131. package/dist/es6/table/lib/Table.d.ts.map +1 -1
  132. package/dist/es6/table/lib/Table.js +1 -2
  133. package/dist/es6/table/lib/TableRow.d.ts +3 -6
  134. package/dist/es6/table/lib/TableRow.d.ts.map +1 -1
  135. package/dist/es6/table/lib/TableRow.js +4 -6
  136. package/dist/es6/tabs/lib/TabsItem.d.ts +1 -1
  137. package/dist/es6/text-area/lib/TextArea.d.ts.map +1 -1
  138. package/dist/es6/text-area/lib/TextArea.js +2 -2
  139. package/dist/es6/text-input/lib/TextInput.js +2 -2
  140. package/dist/es6/tokens/lib/space.d.ts +44 -31
  141. package/dist/es6/tokens/lib/space.d.ts.map +1 -1
  142. package/dist/es6/tokens/lib/space.js +22 -29
  143. package/dist/es6/tooltip/lib/TooltipContainer.js +3 -3
  144. package/layout/lib/Box.tsx +6 -4
  145. package/package.json +5 -3
  146. package/popup/lib/PopupCloseIcon.tsx +1 -1
  147. package/radio/lib/Radio.tsx +18 -34
  148. package/segmented-control/lib/SegmentedControlButton.tsx +3 -1
  149. package/table/lib/Table.tsx +1 -2
  150. package/table/lib/TableRow.tsx +5 -8
  151. package/text-area/lib/TextArea.tsx +2 -8
  152. package/text-input/lib/TextInput.tsx +2 -2
  153. package/tokens/README.md +25 -28
  154. package/tokens/lib/space.ts +53 -40
  155. 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, spaceNumbers, type } from '@workday/canvas-kit-react/tokens';
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: `${spaceNumbers.xxs}rem`,
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
- /** Type for the `spaceNumbers` object with keys and numeric rem values (numbers) */
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: 0.25;
44
- xxs: 0.5;
45
- xs: 0.75;
46
- s: 1;
47
- m: 1.5;
48
- l: 2;
49
- xl: 2.5;
50
- xxl: 4;
51
- xxxl: 5;
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
- * An object of space keys and their numeric rem values (numbers)
57
- * - These are helpful when you need a raw numeric rem value.
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
- * const buttonPaddingLeft = `${spaceNumbers.s + iconSize}rem`;
79
+ * // With deprecated `spaceNumbers`
80
+ * {
81
+ * paddingLeft: spaceNumbers.xl + 2 // 42px
82
+ * }
62
83
  * ```
63
84
  *
64
- * Below is a table to show the equivalent values from `px` to `rem`.
65
- * This is based on the default browser font size which is `16px`.
66
- *
67
- * | px Value | rem Value | space token |
68
- * | --------- | --------- | ----------- |
69
- * | 0 | 0 | zero |
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,oFAAoF;AACpF,oBAAY,kBAAkB,GAAG;IAC/B,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,EAAE,GAAG,CAAC;IACT,EAAE,EAAE,IAAI,CAAC;IACT,CAAC,EAAE,CAAC,CAAC;IACL,CAAC,EAAE,GAAG,CAAC;IACP,CAAC,EAAE,CAAC,CAAC;IACL,EAAE,EAAE,GAAG,CAAC;IACR,GAAG,EAAE,CAAC,CAAC;IACP,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AAEF,8DAA8D;AAC9D,oBAAY,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,YAAY,EAAE,kBAW1B,CAAC"}
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
- * An object of space keys and their numeric rem values (numbers)
35
- * - These are helpful when you need a raw numeric rem value.
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
- * const buttonPaddingLeft = `${spaceNumbers.s + iconSize}rem`;
37
+ * // With deprecated `spaceNumbers`
38
+ * {
39
+ * paddingLeft: spaceNumbers.xl + 2 // 42px
40
+ * }
40
41
  * ```
41
42
  *
42
- * Below is a table to show the equivalent values from `px` to `rem`.
43
- * This is based on the default browser font size which is `16px`.
44
- *
45
- * | px Value | rem Value | space token |
46
- * | --------- | --------- | ----------- |
47
- * | 0 | 0 | zero |
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: 0.25,
62
- xxs: 0.5,
63
- xs: 0.75,
64
- s: 1,
65
- m: 1.5,
66
- l: 2,
67
- xl: 2.5,
68
- xxl: 4,
69
- xxxl: 5,
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, spaceNumbers, type } from '@workday/canvas-kit-react/tokens';
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: `${spaceNumbers.s - 0.125}rem`,
47
+ padding: `calc(${space.s} - 0.125rem)`,
48
48
  ':before': {
49
- margin: `${spaceNumbers.xxxs + 0.125}rem`,
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
@@ -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
- children?: React.ReactNode;
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.538-next.0",
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.538-next.0",
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": "aa04f7e8012dc4b9c142331720e357cf66c0ae5a"
71
+ "gitHead": "fc8abdabca2c55aad11f09a8f05570bd55aa3478"
70
72
  }
@@ -21,7 +21,7 @@ export const PopupCloseIcon = createSubcomponent('button')({
21
21
  icon={xIcon}
22
22
  type="button"
23
23
  position="absolute"
24
- right={space.xxxs}
24
+ insetInlineEnd={space.xxxs}
25
25
  top={space.xxxs}
26
26
  {...elemProps}
27
27
  />
@@ -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 = `${spaceNumbers.xxs + 0.0625}rem`;
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: radioContainerHeight,
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: `${radioHeight}rem`,
80
- width: `${radioWidth}rem`,
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: `${radioHeight}rem`,
74
+ height: `calc(${space.s} + 2px)`,
88
75
  transition: 'box-shadow 150ms ease-out',
89
- width: `${radioWidth}rem`,
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: radioBorderRadius,
101
- width: radioTapArea,
102
- height: radioTapArea,
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 ? undefined : `0 0 0 ${rippleRadius}rem ${colors.soap200}`,
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: `${radioHeight}rem`,
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: `${radioWidth}rem`,
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: radioDot,
253
+ height: space.xxs,
265
254
  pointerEvents: 'none',
266
255
  transition: 'transform 200ms ease, opacity 200ms ease',
267
- width: radioDot,
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 : undefined,
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
  },
@@ -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() {
@@ -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, spaceNumbers, statusColors} from '@workday/canvas-kit-react/tokens';
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: `${spaceNumbers.xl + spaceNumbers.xxs}rem`,
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: `${spaceNumbers.xxxl * 3 + spaceNumbers.xl}rem`,
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, spaceNumbers, type} from '@workday/canvas-kit-react/tokens';
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: `${spaceNumbers.xxs}rem`, // Compensate for border
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 `px` format (`space`) or number
134
- format (`spaceNumbers`).
135
-
136
- | Variable | Size (rem) | Size (number) |
137
- | -------- | ----------- | ------------- |
138
- | `xxxs` | `'0.25rem'` | `0.25` |
139
- | `xxs` | `'0.5rem'` | `0.5` |
140
- | `xs` | `'0.75rem'` | `0.75` |
141
- | `s` | `'1rem'` | `1` |
142
- | `m` | `'1.5rem'` | `1.5` |
143
- | `l` | `'2rem'` | `2` |
144
- | `xl` | `'2.5rem'` | `2.5` |
145
- | `xxl` | `'4rem'` | `4` |
146
- | `xxxl` | `'5rem'` | `5` |
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 | Description |
154
- | ------------------------- | --------------------------------------------- |
155
- | `CanvasSpace` | `space` object with string rem values |
156
- | `CanvasSpaceValues` | string rem values for CanvasSpace |
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, spaceNumbers} from '@workday/canvas-kit-react/tokens';
160
+ import {space} from '@workday/canvas-kit-react/tokens';
164
161
 
165
- const iconSize = 1.25;
162
+ const iconSize = '1.25rem';
166
163
 
167
164
  const buttonSyles = {
168
- paddingTop: space.xs,
169
- paddingRight: space.s,
165
+ paddingTop: `calc(${space.xs} + 2px)`,
166
+ paddingInlineStart: space.s,
170
167
  paddingBottom: space.xs,
171
- paddingLeft: `${spaceNumbers.s + iconSize}rem`,
168
+ paddingInlineEnd: `calc(${space.s} + ${iconSize})`,
172
169
  };
173
170
  ```
174
171