@workday/canvas-kit-react 8.0.0-alpha.111-next.0 → 8.0.0-alpha.121-next.2

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 (177) hide show
  1. package/action-bar/lib/ActionBarItem.tsx +1 -6
  2. package/action-bar/lib/ActionBarList.tsx +3 -3
  3. package/checkbox/lib/Checkbox.tsx +106 -54
  4. package/collection/lib/ListBox.tsx +1 -1
  5. package/collection/lib/useListRenderItem.tsx +24 -14
  6. package/collection/lib/useOverflowListModel.tsx +11 -2
  7. package/common/lib/InputProvider.tsx +1 -1
  8. package/common/lib/utils/StaticStates.tsx +2 -2
  9. package/common/lib/utils/components.ts +3 -3
  10. package/common/lib/utils/index.ts +1 -0
  11. package/common/lib/utils/useModalityType.ts +65 -0
  12. package/dist/commonjs/action-bar/lib/ActionBar.d.ts +4 -6
  13. package/dist/commonjs/action-bar/lib/ActionBar.d.ts.map +1 -1
  14. package/dist/commonjs/action-bar/lib/ActionBarItem.d.ts +1 -4
  15. package/dist/commonjs/action-bar/lib/ActionBarItem.d.ts.map +1 -1
  16. package/dist/commonjs/action-bar/lib/ActionBarItem.js +0 -5
  17. package/dist/commonjs/action-bar/lib/ActionBarList.d.ts +3 -3
  18. package/dist/commonjs/action-bar/lib/ActionBarList.d.ts.map +1 -1
  19. package/dist/commonjs/action-bar/lib/useActionBarModel.d.ts +2 -0
  20. package/dist/commonjs/action-bar/lib/useActionBarModel.d.ts.map +1 -1
  21. package/dist/commonjs/checkbox/lib/Checkbox.d.ts +4 -0
  22. package/dist/commonjs/checkbox/lib/Checkbox.d.ts.map +1 -1
  23. package/dist/commonjs/checkbox/lib/Checkbox.js +65 -34
  24. package/dist/commonjs/collection/lib/ListBox.d.ts +1 -1
  25. package/dist/commonjs/collection/lib/ListBox.d.ts.map +1 -1
  26. package/dist/commonjs/collection/lib/useListRenderItem.d.ts +1 -1
  27. package/dist/commonjs/collection/lib/useListRenderItem.d.ts.map +1 -1
  28. package/dist/commonjs/collection/lib/useListRenderItem.js +21 -11
  29. package/dist/commonjs/collection/lib/useOverflowListModel.d.ts +10 -0
  30. package/dist/commonjs/collection/lib/useOverflowListModel.d.ts.map +1 -1
  31. package/dist/commonjs/collection/lib/useOverflowListModel.js +10 -4
  32. package/dist/commonjs/common/lib/InputProvider.d.ts +2 -2
  33. package/dist/commonjs/common/lib/InputProvider.d.ts.map +1 -1
  34. package/dist/commonjs/common/lib/utils/StaticStates.d.ts +2 -2
  35. package/dist/commonjs/common/lib/utils/StaticStates.d.ts.map +1 -1
  36. package/dist/commonjs/common/lib/utils/components.d.ts +3 -3
  37. package/dist/commonjs/common/lib/utils/components.d.ts.map +1 -1
  38. package/dist/commonjs/common/lib/utils/index.d.ts +1 -0
  39. package/dist/commonjs/common/lib/utils/index.d.ts.map +1 -1
  40. package/dist/commonjs/common/lib/utils/index.js +1 -0
  41. package/dist/commonjs/common/lib/utils/useModalityType.d.ts +17 -0
  42. package/dist/commonjs/common/lib/utils/useModalityType.d.ts.map +1 -0
  43. package/dist/commonjs/common/lib/utils/useModalityType.js +63 -0
  44. package/dist/commonjs/form-field/lib/FormField.d.ts +1 -1
  45. package/dist/commonjs/form-field/lib/FormField.d.ts.map +1 -1
  46. package/dist/commonjs/form-field/lib/Label.d.ts +1 -1
  47. package/dist/commonjs/form-field/lib/Label.d.ts.map +1 -1
  48. package/dist/commonjs/layout/lib/utils/types.d.ts +11 -1
  49. package/dist/commonjs/layout/lib/utils/types.d.ts.map +1 -1
  50. package/dist/commonjs/layout/lib/utils/types.js +2 -0
  51. package/dist/commonjs/menu/lib/Menu.d.ts +1 -1
  52. package/dist/commonjs/menu/lib/MenuList.d.ts +3 -3
  53. package/dist/commonjs/menu/lib/MenuList.d.ts.map +1 -1
  54. package/dist/commonjs/modal/lib/ModalOverlay.d.ts +0 -1
  55. package/dist/commonjs/modal/lib/ModalOverlay.d.ts.map +1 -1
  56. package/dist/commonjs/pagination/lib/Pagination/AdditionalDetails.d.ts +1 -1
  57. package/dist/commonjs/pagination/lib/Pagination/AdditionalDetails.d.ts.map +1 -1
  58. package/dist/commonjs/pagination/lib/Pagination/GoTo/Label.d.ts +1 -1
  59. package/dist/commonjs/pagination/lib/Pagination/GoTo/Label.d.ts.map +1 -1
  60. package/dist/commonjs/pagination/lib/Pagination/PageButton.d.ts.map +1 -1
  61. package/dist/commonjs/pagination/lib/Pagination/PageButton.js +8 -6
  62. package/dist/commonjs/pagination/lib/Pagination/PageList.d.ts +1 -1
  63. package/dist/commonjs/pagination/lib/Pagination/PageList.d.ts.map +1 -1
  64. package/dist/commonjs/radio/lib/Radio.d.ts +1 -0
  65. package/dist/commonjs/radio/lib/Radio.d.ts.map +1 -1
  66. package/dist/commonjs/radio/lib/Radio.js +74 -26
  67. package/dist/commonjs/tabs/lib/Tabs.d.ts +5 -4
  68. package/dist/commonjs/tabs/lib/Tabs.d.ts.map +1 -1
  69. package/dist/commonjs/tabs/lib/TabsItem.d.ts.map +1 -1
  70. package/dist/commonjs/tabs/lib/TabsItem.js +4 -3
  71. package/dist/commonjs/tabs/lib/TabsList.d.ts +2 -2
  72. package/dist/commonjs/tabs/lib/TabsList.d.ts.map +1 -1
  73. package/dist/commonjs/tabs/lib/TabsList.js +17 -2
  74. package/dist/commonjs/tabs/lib/TabsPanel.d.ts +2 -2
  75. package/dist/commonjs/tabs/lib/TabsPanel.d.ts.map +1 -1
  76. package/dist/commonjs/tabs/lib/TabsPanels.d.ts +2 -2
  77. package/dist/commonjs/tabs/lib/TabsPanels.d.ts.map +1 -1
  78. package/dist/commonjs/tabs/lib/useTabsModel.d.ts +55 -159
  79. package/dist/commonjs/tabs/lib/useTabsModel.d.ts.map +1 -1
  80. package/dist/commonjs/tabs/lib/useTabsModel.js +2 -0
  81. package/dist/commonjs/text-input/lib/InputIconContainer.d.ts +1 -1
  82. package/dist/commonjs/text-input/lib/InputIconContainer.d.ts.map +1 -1
  83. package/dist/es6/action-bar/lib/ActionBar.d.ts +5 -7
  84. package/dist/es6/action-bar/lib/ActionBar.d.ts.map +1 -1
  85. package/dist/es6/action-bar/lib/ActionBarItem.d.ts +1 -4
  86. package/dist/es6/action-bar/lib/ActionBarItem.d.ts.map +1 -1
  87. package/dist/es6/action-bar/lib/ActionBarItem.js +1 -6
  88. package/dist/es6/action-bar/lib/ActionBarList.d.ts +3 -3
  89. package/dist/es6/action-bar/lib/ActionBarList.d.ts.map +1 -1
  90. package/dist/es6/action-bar/lib/useActionBarModel.d.ts +2 -0
  91. package/dist/es6/action-bar/lib/useActionBarModel.d.ts.map +1 -1
  92. package/dist/es6/button/lib/BaseButton.d.ts +1 -1
  93. package/dist/es6/checkbox/lib/Checkbox.d.ts +4 -0
  94. package/dist/es6/checkbox/lib/Checkbox.d.ts.map +1 -1
  95. package/dist/es6/checkbox/lib/Checkbox.js +65 -34
  96. package/dist/es6/collection/lib/ListBox.d.ts +1 -1
  97. package/dist/es6/collection/lib/ListBox.d.ts.map +1 -1
  98. package/dist/es6/collection/lib/useListRenderItem.d.ts +1 -1
  99. package/dist/es6/collection/lib/useListRenderItem.d.ts.map +1 -1
  100. package/dist/es6/collection/lib/useListRenderItem.js +21 -11
  101. package/dist/es6/collection/lib/useOverflowListModel.d.ts +10 -0
  102. package/dist/es6/collection/lib/useOverflowListModel.d.ts.map +1 -1
  103. package/dist/es6/collection/lib/useOverflowListModel.js +10 -4
  104. package/dist/es6/common/lib/InputProvider.d.ts +2 -2
  105. package/dist/es6/common/lib/InputProvider.d.ts.map +1 -1
  106. package/dist/es6/common/lib/utils/StaticStates.d.ts +2 -2
  107. package/dist/es6/common/lib/utils/StaticStates.d.ts.map +1 -1
  108. package/dist/es6/common/lib/utils/components.d.ts +6 -6
  109. package/dist/es6/common/lib/utils/components.d.ts.map +1 -1
  110. package/dist/es6/common/lib/utils/index.d.ts +1 -0
  111. package/dist/es6/common/lib/utils/index.d.ts.map +1 -1
  112. package/dist/es6/common/lib/utils/index.js +1 -0
  113. package/dist/es6/common/lib/utils/useModalityType.d.ts +17 -0
  114. package/dist/es6/common/lib/utils/useModalityType.d.ts.map +1 -0
  115. package/dist/es6/common/lib/utils/useModalityType.js +56 -0
  116. package/dist/es6/form-field/lib/FormField.d.ts +1 -1
  117. package/dist/es6/form-field/lib/FormField.d.ts.map +1 -1
  118. package/dist/es6/form-field/lib/Label.d.ts +1 -1
  119. package/dist/es6/form-field/lib/Label.d.ts.map +1 -1
  120. package/dist/es6/layout/lib/utils/types.d.ts +11 -1
  121. package/dist/es6/layout/lib/utils/types.d.ts.map +1 -1
  122. package/dist/es6/layout/lib/utils/types.js +2 -0
  123. package/dist/es6/menu/lib/Menu.d.ts +2 -2
  124. package/dist/es6/menu/lib/MenuItem.d.ts +1 -1
  125. package/dist/es6/menu/lib/MenuList.d.ts +3 -3
  126. package/dist/es6/menu/lib/MenuList.d.ts.map +1 -1
  127. package/dist/es6/modal/lib/ModalOverlay.d.ts +0 -1
  128. package/dist/es6/modal/lib/ModalOverlay.d.ts.map +1 -1
  129. package/dist/es6/pagination/lib/Pagination/AdditionalDetails.d.ts +1 -1
  130. package/dist/es6/pagination/lib/Pagination/AdditionalDetails.d.ts.map +1 -1
  131. package/dist/es6/pagination/lib/Pagination/GoTo/Label.d.ts +1 -1
  132. package/dist/es6/pagination/lib/Pagination/GoTo/Label.d.ts.map +1 -1
  133. package/dist/es6/pagination/lib/Pagination/PageButton.d.ts.map +1 -1
  134. package/dist/es6/pagination/lib/Pagination/PageButton.js +9 -7
  135. package/dist/es6/pagination/lib/Pagination/PageList.d.ts +1 -1
  136. package/dist/es6/pagination/lib/Pagination/PageList.d.ts.map +1 -1
  137. package/dist/es6/radio/lib/Radio.d.ts +1 -0
  138. package/dist/es6/radio/lib/Radio.d.ts.map +1 -1
  139. package/dist/es6/radio/lib/Radio.js +74 -26
  140. package/dist/es6/tabs/lib/Tabs.d.ts +6 -5
  141. package/dist/es6/tabs/lib/Tabs.d.ts.map +1 -1
  142. package/dist/es6/tabs/lib/TabsItem.d.ts +1 -1
  143. package/dist/es6/tabs/lib/TabsItem.d.ts.map +1 -1
  144. package/dist/es6/tabs/lib/TabsItem.js +5 -4
  145. package/dist/es6/tabs/lib/TabsList.d.ts +2 -2
  146. package/dist/es6/tabs/lib/TabsList.d.ts.map +1 -1
  147. package/dist/es6/tabs/lib/TabsList.js +18 -3
  148. package/dist/es6/tabs/lib/TabsPanel.d.ts +2 -2
  149. package/dist/es6/tabs/lib/TabsPanel.d.ts.map +1 -1
  150. package/dist/es6/tabs/lib/TabsPanels.d.ts +2 -2
  151. package/dist/es6/tabs/lib/TabsPanels.d.ts.map +1 -1
  152. package/dist/es6/tabs/lib/useTabsModel.d.ts +55 -159
  153. package/dist/es6/tabs/lib/useTabsModel.d.ts.map +1 -1
  154. package/dist/es6/tabs/lib/useTabsModel.js +3 -1
  155. package/dist/es6/text-input/lib/InputIconContainer.d.ts +1 -1
  156. package/dist/es6/text-input/lib/InputIconContainer.d.ts.map +1 -1
  157. package/dist/es6/tooltip/lib/TooltipContainer.d.ts +1 -1
  158. package/form-field/lib/FormField.tsx +1 -1
  159. package/form-field/lib/Label.tsx +1 -1
  160. package/layout/lib/utils/types.ts +64 -13
  161. package/menu/lib/MenuList.tsx +3 -2
  162. package/modal/lib/ModalOverlay.tsx +2 -4
  163. package/package.json +9 -9
  164. package/pagination/lib/Pagination/AdditionalDetails.tsx +1 -1
  165. package/pagination/lib/Pagination/GoTo/Label.tsx +2 -1
  166. package/pagination/lib/Pagination/PageButton.tsx +13 -7
  167. package/pagination/lib/Pagination/PageList.tsx +1 -1
  168. package/popup/lib/hooks/useCloseOnFullscreenExit.ts +1 -1
  169. package/popup/lib/hooks/useTransferOnFullscreenEnter.ts +1 -1
  170. package/popup/lib/hooks/useTransferOnFullscreenExit.ts +1 -1
  171. package/radio/lib/Radio.tsx +98 -29
  172. package/tabs/lib/TabsItem.tsx +4 -3
  173. package/tabs/lib/TabsList.tsx +25 -5
  174. package/tabs/lib/TabsPanel.tsx +1 -1
  175. package/tabs/lib/TabsPanels.tsx +1 -1
  176. package/tabs/lib/useTabsModel.tsx +3 -1
  177. package/text-input/lib/InputIconContainer.tsx +3 -5
@@ -136,7 +136,7 @@ const FormFieldInputContainer = styled('div')<GrowthBehavior & FormFieldLabelPos
136
136
  }
137
137
  );
138
138
 
139
- class FormField extends React.Component<FormFieldProps> {
139
+ class FormField extends React.Component<React.PropsWithChildren<FormFieldProps>> {
140
140
  static LabelPosition = FormFieldLabelPosition;
141
141
  static ErrorType = ErrorType;
142
142
 
@@ -88,7 +88,7 @@ const LegendComponent = styled('legend')<LabelProps>(...labelStyles, ({labelPosi
88
88
  });
89
89
  const LabelComponent = styled('label')<LabelProps>(...labelStyles);
90
90
 
91
- class Label extends React.Component<LabelProps> {
91
+ class Label extends React.Component<React.PropsWithChildren<LabelProps>> {
92
92
  static Position = FormFieldLabelPosition;
93
93
 
94
94
  public render() {
@@ -1,19 +1,70 @@
1
- import {
2
- Globals,
3
- GlobalsNumber,
4
- SelfPosition,
5
- DisplayOutside,
6
- DisplayInside,
7
- DisplayInternal,
8
- DisplayLegacy,
9
- LineStyle,
10
- ContentDistribution,
11
- ContentPosition,
12
- } from 'csstype';
13
-
14
1
  // We're temporarily creating these types from csstype
15
2
  // to improve type completion until we move to csstype v3.
16
3
 
4
+ type Globals = '-moz-initial' | 'inherit' | 'initial' | 'revert' | 'unset';
5
+ type GlobalsNumber = Globals | number;
6
+
7
+ type SelfPosition =
8
+ | 'center'
9
+ | 'end'
10
+ | 'flex-end'
11
+ | 'flex-start'
12
+ | 'self-end'
13
+ | 'self-start'
14
+ | 'start';
15
+
16
+ type DisplayOutside = 'block' | 'inline' | 'run-in';
17
+
18
+ type DisplayInside =
19
+ | '-ms-flexbox'
20
+ | '-ms-grid'
21
+ | '-webkit-flex'
22
+ | 'flex'
23
+ | 'flow'
24
+ | 'flow-root'
25
+ | 'grid'
26
+ | 'ruby'
27
+ | 'table';
28
+
29
+ type DisplayInternal =
30
+ | 'ruby-base'
31
+ | 'ruby-base-container'
32
+ | 'ruby-text'
33
+ | 'ruby-text-container'
34
+ | 'table-caption'
35
+ | 'table-cell'
36
+ | 'table-column'
37
+ | 'table-column-group'
38
+ | 'table-footer-group'
39
+ | 'table-header-group'
40
+ | 'table-row'
41
+ | 'table-row-group';
42
+
43
+ type DisplayLegacy =
44
+ | '-ms-inline-flexbox'
45
+ | '-ms-inline-grid'
46
+ | '-webkit-inline-flex'
47
+ | 'inline-block'
48
+ | 'inline-flex'
49
+ | 'inline-grid'
50
+ | 'inline-list-item'
51
+ | 'inline-table';
52
+
53
+ type LineStyle =
54
+ | 'dashed'
55
+ | 'dotted'
56
+ | 'double'
57
+ | 'groove'
58
+ | 'hidden'
59
+ | 'inset'
60
+ | 'none'
61
+ | 'outset'
62
+ | 'ridge'
63
+ | 'solid';
64
+
65
+ type ContentDistribution = 'space-around' | 'space-between' | 'space-evenly' | 'stretch';
66
+ type ContentPosition = 'center' | 'end' | 'flex-end' | 'flex-start' | 'start';
67
+
17
68
  // Border
18
69
  export type PropertyBorder = Globals | LineStyle | (string & {});
19
70
 
@@ -11,11 +11,12 @@ import {Stack} from '@workday/canvas-kit-react/layout';
11
11
 
12
12
  import {useMenuModel} from './useMenuModel';
13
13
 
14
- export interface MenuListProps extends Partial<ExtractProps<typeof Stack, never>> {
14
+ export interface MenuListProps<T = any>
15
+ extends Omit<Partial<ExtractProps<typeof Stack, never>>, 'children'> {
15
16
  /**
16
17
  * The label text of the MenuList.
17
18
  */
18
- children: React.ReactNode;
19
+ children: React.ReactNode | ((item: T) => React.ReactNode);
19
20
  }
20
21
 
21
22
  export const useMenuList = createElemPropsHook(useMenuModel)(model => {
@@ -14,9 +14,7 @@ import styled from '@emotion/styled';
14
14
  import {Box, BoxProps} from '@workday/canvas-kit-react/layout';
15
15
  import {useModalModel} from './hooks';
16
16
 
17
- export interface ModalOverlayProps extends BoxProps {
18
- children: React.ReactNode;
19
- }
17
+ export interface ModalOverlayProps extends BoxProps {}
20
18
 
21
19
  const fadeIn = keyframes`
22
20
  from {
@@ -86,7 +84,7 @@ const OpenModalOverlay = createSubcomponent('div')({
86
84
  displayName: 'Modal.OpenOverlay',
87
85
  modelHook: useModalModel,
88
86
  elemPropsHook: useModalOverlay,
89
- })<ModalOverlayProps>((elemProps: ModalOverlayProps, Element, model) => {
87
+ })<ModalOverlayProps>((elemProps, Element, model) => {
90
88
  const windowSize = useWindowSize();
91
89
 
92
90
  const content = (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-react",
3
- "version": "8.0.0-alpha.111-next.0+2f9c1930",
3
+ "version": "8.0.0-alpha.121-next.2+83e3394d",
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",
@@ -10,7 +10,8 @@
10
10
  "types": "dist/es6/index.d.ts",
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "http://github.com/Workday/canvas-kit/tree/master/modules/canvas-kit-react"
13
+ "url": "https://github.com/workday/canvas-kit.git",
14
+ "directory": "modules/react"
14
15
  },
15
16
  "files": [
16
17
  "*/package.json",
@@ -40,7 +41,7 @@
40
41
  "workday"
41
42
  ],
42
43
  "peerDependencies": {
43
- "react": "^16.8 || ^17.0"
44
+ "react": "^17.0 || ^18.0"
44
45
  },
45
46
  "dependencies": {
46
47
  "@emotion/is-prop-valid": "^1.1.1",
@@ -48,13 +49,12 @@
48
49
  "@emotion/styled": "^11.6.0",
49
50
  "@popperjs/core": "^2.5.4",
50
51
  "@workday/canvas-colors-web": "^2.0.0",
51
- "@workday/canvas-kit-labs-react": "^8.0.0-alpha.111-next.0+2f9c1930",
52
- "@workday/canvas-kit-popup-stack": "^8.0.0-alpha.111-next.0+2f9c1930",
53
- "@workday/canvas-kit-preview-react": "^8.0.0-alpha.111-next.0+2f9c1930",
52
+ "@workday/canvas-kit-labs-react": "^8.0.0-alpha.121-next.2+83e3394d",
53
+ "@workday/canvas-kit-popup-stack": "^8.0.0-alpha.121-next.2+83e3394d",
54
+ "@workday/canvas-kit-preview-react": "^8.0.0-alpha.121-next.2+83e3394d",
54
55
  "@workday/canvas-system-icons-web": "^3.0.0",
55
- "@workday/design-assets-types": "^0.2.4",
56
+ "@workday/design-assets-types": "^0.2.8",
56
57
  "chroma-js": "^2.1.0",
57
- "csstype": "^2.6.17",
58
58
  "element-closest": "^3.0.2",
59
59
  "lodash": "^4.17.14",
60
60
  "polished": "^4.1.3",
@@ -69,5 +69,5 @@
69
69
  "@workday/canvas-accent-icons-web": "^3.0.0",
70
70
  "@workday/canvas-applet-icons-web": "^2.0.0"
71
71
  },
72
- "gitHead": "2f9c193032b814210ceff5a30bbcc5dc2dd1a37c"
72
+ "gitHead": "83e3394d370efc56362ddb4bcc49c65a12a2bc8f"
73
73
  }
@@ -6,7 +6,7 @@ import {PaginationModel} from './types';
6
6
  import {Flex, FlexProps} from '@workday/canvas-kit-react/layout';
7
7
  import {useLiveRegion} from './common/useLiveRegion';
8
8
 
9
- export interface AdditionalDetailsProps extends FlexProps {
9
+ export interface AdditionalDetailsProps extends Omit<FlexProps, 'children'> {
10
10
  children: (model: PaginationModel) => React.ReactNode | React.ReactNode;
11
11
  model: PaginationModel;
12
12
  shouldAnnounceToScreenReader?: boolean;
@@ -4,7 +4,8 @@ import {type, typeColors} from '@workday/canvas-kit-react/tokens';
4
4
  import {PaginationModel} from '../types';
5
5
  import {StyledType, styled} from '@workday/canvas-kit-react/common';
6
6
 
7
- export interface GoToLabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
7
+ export interface GoToLabelProps
8
+ extends Omit<React.LabelHTMLAttributes<HTMLLabelElement>, 'children'> {
8
9
  model: PaginationModel;
9
10
  /**
10
11
  * Accepts child elements or a render prop.
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import {styled} from '@workday/canvas-kit-react/common';
2
+ import {EmotionCanvasTheme, styled, useTheme} from '@workday/canvas-kit-react/common';
3
3
  import {borderRadius, colors, space} from '@workday/canvas-kit-react/tokens';
4
4
  import {BaseButton} from '@workday/canvas-kit-react/button';
5
5
 
@@ -19,22 +19,27 @@ const StyledPageButton = styled(BaseButton)<{toggled?: boolean}>(
19
19
  }
20
20
  );
21
21
 
22
- const getPaginationButtonColors = (toggled: boolean) => {
22
+ const getPaginationButtonColors = (toggled: boolean, theme: EmotionCanvasTheme) => {
23
+ const {
24
+ canvas: {
25
+ palette: {primary: themePrimary},
26
+ },
27
+ } = theme;
23
28
  return {
24
29
  default: {
25
- background: toggled ? colors.blueberry400 : 'transparent',
30
+ background: toggled ? themePrimary.main : 'transparent',
26
31
  label: toggled ? colors.frenchVanilla100 : colors.blackPepper400,
27
32
  },
28
33
  hover: {
29
- background: toggled ? colors.blueberry400 : colors.soap300,
34
+ background: toggled ? themePrimary.main : colors.soap300,
30
35
  label: toggled ? colors.frenchVanilla100 : colors.blackPepper400,
31
36
  },
32
37
  active: {
33
- background: toggled ? colors.blueberry400 : 'transparent',
38
+ background: toggled ? themePrimary.main : 'transparent',
34
39
  label: toggled ? colors.frenchVanilla100 : colors.blackPepper400,
35
40
  },
36
41
  focus: {
37
- background: toggled ? colors.blueberry400 : 'transparent',
42
+ background: toggled ? themePrimary.main : 'transparent',
38
43
  label: toggled ? colors.frenchVanilla100 : colors.blackPepper400,
39
44
  },
40
45
  disabled: {
@@ -56,6 +61,7 @@ export const PageButton = ({
56
61
  ...elemProps
57
62
  }: PageButtonProps) => {
58
63
  const isCurrentPage = pageNumber === model.state.currentPage;
64
+ const theme = useTheme();
59
65
 
60
66
  const handleClick = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
61
67
  onClick?.(e);
@@ -65,7 +71,7 @@ export const PageButton = ({
65
71
  return (
66
72
  <StyledPageButton
67
73
  aria-current={isCurrentPage ? 'page' : undefined}
68
- colors={getPaginationButtonColors(isCurrentPage)}
74
+ colors={getPaginationButtonColors(isCurrentPage, theme)}
69
75
  aria-pressed={undefined}
70
76
  onClick={handleClick}
71
77
  toggled={isCurrentPage}
@@ -4,7 +4,7 @@ import {PaginationModel} from './types';
4
4
  import {ListItem, ListItemProps} from './common/List';
5
5
  import {HStack, HStackProps} from '@workday/canvas-kit-react/layout';
6
6
 
7
- export interface PageListProps extends Omit<HStackProps, 'as' | 'spacing'> {
7
+ export interface PageListProps extends Omit<HStackProps, 'as' | 'spacing' | 'children'> {
8
8
  model: PaginationModel;
9
9
  children?: (model: PaginationModel) => React.ReactNode[] | React.ReactNode;
10
10
  }
@@ -12,7 +12,7 @@ import {usePopupModel} from './usePopupModel';
12
12
  */
13
13
  export const useCloseOnFullscreenExit = createElemPropsHook(usePopupModel)(model => {
14
14
  const handler = React.useCallback(
15
- event => {
15
+ (event: any) => {
16
16
  if (!screenfull.isFullscreen) {
17
17
  model.events.hide(event);
18
18
  }
@@ -16,7 +16,7 @@ import {usePopupModel} from './usePopupModel';
16
16
  */
17
17
  export const useTransferOnFullscreenEnter = createElemPropsHook(usePopupModel)(model => {
18
18
  const handler = React.useCallback(
19
- event => {
19
+ (event: any) => {
20
20
  if (screenfull.isFullscreen && model.state.stackRef.current) {
21
21
  PopupStack.transferToCurrentContext({
22
22
  element: model.state.stackRef.current,
@@ -15,7 +15,7 @@ import {usePopupModel} from './usePopupModel';
15
15
  */
16
16
  export const useTransferOnFullscreenExit = createElemPropsHook(usePopupModel)(model => {
17
17
  const handler = React.useCallback(
18
- event => {
18
+ (event: any) => {
19
19
  if (!screenfull.isFullscreen && model.state.stackRef.current) {
20
20
  PopupStack.transferToCurrentContext({
21
21
  element: model.state.stackRef.current,
@@ -48,6 +48,7 @@ export interface RadioProps extends Themeable {
48
48
  * The value of the Radio button.
49
49
  */
50
50
  value?: string;
51
+ variant?: 'inverse' | undefined;
51
52
  }
52
53
 
53
54
  const radioBorderRadius = 9;
@@ -77,16 +78,20 @@ const RadioInputWrapper = styled('div')<Pick<RadioProps, 'disabled'>>({
77
78
  width: radioWidth,
78
79
  });
79
80
 
80
- const RadioRipple = styled('span')<Pick<RadioProps, 'disabled'>>({
81
- borderRadius: borderRadius.circle,
82
- boxShadow: `0 0 0 0 ${colors.soap200}`,
83
- height: radioHeight,
84
- transition: 'box-shadow 150ms ease-out',
85
- width: radioWidth,
86
- position: 'absolute',
87
- pointerEvents: 'none', // This is a decorative element we don't want it to block clicks to input
88
- zIndex: -1,
89
- });
81
+ const RadioRipple = styled('span')<Pick<RadioProps, 'disabled' | 'variant'>>(
82
+ {
83
+ borderRadius: borderRadius.circle,
84
+ boxShadow: `0 0 0 0 ${colors.soap200}`,
85
+ height: radioHeight,
86
+ transition: 'box-shadow 150ms ease-out',
87
+ width: radioWidth,
88
+ position: 'absolute',
89
+ pointerEvents: 'none', // This is a decorative element we don't want it to block clicks to input
90
+ },
91
+ ({variant}) => ({
92
+ opacity: variant === 'inverse' ? '0.4' : '1',
93
+ })
94
+ );
90
95
 
91
96
  const RadioInput = styled('input')<RadioProps & StyledType>(
92
97
  {
@@ -105,6 +110,7 @@ const RadioInput = styled('input')<RadioProps & StyledType>(
105
110
  ({
106
111
  checked,
107
112
  disabled,
113
+ variant,
108
114
  theme: {
109
115
  canvas: {
110
116
  palette: {
@@ -134,34 +140,68 @@ const RadioInput = styled('input')<RadioProps & StyledType>(
134
140
  // input (which is visually hidden)
135
141
  '&:hover ~ div:first-of-type': {
136
142
  backgroundColor: checked
137
- ? themePrimary.main
143
+ ? variant === 'inverse'
144
+ ? colors.frenchVanilla100
145
+ : themePrimary.main
138
146
  : disabled
139
147
  ? inputColors.disabled.background
140
148
  : 'white',
141
149
  borderColor: checked
142
- ? themePrimary.main
150
+ ? variant === 'inverse'
151
+ ? colors.soap300
152
+ : themePrimary.main
143
153
  : disabled
144
154
  ? inputColors.disabled.border
155
+ : variant === 'inverse'
156
+ ? colors.soap300
145
157
  : inputColors.hoverBorder,
146
158
  borderWidth: '1px',
147
159
  },
148
160
  '&:focus, &focus:hover': {
149
161
  '& ~ div:first-of-type': {
150
- borderColor: checked ? themePrimary.main : themeFocusOutline,
151
162
  borderWidth: '2px',
163
+ borderColor: variant === 'inverse' ? colors.blackPepper400 : themeFocusOutline,
164
+ boxShadow: 'none',
165
+ ...focusRing({
166
+ width: variant === 'inverse' ? 2 : 0,
167
+ separation: 0,
168
+ animate: false,
169
+ innerColor: variant === 'inverse' ? colors.blackPepper400 : undefined,
170
+ outerColor: variant === 'inverse' ? colors.frenchVanilla100 : undefined,
171
+ }),
152
172
  },
153
173
  },
154
174
  '&:checked:focus ~ div:first-of-type': {
155
- ...focusRing({separation: 2, outerColor: themeFocusOutline}),
175
+ ...focusRing({
176
+ separation: 2,
177
+ width: 2,
178
+ innerColor: variant === 'inverse' ? colors.blackPepper400 : undefined,
179
+ outerColor: variant === 'inverse' ? colors.frenchVanilla100 : themeFocusOutline,
180
+ }),
181
+ borderColor: variant === 'inverse' ? colors.frenchVanilla100 : themePrimary.main,
182
+ borderWidth: '2px',
156
183
  },
157
184
  ...mouseFocusBehavior({
158
185
  '&:focus ~ div:first-of-type': {
159
- ...focusRing({width: 0, outerColor: themeFocusOutline}),
186
+ ...focusRing({
187
+ width: 0,
188
+ outerColor: variant === 'inverse' ? colors.frenchVanilla100 : themeFocusOutline,
189
+ }),
160
190
  borderWidth: '1px',
161
- borderColor: checked ? themePrimary.main : inputColors.border,
191
+ borderColor: checked
192
+ ? variant === 'inverse'
193
+ ? colors.soap300
194
+ : themePrimary.main
195
+ : inputColors.border,
162
196
  },
163
197
  '&:focus:hover ~ div:first-of-type, &:focus:active ~ div:first-of-type': {
164
- borderColor: checked ? themePrimary.main : inputColors.hoverBorder,
198
+ borderColor: checked
199
+ ? variant === 'inverse'
200
+ ? colors.soap300
201
+ : themePrimary.main
202
+ : variant === 'inverse'
203
+ ? colors.soap300
204
+ : inputColors.hoverBorder,
165
205
  },
166
206
  }),
167
207
  })
@@ -187,6 +227,7 @@ const RadioBackground = styled('div')<RadioProps>(
187
227
  ({
188
228
  checked,
189
229
  disabled,
230
+ variant,
190
231
  theme: {
191
232
  canvas: {
192
233
  palette: {primary: themePrimary},
@@ -194,19 +235,26 @@ const RadioBackground = styled('div')<RadioProps>(
194
235
  },
195
236
  }) => ({
196
237
  borderColor: checked
197
- ? themePrimary.main
238
+ ? variant === 'inverse'
239
+ ? colors.soap300
240
+ : themePrimary.main
198
241
  : disabled
199
242
  ? inputColors.disabled.border
243
+ : variant === 'inverse'
244
+ ? colors.soap300
200
245
  : inputColors.border,
201
246
  backgroundColor: checked
202
- ? themePrimary.main
247
+ ? variant === 'inverse'
248
+ ? colors.frenchVanilla100
249
+ : themePrimary.main
203
250
  : disabled
204
251
  ? inputColors.disabled.background
205
252
  : 'white',
253
+ opacity: disabled && variant === 'inverse' ? '.4' : '1',
206
254
  })
207
255
  );
208
256
 
209
- const RadioCheck = styled('div')<Pick<RadioProps, 'checked'>>(
257
+ const RadioCheck = styled('div')<Pick<RadioProps, 'checked' | 'variant'>>(
210
258
  {
211
259
  borderRadius: radioBorderRadius,
212
260
  display: 'flex',
@@ -216,8 +264,11 @@ const RadioCheck = styled('div')<Pick<RadioProps, 'checked'>>(
216
264
  transition: 'transform 200ms ease, opacity 200ms ease',
217
265
  width: radioDot,
218
266
  },
219
- ({theme}) => ({
220
- backgroundColor: theme.canvas.palette.primary.contrast,
267
+ ({theme, variant}) => ({
268
+ backgroundColor:
269
+ variant === 'inverse'
270
+ ? theme.canvas.palette.primary.main
271
+ : theme.canvas.palette.primary.contrast,
221
272
  }),
222
273
  ({checked}) => ({
223
274
  opacity: checked ? 1 : 0,
@@ -225,18 +276,35 @@ const RadioCheck = styled('div')<Pick<RadioProps, 'checked'>>(
225
276
  })
226
277
  );
227
278
 
228
- const RadioLabel = styled('label')<{disabled?: boolean}>(
279
+ const RadioLabel = styled('label')<{disabled?: boolean; variant?: 'inverse' | undefined}>(
229
280
  {
230
281
  ...canvas.type.levels.subtext.large,
231
282
  paddingLeft: radioLabelDistance,
232
283
  },
233
- ({disabled}) => (disabled ? {color: inputColors.disabled.text} : {cursor: 'pointer'})
284
+ ({variant}) => (variant === 'inverse' ? {color: colors.frenchVanilla100} : undefined),
285
+ ({disabled, variant}) =>
286
+ disabled
287
+ ? {
288
+ color: variant === 'inverse' ? colors.frenchVanilla100 : inputColors.disabled.text,
289
+ opacity: variant === 'inverse' ? '.4' : '1',
290
+ }
291
+ : {cursor: 'pointer'}
234
292
  );
235
293
 
236
294
  export const Radio = createComponent('input')({
237
295
  displayName: 'Radio',
238
296
  Component: (
239
- {checked = false, id, label = '', disabled, name, onChange, value, ...elemProps}: RadioProps,
297
+ {
298
+ checked = false,
299
+ id,
300
+ label = '',
301
+ disabled,
302
+ name,
303
+ onChange,
304
+ value,
305
+ variant,
306
+ ...elemProps
307
+ }: RadioProps,
240
308
  ref,
241
309
  Element
242
310
  ) => {
@@ -255,15 +323,16 @@ export const Radio = createComponent('input')({
255
323
  type="radio"
256
324
  value={value}
257
325
  aria-checked={checked}
326
+ variant={variant}
258
327
  {...elemProps}
259
328
  />
260
- <RadioRipple />
261
- <RadioBackground checked={checked} disabled={disabled}>
262
- <RadioCheck checked={checked} />
329
+ <RadioRipple variant={variant} />
330
+ <RadioBackground checked={checked} disabled={disabled} variant={variant}>
331
+ <RadioCheck checked={checked} variant={variant} />
263
332
  </RadioBackground>
264
333
  </RadioInputWrapper>
265
334
  {label && (
266
- <RadioLabel htmlFor={inputId} disabled={disabled}>
335
+ <RadioLabel htmlFor={inputId} disabled={disabled} variant={variant}>
267
336
  {label}
268
337
  </RadioLabel>
269
338
  )}
@@ -12,6 +12,7 @@ import {
12
12
  ellipsisStyles,
13
13
  EllipsisText,
14
14
  createSubcomponent,
15
+ useModalityType,
15
16
  } from '@workday/canvas-kit-react/common';
16
17
  import {Box, StackProps} from '@workday/canvas-kit-react/layout';
17
18
  import {OverflowTooltip} from '@workday/canvas-kit-react/tooltip';
@@ -91,7 +92,6 @@ export const StyledTabItem = styled(Box.as('button'))<StyledType & Pick<TabsItem
91
92
  backgroundColor: 'transparent',
92
93
  flex: '0 0 auto',
93
94
  alignItems: 'center',
94
- maxWidth: '280px',
95
95
  padding: `${space.xs} ${space.s}`,
96
96
  height: 52,
97
97
  boxSizing: 'border-box',
@@ -201,10 +201,11 @@ export const TabsItem = createSubcomponent('button')({
201
201
  Icon: SystemIcon,
202
202
  Text: EllipsisText,
203
203
  },
204
- })<TabsItemProps>(({children, ...elemProps}, Element, model) => {
204
+ })<TabsItemProps>(({children, ...elemProps}, Element) => {
205
+ const modality = useModalityType();
205
206
  return (
206
207
  <OverflowTooltip>
207
- <StyledTabItem as={Element} {...elemProps}>
208
+ <StyledTabItem as={Element} maxWidth={modality === 'touch' ? undefined : 280} {...elemProps}>
208
209
  {children}
209
210
  </StyledTabItem>
210
211
  </OverflowTooltip>
@@ -6,6 +6,9 @@ import {
6
6
  createSubcomponent,
7
7
  createElemPropsHook,
8
8
  ExtractProps,
9
+ useModalityType,
10
+ styled,
11
+ StyledType,
9
12
  } from '@workday/canvas-kit-react/common';
10
13
  import {Stack} from '@workday/canvas-kit-react/layout';
11
14
  import {
@@ -17,7 +20,8 @@ import {
17
20
  import {useTabsModel} from './useTabsModel';
18
21
 
19
22
  // Use `Partial` here to make `spacing` optional
20
- export interface TabListProps<T = unknown> extends Partial<ExtractProps<typeof Stack, never>> {
23
+ export interface TabListProps<T = any>
24
+ extends Omit<Partial<ExtractProps<typeof Stack, never>>, 'children'> {
21
25
  /**
22
26
  * If items are passed to a `TabsModel`, the child of `Tabs.List` should be a render prop. The
23
27
  * List will determine how and when the item will be rendered.
@@ -33,28 +37,44 @@ export interface TabListProps<T = unknown> extends Partial<ExtractProps<typeof S
33
37
 
34
38
  export const useTabsList = composeHooks(
35
39
  createElemPropsHook(useTabsModel)(() => {
36
- return {role: 'tablist'};
40
+ const modality = useModalityType();
41
+ return {role: 'tablist', overflowX: modality === 'touch' ? 'auto' : undefined};
37
42
  }),
38
43
  useOverflowListMeasure,
39
44
  useListResetCursorOnBlur
40
45
  );
41
46
 
47
+ const StyledStack = styled(Stack)<StyledType>({
48
+ '::after': {
49
+ content: '""',
50
+ position: 'sticky',
51
+ height: 52,
52
+ minWidth: 30,
53
+ background: `linear-gradient(to right,rgba(255,255,255,0),white);`,
54
+ zIndex: 1,
55
+ right: 0,
56
+ top: 0,
57
+ pointerEvents: 'none',
58
+ },
59
+ });
60
+
42
61
  export const TabsList = createSubcomponent('div')({
43
62
  displayName: 'Tabs.List',
44
63
  modelHook: useTabsModel,
45
64
  elemPropsHook: useTabsList,
46
65
  })<TabListProps>(({children, overflowButton, ...elemProps}, Element, model) => {
66
+ const modality = useModalityType();
47
67
  return (
48
- <Stack
68
+ <StyledStack
49
69
  as={Element}
50
70
  position="relative"
51
71
  borderBottom={`1px solid ${commonColors.divider}`}
52
- paddingX="m"
72
+ paddingX={modality === 'touch' ? 'zero' : 'm'}
53
73
  spacing="xxxs"
54
74
  {...elemProps}
55
75
  >
56
76
  {useListRenderItems(model, children)}
57
77
  {overflowButton}
58
- </Stack>
78
+ </StyledStack>
59
79
  );
60
80
  });
@@ -14,7 +14,7 @@ import {Box} from '@workday/canvas-kit-react/layout';
14
14
 
15
15
  import {useTabsModel} from './useTabsModel';
16
16
 
17
- export interface TabPanelProps<T = unknown> extends ExtractProps<typeof Box, never> {
17
+ export interface TabPanelProps extends ExtractProps<typeof Box, never> {
18
18
  /**
19
19
  * The contents of the TabPanel.
20
20
  */
@@ -5,7 +5,7 @@ import {useListRenderItems} from '@workday/canvas-kit-react/collection';
5
5
 
6
6
  import {useTabsModel} from './useTabsModel';
7
7
 
8
- export interface TabsPanelsProps<T = unknown> {
8
+ export interface TabsPanelsProps<T = any> {
9
9
  /**
10
10
  *
11
11
  */