@workday/canvas-kit-docs 6.9.0-next.0 → 6.9.0-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 (190) hide show
  1. package/dist/commonjs/index.js +13 -6
  2. package/dist/commonjs/lib/Specifications.d.ts.map +1 -1
  3. package/dist/commonjs/lib/Specifications.js +3 -1
  4. package/dist/commonjs/lib/docs.js +1 -0
  5. package/dist/commonjs/lib/specs.js +259 -6
  6. package/dist/es6/lib/Specifications.d.ts.map +1 -1
  7. package/dist/es6/lib/specs.js +259 -6
  8. package/dist/mdx/{4.0-MIGRATION-GUIDE.mdx → 4.0-UPGRADE-GUIDE.mdx} +1 -1
  9. package/dist/mdx/{5.0-MIGRATION-GUIDE.mdx → 5.0-UPGRADE-GUIDE.mdx} +3 -3
  10. package/dist/mdx/{6.0-MIGRATION-GUIDE.mdx → 6.0-UPGRADE-GUIDE.mdx} +4 -4
  11. package/dist/mdx/7.0-UPGRADE-GUIDE.mdx +1006 -0
  12. package/dist/mdx/COMPOUND_COMPONENTS.mdx +2 -2
  13. package/dist/mdx/CONTRIBUTING.mdx +2 -2
  14. package/dist/mdx/TESTING.mdx +1 -1
  15. package/dist/mdx/changelog.stories.mdx +1 -0
  16. package/dist/mdx/labs-react/search-form/examples/Basic.tsx +4 -2
  17. package/dist/mdx/labs-react/search-form/examples/CustomTheme.tsx +4 -2
  18. package/dist/mdx/labs-react/search-form/examples/Grow.tsx +4 -2
  19. package/dist/mdx/labs-react/search-form/examples/RTL.tsx +4 -2
  20. package/dist/mdx/labs-react/search-form/examples/Theming.tsx +4 -2
  21. package/dist/mdx/preview-react/_examples/SidePanelWithOverlay.mdx +8 -0
  22. package/dist/mdx/preview-react/_examples/examples/SidePanelWithOverlay.tsx +31 -0
  23. package/dist/mdx/preview-react/_examples/examples/TextInputWithFormik.tsx +3 -3
  24. package/dist/mdx/preview-react/form-field/examples/Custom.tsx +4 -5
  25. package/dist/mdx/preview-react/menu/Menu.mdx +1 -1
  26. package/dist/mdx/preview-react/menu/examples/ContextMenu.tsx +2 -2
  27. package/dist/mdx/preview-react/menu/examples/Icons.tsx +0 -1
  28. package/dist/mdx/preview-react/pill/Pill.mdx +241 -0
  29. package/dist/mdx/preview-react/pill/examples/Basic.tsx +18 -0
  30. package/dist/mdx/preview-react/pill/examples/WithAvatar.tsx +21 -0
  31. package/dist/mdx/preview-react/pill/examples/WithCount.tsx +9 -0
  32. package/dist/mdx/preview-react/pill/examples/WithList.tsx +31 -0
  33. package/dist/mdx/preview-react/pill/examples/WithReadOnly.tsx +15 -0
  34. package/dist/mdx/preview-react/pill/examples/WithRemovable.tsx +25 -0
  35. package/dist/mdx/preview-react/pill/examples/test-avatar.png +0 -0
  36. package/dist/mdx/preview-react/side-panel/SidePanel.mdx +5 -3
  37. package/dist/mdx/preview-react/side-panel/examples/AlwaysOpen.tsx +16 -22
  38. package/dist/mdx/preview-react/side-panel/examples/Basic.tsx +9 -14
  39. package/dist/mdx/preview-react/side-panel/examples/ExternalControl.tsx +9 -13
  40. package/dist/mdx/preview-react/side-panel/examples/HiddenName.tsx +1 -1
  41. package/dist/mdx/preview-react/side-panel/examples/OnExpandedChange.tsx +1 -1
  42. package/dist/mdx/preview-react/side-panel/examples/OnStateTransition.tsx +1 -1
  43. package/dist/mdx/preview-react/side-panel/examples/RightOrigin.tsx +17 -24
  44. package/dist/mdx/preview-react/side-panel/examples/Variant.tsx +9 -14
  45. package/dist/mdx/preview-react/text-area/examples/Alert.tsx +2 -1
  46. package/dist/mdx/preview-react/text-area/examples/HiddenLabel.tsx +6 -4
  47. package/dist/mdx/preview-react/text-area/examples/RefForwarding.tsx +1 -1
  48. package/dist/mdx/preview-react/text-input/examples/Alert.tsx +2 -1
  49. package/dist/mdx/preview-react/text-input/examples/HiddenLabel.tsx +6 -4
  50. package/dist/mdx/preview-react/text-input/examples/RefForwarding.tsx +1 -1
  51. package/dist/mdx/preview-react/text-input/examples/ThemedAlert.tsx +2 -1
  52. package/dist/mdx/react/_examples/SegmentedControlWithText.mdx +12 -0
  53. package/dist/mdx/react/_examples/examples/GlobalHeader.tsx +7 -6
  54. package/dist/mdx/react/_examples/examples/PageHeader.tsx +5 -5
  55. package/dist/mdx/react/_examples/examples/SegmentControlWithText.tsx +119 -0
  56. package/dist/mdx/react/action-bar/ActionBar.mdx +126 -23
  57. package/dist/mdx/react/action-bar/examples/Basic.tsx +7 -4
  58. package/dist/mdx/react/action-bar/examples/DeleteAction.tsx +15 -0
  59. package/dist/mdx/react/action-bar/examples/Icons.tsx +18 -0
  60. package/dist/mdx/react/action-bar/examples/OverflowActionBar.tsx +59 -0
  61. package/dist/mdx/react/banner/Banner.mdx +203 -19
  62. package/dist/mdx/react/banner/PropTables.splitprops.tsx +39 -0
  63. package/dist/mdx/react/banner/examples/ActionText.tsx +8 -1
  64. package/dist/mdx/react/banner/examples/Basic.tsx +8 -1
  65. package/dist/mdx/react/banner/examples/Error.tsx +8 -1
  66. package/dist/mdx/react/banner/examples/RefForwarding.tsx +25 -0
  67. package/dist/mdx/react/banner/examples/Sticky.tsx +12 -7
  68. package/dist/mdx/react/banner/examples/StickyAnimation.tsx +64 -0
  69. package/dist/mdx/react/banner/examples/StickyRTL.tsx +35 -0
  70. package/dist/mdx/react/banner/examples/ThemedAlert.tsx +28 -0
  71. package/dist/mdx/react/banner/examples/ThemedError.tsx +29 -0
  72. package/dist/mdx/react/button/button/Button.mdx +3 -3
  73. package/dist/mdx/react/button/button/Hyperlink.mdx +72 -0
  74. package/dist/mdx/react/button/button/examples/ExternalHyperlink.tsx +7 -0
  75. package/dist/mdx/react/button/button/examples/ExternalHyperlinkInverse.tsx +12 -0
  76. package/dist/mdx/react/button/button/examples/Hyperlink.tsx +5 -0
  77. package/dist/mdx/react/button/button/examples/HyperlinkInverse.tsx +12 -0
  78. package/dist/mdx/react/button/button/examples/Primary.tsx +11 -3
  79. package/dist/mdx/react/button/button/examples/PrimaryInverse.tsx +11 -3
  80. package/dist/mdx/react/button/button/examples/Secondary.tsx +11 -3
  81. package/dist/mdx/react/button/button/examples/SecondaryInverse.tsx +11 -3
  82. package/dist/mdx/react/button/button/examples/Tertiary.tsx +9 -4
  83. package/dist/mdx/react/button/button/examples/TertiaryInverse.tsx +12 -3
  84. package/dist/mdx/react/card/card.mdx +2 -2
  85. package/dist/mdx/react/card/examples/Depth.tsx +1 -1
  86. package/dist/mdx/react/checkbox/Checkbox.mdx +7 -0
  87. package/dist/mdx/react/checkbox/examples/Indeterminate.tsx +1 -1
  88. package/dist/mdx/react/checkbox/examples/Inverse.tsx +22 -0
  89. package/dist/mdx/react/checkbox/examples/RefForwarding.tsx +1 -1
  90. package/dist/mdx/react/collection/Collection.mdx +358 -0
  91. package/dist/mdx/react/collection/Collection.splitprops.tsx +19 -0
  92. package/dist/mdx/react/collection/examples/Basic.tsx +12 -0
  93. package/dist/mdx/react/collection/examples/BasicGrid.tsx +46 -0
  94. package/dist/mdx/react/collection/examples/BasicVirtual.tsx +24 -0
  95. package/dist/mdx/react/collection/examples/DynamicItems.tsx +20 -0
  96. package/dist/mdx/react/collection/examples/IdentifiedItems.tsx +12 -0
  97. package/dist/mdx/react/collection/examples/MultiSelection.tsx +56 -0
  98. package/dist/mdx/react/collection/examples/RovingFocus.tsx +39 -0
  99. package/dist/mdx/react/collection/examples/Selection.tsx +58 -0
  100. package/dist/mdx/react/collection/examples/WrappingGrid.tsx +48 -0
  101. package/dist/mdx/react/color-picker/color-input/ColorInput.mdx +2 -2
  102. package/dist/mdx/react/color-picker/color-preview/ColorPreview.mdx +2 -2
  103. package/dist/mdx/{labs-react/common → react/layout}/Box.mdx +3 -6
  104. package/dist/mdx/{labs-react → react}/layout/Flex.mdx +24 -27
  105. package/dist/mdx/{labs-react → react}/layout/Stack.mdx +98 -146
  106. package/dist/mdx/{labs-react/common → react/layout}/examples/As.tsx +1 -1
  107. package/dist/mdx/{labs-react/common → react/layout}/examples/Border.tsx +1 -1
  108. package/dist/mdx/{labs-react/common → react/layout}/examples/Color.tsx +1 -1
  109. package/dist/mdx/{labs-react/common → react/layout}/examples/Depth.tsx +9 -3
  110. package/dist/mdx/{labs-react → react}/layout/examples/Flex/FlexCard.tsx +2 -3
  111. package/dist/mdx/{labs-react → react}/layout/examples/Flex/FlexLayout.tsx +1 -1
  112. package/dist/mdx/{labs-react → react}/layout/examples/Flex/Usage.tsx +2 -3
  113. package/dist/mdx/{labs-react/common → react/layout}/examples/FlexItem.tsx +1 -2
  114. package/dist/mdx/{labs-react/common → react/layout}/examples/Layout.tsx +1 -1
  115. package/dist/mdx/{labs-react/common → react/layout}/examples/Position.tsx +1 -1
  116. package/dist/mdx/{labs-react → react}/layout/examples/PropTables.splitprops.tsx +1 -1
  117. package/dist/mdx/{labs-react/common → react/layout}/examples/Ref.tsx +1 -1
  118. package/dist/mdx/{labs-react/common → react/layout}/examples/Space.tsx +1 -1
  119. package/dist/mdx/{labs-react → react}/layout/examples/Stack/BasicStack.tsx +1 -1
  120. package/dist/mdx/{labs-react → react}/layout/examples/Stack/HStackCards.tsx +2 -3
  121. package/dist/mdx/{labs-react → react}/layout/examples/Stack/NestedStacks.tsx +1 -1
  122. package/dist/mdx/react/layout/examples/Stack/ShouldWrapChildren.tsx +28 -0
  123. package/dist/mdx/{labs-react → react}/layout/examples/Stack/StackCard.tsx +2 -2
  124. package/dist/mdx/{labs-react → react}/layout/examples/Stack/StackItems.tsx +1 -2
  125. package/dist/mdx/{labs-react → react}/layout/examples/Stack/VStackCards.tsx +2 -2
  126. package/dist/mdx/react/menu/Menu.mdx +123 -0
  127. package/dist/mdx/react/menu/examples/Basic.tsx +26 -0
  128. package/dist/mdx/react/menu/examples/ContextMenu.tsx +25 -0
  129. package/dist/mdx/react/menu/examples/Icons.tsx +41 -0
  130. package/dist/mdx/react/modal/Modal.mdx +34 -11
  131. package/dist/mdx/react/modal/examples/Basic.tsx +4 -2
  132. package/dist/mdx/react/modal/examples/BodyOverflow.tsx +56 -0
  133. package/dist/mdx/react/modal/examples/CustomFocus.tsx +4 -2
  134. package/dist/mdx/react/modal/examples/FullOverflow.tsx +55 -0
  135. package/dist/mdx/react/modal/examples/ReturnFocus.tsx +5 -3
  136. package/dist/mdx/react/modal/examples/WithoutCloseIcon.tsx +4 -2
  137. package/dist/mdx/react/pagination/PropTables.splitprops.tsx +1 -1
  138. package/dist/mdx/react/pagination/pagination.mdx +14 -14
  139. package/dist/mdx/react/popup/Popup.mdx +2 -1
  140. package/dist/mdx/react/popup/examples/Basic.tsx +1 -1
  141. package/dist/mdx/react/popup/examples/FocusRedirect.tsx +3 -2
  142. package/dist/mdx/react/popup/examples/FocusTrap.tsx +1 -1
  143. package/dist/mdx/react/popup/examples/FullScreen.tsx +1 -1
  144. package/dist/mdx/react/popup/examples/InitialFocus.tsx +4 -2
  145. package/dist/mdx/react/popup/examples/MultiplePopups.tsx +1 -1
  146. package/dist/mdx/react/popup/examples/NestedPopups.tsx +18 -18
  147. package/dist/mdx/react/popup/examples/RTL.tsx +6 -3
  148. package/dist/mdx/react/radio/Radio.mdx +7 -0
  149. package/dist/mdx/react/radio/examples/Basic.tsx +11 -2
  150. package/dist/mdx/react/radio/examples/Inverse.tsx +23 -0
  151. package/dist/mdx/react/segmented-control/SegmentedControl.mdx +2 -2
  152. package/dist/mdx/react/segmented-control/examples/Basic.tsx +13 -11
  153. package/dist/mdx/react/skeleton/examples/Basic.tsx +1 -1
  154. package/dist/mdx/react/skeleton/examples/Color.tsx +1 -2
  155. package/dist/mdx/react/skeleton/examples/Simulation.tsx +31 -30
  156. package/dist/mdx/react/status-indicator/StatusIndicator.mdx +12 -0
  157. package/dist/mdx/react/status-indicator/examples/MaxWidth.tsx +30 -0
  158. package/dist/mdx/react/tabs/Tabs.mdx +14 -17
  159. package/dist/mdx/react/tabs/TabsModel.splitprops.tsx +7 -3
  160. package/dist/mdx/react/tabs/examples/DynamicTabs.tsx +6 -13
  161. package/dist/mdx/react/tabs/examples/HoistedModel.tsx +8 -8
  162. package/dist/mdx/react/tabs/examples/Icons.tsx +4 -4
  163. package/dist/mdx/react/tabs/examples/NamedTabs.tsx +10 -10
  164. package/dist/mdx/react/tabs/examples/OverflowTabs.tsx +4 -8
  165. package/dist/mdx/react/tabs/examples/SinglePanel.tsx +3 -3
  166. package/dist/mdx/react/text-input/examples/Basic.tsx +3 -0
  167. package/dist/mdx/react/tooltip/Tooltip.mdx +2 -2
  168. package/dist/mdx/react/tooltip/examples/Default.tsx +2 -2
  169. package/dist/mdx/react/tooltip/examples/UseTooltip.tsx +2 -2
  170. package/package.json +9 -17
  171. package/dist/mdx/labs-react/common/examples/PropTables.splitprops.tsx +0 -91
  172. package/dist/mdx/labs-react/layout/examples/Stack/ShouldWrapChildren.tsx +0 -33
  173. package/dist/mdx/react/button/icon-button/IconButton.mdx +0 -103
  174. package/dist/mdx/react/button/icon-button/examples/Circle.tsx +0 -6
  175. package/dist/mdx/react/button/icon-button/examples/CircleFilled.tsx +0 -8
  176. package/dist/mdx/react/button/icon-button/examples/Inverse.tsx +0 -20
  177. package/dist/mdx/react/button/icon-button/examples/InverseFilled.tsx +0 -20
  178. package/dist/mdx/react/button/icon-button/examples/MirroredIcon.tsx +0 -11
  179. package/dist/mdx/react/button/icon-button/examples/Plain.tsx +0 -8
  180. package/dist/mdx/react/button/icon-button/examples/Square.tsx +0 -8
  181. package/dist/mdx/react/button/icon-button/examples/SquareFilled.tsx +0 -8
  182. package/dist/mdx/react/button/icon-button/examples/Toggleable.tsx +0 -20
  183. package/ts3.5/dist/commonjs/index.d.ts +0 -4
  184. package/ts3.5/dist/commonjs/lib/Specifications.d.ts +0 -6
  185. package/ts3.5/dist/commonjs/lib/docs.d.ts +0 -5
  186. package/ts3.5/dist/commonjs/lib/specs.d.ts +0 -16
  187. package/ts3.5/dist/es6/index.d.ts +0 -4
  188. package/ts3.5/dist/es6/lib/Specifications.d.ts +0 -6
  189. package/ts3.5/dist/es6/lib/docs.d.ts +0 -5
  190. package/ts3.5/dist/es6/lib/specs.d.ts +0 -16
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import {Stack, Flex} from '@workday/canvas-kit-labs-react/layout';
2
+ import {Stack, Flex} from '@workday/canvas-kit-react/layout';
3
3
 
4
4
  export default () => (
5
5
  <Stack spacing="xs" border="solid 2px" flexDirection="column">
@@ -1,11 +1,10 @@
1
1
  import * as React from 'react';
2
- import {HStack, Stack, Flex} from '@workday/canvas-kit-labs-react/layout';
3
- import {Box} from '@workday/canvas-kit-labs-react/common';
2
+ import {HStack, Stack, Flex, Box} from '@workday/canvas-kit-react/layout';
4
3
  import {TertiaryButton} from '@workday/canvas-kit-react/button';
5
4
  import {type} from '@workday/canvas-kit-react/tokens';
6
5
 
7
6
  const Card = ({heading = '', body = ''}) => (
8
- <Flex flex={1} flexBasis="auto" depth={2} padding="s" backgroundColor="frenchVanilla100">
7
+ <Flex flex={1} flexBasis="auto" depth={1} padding="s" backgroundColor="frenchVanilla100">
9
8
  <Stack flexDirection="column" spacing="xs">
10
9
  <h3 style={{...type.levels.heading.small, margin: 0}}>{heading}</h3>
11
10
  <Box maxWidth={240}>
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import {Stack, Flex} from '@workday/canvas-kit-labs-react/layout';
2
+ import {Stack, Flex} from '@workday/canvas-kit-react/layout';
3
3
 
4
4
  const Cell = (props: {children: React.ReactNode}) => {
5
5
  return (
@@ -0,0 +1,28 @@
1
+ import * as React from 'react';
2
+ import {Stack, Box} from '@workday/canvas-kit-react/layout';
3
+ import {SecondaryButton} from '@workday/canvas-kit-react/button';
4
+ import {
5
+ arrowLeftIcon,
6
+ arrowRightIcon,
7
+ exportIcon,
8
+ homeIcon,
9
+ relatedActionsIcon,
10
+ resetIcon,
11
+ starIcon,
12
+ } from '@workday/canvas-system-icons-web';
13
+
14
+ export default () => {
15
+ return (
16
+ <Stack border="solid 2px" shouldWrapChildren spacing="xxxs" padding="xxxs">
17
+ <SecondaryButton aria-label="go to previous page" icon={arrowLeftIcon} />
18
+ <SecondaryButton aria-label="go to next page" icon={arrowRightIcon} />
19
+ <SecondaryButton aria-label="reload current page" icon={resetIcon} />
20
+ <SecondaryButton aria-label="go to home page" icon={homeIcon} />
21
+ <Box marginInlineStart="m">
22
+ <SecondaryButton aria-label="share current page" icon={exportIcon} />
23
+ </Box>
24
+ <SecondaryButton aria-label="bookmark current page" icon={starIcon} />
25
+ <SecondaryButton aria-label="view related actions" icon={relatedActionsIcon} />
26
+ </Stack>
27
+ );
28
+ };
@@ -1,12 +1,12 @@
1
1
  import * as React from 'react';
2
- import {Stack, Flex} from '@workday/canvas-kit-labs-react/layout';
2
+ import {Stack, Flex} from '@workday/canvas-kit-react/layout';
3
3
  import {TertiaryButton} from '@workday/canvas-kit-react/button';
4
4
  import {type} from '@workday/canvas-kit-react/tokens';
5
5
 
6
6
  export default () => {
7
7
  return (
8
8
  <Flex backgroundColor="soap100" alignItems="flex-start" padding="s">
9
- <Flex depth={2} padding="s" backgroundColor="frenchVanilla100">
9
+ <Flex depth={1} padding="s" backgroundColor="frenchVanilla100">
10
10
  <Stack flexDirection="column" spacing="xs">
11
11
  <h3 style={{...type.levels.heading.small, margin: 0}}>Stack</h3>
12
12
  <span style={{...type.levels.body.small}}>
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
- import {Stack} from '@workday/canvas-kit-labs-react/layout';
3
- import {Box} from '@workday/canvas-kit-labs-react/common';
2
+ import {Stack, Box} from '@workday/canvas-kit-react/layout';
4
3
  import {Hyperlink} from '@workday/canvas-kit-react/button';
5
4
 
6
5
  export default () => (
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react';
2
- import {VStack, Stack, Flex} from '@workday/canvas-kit-labs-react/layout';
2
+ import {VStack, Stack, Flex} from '@workday/canvas-kit-react/layout';
3
3
  import {TertiaryButton} from '@workday/canvas-kit-react/button';
4
4
  import {type} from '@workday/canvas-kit-react/tokens';
5
5
 
6
6
  const Card = ({heading = '', body = ''}) => (
7
- <Flex flex={1} flexBasis="auto" depth={2} padding="s" backgroundColor="frenchVanilla100">
7
+ <Flex flex={1} flexBasis="auto" depth={1} padding="s" backgroundColor="frenchVanilla100">
8
8
  <Stack flexDirection="column" spacing="xs">
9
9
  <h3 style={{...type.levels.heading.small, margin: 0}}>{heading}</h3>
10
10
  <span style={{...type.levels.body.small}}>{body}</span>
@@ -0,0 +1,123 @@
1
+ import {Specifications} from '@workday/canvas-kit-docs';
2
+ import {Menu} from '@workday/canvas-kit-react/menu';
3
+
4
+ import Basic from './examples/Basic';
5
+ import ContextMenu from './examples/ContextMenu';
6
+ import Icons from './examples/Icons';
7
+
8
+
9
+ # Canvas Kit Menu
10
+
11
+ `Menu` displays a list of options when triggered by an action or UI element like an icon or button.
12
+
13
+ [> Workday Design Reference](https://design.workday.com/components/popups/menus)
14
+
15
+ ## Installation
16
+
17
+ ```sh
18
+ yarn add @workday/canvas-kit-react
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ### Basic Example
24
+
25
+ `Menu` is typically triggered by an action such as pressing a button. The `Menu` comes with a
26
+ `Target` subcomponent and a Popup.
27
+
28
+ <ExampleCodeBlock code={Basic} />
29
+
30
+ `Menu` will automatically focus on the cursor item (first item by default). The `Menu` uses a menu
31
+ model which composes a list model and a popup model and sets up accessibility features for you.
32
+
33
+ `Menu` follows the
34
+ [Actions Menu pattern](https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-actions.html)
35
+ using roving tabindex. Below is table of supported keyboard shortcuts and associated actions.
36
+
37
+ | Key | Action |
38
+ | ------------------ | ------------------------------------------------------------------------------------------------------------ |
39
+ | `Enter` or `Space` | Activates the menu item and then closes the menu |
40
+ | `Escape` | Closes the menu |
41
+ | `Up Arrow` | Moves focus to the previous menu item – if focus is on first menu item, it moves focus to the last menu item |
42
+ | `Down Arrow` | Moves focus to the next menu item – if focus is on last menu item, it moves focus to the first menu item |
43
+ | `Home` | Moves focus to the first menu item |
44
+ | `End` | Moves focus to the last menu item |
45
+
46
+ ### Context Menu
47
+
48
+ <ExampleCodeBlock code={ContextMenu} />
49
+
50
+ ### Icons
51
+
52
+ <ExampleCodeBlock code={Icons} />
53
+
54
+ ## Components
55
+
56
+ ### Menu
57
+
58
+ ### Usage
59
+
60
+ `Menu` is a combination of as popup and a list. It usually has some type of target element that
61
+ expands/collapses the menu and a `menu` role and and several `menuitem` roles. Focus is managed uses
62
+ [roving tabindex](https://w3c.github.io/aria-practices/#kbd_roving_tabindex) for maximum
63
+ compatibility. A `Menu` can have two modes: `single` and `multiple`. This mode determines both how
64
+ many items can be selected as well as the default behavior when a menuitem is clicked. For the
65
+ `single` mode, selecting a `menuitem` will select and close the menu. For the `multiple` mode,
66
+ clicking a `menuitem` will toggle selection and will not close the menu.
67
+
68
+ #### Props
69
+
70
+ <ArgsTable of={Menu} />
71
+
72
+ #### Usage
73
+
74
+ Like all compound components, the `Menu` component is a container component. It is responsible for
75
+ putting a `MenuModel` in the React context for all the menu subcomponents. You can either pass this
76
+ component model config or a "hoisted" model.
77
+
78
+ With model config:
79
+
80
+ ```tsx
81
+ <Menu mode="multiple">{/* Child components */}</Menu>
82
+ ```
83
+
84
+ With a hoisted model:
85
+
86
+ ```tsx
87
+ const model = useMenuModel({
88
+ mode: 'multiple',
89
+ });
90
+
91
+ // we now have access to `model.state` and `model.events`
92
+
93
+ <Menu model={model}>{/* Child components */}</Menu>;
94
+ ```
95
+
96
+ ### Menu.Target
97
+
98
+ #### Usage
99
+
100
+ `Menu.Target` is similar to all `Popup.Target` types. The component only provides behavior and no
101
+ styling. The `as` prop is used to determine which component is rendered. This component should
102
+ forward the `ref` and apply any additional props directly to an element. The default `as` is a
103
+ `SecondaryButton`. Any Canvas Kit component should work with an `as`.
104
+
105
+ An example changing to a `PrimaryButton`
106
+
107
+ ```tsx
108
+ <Menu.Target as={PrimaryButton}>Primary Button Text</Menu.Target>
109
+ ```
110
+
111
+ This element will apply `aria-haspopup` and `aria-expanded` to inform screen readers there's a popup
112
+ associated with the element.
113
+
114
+ #### Props
115
+
116
+ Undocumented props are spread to the element provided by the `as` which is a `SecondaryButton` by
117
+ default.
118
+
119
+ <ArgsTable of={Menu.Target} />
120
+
121
+ ## Specifications
122
+
123
+ <Specifications file="Menu.spec.ts" name="Menu" />
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+
3
+ import {Menu} from '@workday/canvas-kit-react/menu';
4
+
5
+ export default () => {
6
+ const [selected, setSelected] = React.useState('');
7
+ return (
8
+ <Menu onSelect={data => setSelected(data.id)}>
9
+ <Menu.Target>Open Menu</Menu.Target>
10
+ <Menu.Popper>
11
+ <Menu.Card>
12
+ <Menu.List>
13
+ <Menu.Item>First Item</Menu.Item>
14
+ <Menu.Item>Second Item</Menu.Item>
15
+ <Menu.Divider />
16
+ <Menu.Item>Third Item (with a really, really, really long label)</Menu.Item>
17
+ <Menu.Item>Fourth Item</Menu.Item>
18
+ </Menu.List>
19
+ </Menu.Card>
20
+ </Menu.Popper>
21
+ <p>
22
+ Selected: <span data-testid="output">{selected}</span>
23
+ </p>
24
+ </Menu>
25
+ );
26
+ };
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+
3
+ import {Menu} from '@workday/canvas-kit-react/menu';
4
+
5
+ export default () => {
6
+ const [selected, setSelected] = React.useState('');
7
+ return (
8
+ <Menu onSelect={data => setSelected(data.id)}>
9
+ <Menu.TargetContext>Open Menu</Menu.TargetContext>
10
+ <Menu.Popper>
11
+ <Menu.Card>
12
+ <Menu.List>
13
+ <Menu.Item>First Item</Menu.Item>
14
+ <Menu.Item>Second Item</Menu.Item>
15
+ <Menu.Item>Third Item (with a really, really, really long label)</Menu.Item>
16
+ <Menu.Item>Fourth Item</Menu.Item>
17
+ </Menu.List>
18
+ </Menu.Card>
19
+ </Menu.Popper>
20
+ <p>
21
+ Selected: <span data-testid="output">{selected}</span>
22
+ </p>
23
+ </Menu>
24
+ );
25
+ };
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ import {
3
+ setupIcon,
4
+ uploadCloudIcon,
5
+ userIcon,
6
+ taskContactIcon,
7
+ } from '@workday/canvas-system-icons-web';
8
+ import {Menu} from '@workday/canvas-kit-react/menu';
9
+
10
+ export default () => {
11
+ return (
12
+ <Menu>
13
+ <Menu.Card>
14
+ <Menu.List>
15
+ <Menu.Item>
16
+ <Menu.Item.Icon icon={uploadCloudIcon} />
17
+ <Menu.Item.Text>First Item</Menu.Item.Text>
18
+ </Menu.Item>
19
+ <Menu.Item>
20
+ <Menu.Item.Icon icon={setupIcon} />
21
+ <Menu.Item.Text>Second Item (with a really really really long label)</Menu.Item.Text>
22
+ </Menu.Item>
23
+ <Menu.Item aria-disabled>
24
+ <Menu.Item.Icon icon={uploadCloudIcon} />
25
+ <Menu.Item.Text>Third Item</Menu.Item.Text>
26
+ <Menu.Item.Icon icon={taskContactIcon} />
27
+ </Menu.Item>
28
+ <Menu.Item>
29
+ <Menu.Item.Icon icon={userIcon} />
30
+ <Menu.Item.Text></Menu.Item.Text>
31
+ </Menu.Item>
32
+ <Menu.Divider />
33
+ <Menu.Item>
34
+ <Menu.Item.Icon icon={taskContactIcon} />
35
+ <Menu.Item.Text>Fifth Item (with divider)</Menu.Item.Text>
36
+ </Menu.Item>
37
+ </Menu.List>
38
+ </Menu.Card>
39
+ </Menu>
40
+ );
41
+ };
@@ -6,6 +6,8 @@ import WithoutCloseIcon from './examples/WithoutCloseIcon';
6
6
  import CustomFocus from './examples/CustomFocus';
7
7
  import ReturnFocus from './examples/ReturnFocus';
8
8
  import CustomTarget from './examples/CustomTarget';
9
+ import BodyOverflow from './examples/BodyOverflow';
10
+ import FullOverflow from './examples/FullOverflow';
9
11
 
10
12
 
11
13
  # Canvas Kit Modal
@@ -78,6 +80,25 @@ requires a `label` prop.
78
80
 
79
81
  <ExampleCodeBlock code={CustomTarget} />
80
82
 
83
+ ### Body Content Overflow
84
+
85
+ The Modal automatically handles overflowing content inside the `Modal.Body` element. If contents are
86
+ larger than the browser's height will allow, the content will overflow with a scrollbar. You may
87
+ need to restrict the height of your browser to observe the overflow.
88
+
89
+ <ExampleCodeBlock code={BodyOverflow} />
90
+
91
+ ### Full overlay scrolling
92
+
93
+ If content is large, scrolling the entire overlay container is an option. Use the
94
+ `Modal.OverflowOverlay` component instead of the `Modal.Overlay` component. The `Modal.Card`'s
95
+ `maxHeight` and `height` will need to be reset to `inherit` to prevent any internal overflow.
96
+
97
+ This has the effect of scrolling the heading, close button, and any action buttons. If this type of
98
+ scrolling behavior is not desired, try the [Body Content Overflow](#body-content-overflow) method.
99
+
100
+ <ExampleCodeBlock code={FullOverflow} />
101
+
81
102
  ## Components
82
103
 
83
104
  ### Modal
@@ -94,12 +115,13 @@ container component will build a default one using `useModalModel`. `Modal` is a
94
115
 
95
116
  The `Modal.Target` is any element that is meant to show the Modal. The default component rendered by
96
117
  this component is a `SecondaryButton` element. You can override this by passing the desired
97
- component via `as`. Many examples above use `as={DeleteButton}`. If you want to render an
98
- `IconButton` instead, use `as={IconButton}`. The `Modal.Target` is an alias for `Popup.Target` and
99
- uses the `usePopupTarget` hook, which provides a `ref` and an `onClick`. The provided `ref` will be
100
- used to return focus to this element when the Modal is closed. If the provided component does not
101
- forward the `ref` to an element, the fallback is to capture an element in the `onClick`. This can be
102
- overridden by providing a `returnFocusRef` to the model.
118
+ component via `as`. Many examples above use `as={DeleteButton}`. If you want to render an icon
119
+ button instead, pass an icon to the the `icon` prop and pass no children to the button. The
120
+ `Modal.Target` is an alias for `Popup.Target` and uses the `usePopupTarget` hook, which provides a
121
+ `ref` and an `onClick`. The provided `ref` will be used to return focus to this element when the
122
+ Modal is closed. If the provided component does not forward the `ref` to an element, the fallback is
123
+ to capture an element in the `onClick`. This can be overridden by providing a `returnFocusRef` to
124
+ the model.
103
125
 
104
126
  <ArgsTable of={Modal.Target} />
105
127
 
@@ -137,8 +159,8 @@ cannot use this component. The default element is an `h2` and can be changed via
137
159
 
138
160
  The `Modal.CloseIcon` is the 'X' icon in the top corner of a Modal. It always requires an
139
161
  `aria-label` which must be translated. It uses the `usePopupCloseIcon` which adds an `onClick` that
140
- will close the Modal. The default component rendered is an `IconButton` can be changed via the `as`.
141
- All props that `IconButton` takes are also available by default.
162
+ will close the Modal. The default component rendered is an `TertiaryButton` with just an icon that
163
+ can be changed via the `as`. All props that `TertiaryButton` takes are also available by default.
142
164
 
143
165
  <ArgsTable of={Modal.CloseIcon} />
144
166
 
@@ -150,9 +172,10 @@ Modal. It uses the `usePopupCloseButton` behavior hook which adds an `onClick` t
150
172
  you'll have to hoist the model. The default component rendered is a `SecondaryButton` and can be
151
173
  changed via the `as` prop. This component doesn't contain any styles and will take on the styles of
152
174
  the component given to it. For example, `as={DeleteButton}` will render a delete button.
153
- `as={IconButton}` will render an `IconButton`. If you give it a base element like `as="button"`, you
154
- are responsible for styling the element. You can add your own `onClick` to perform side effects.
155
- Your callback will be merged with the `onClick` that closes the Modal.
175
+ `as={TertiaryButton}` with no children and an `icon` will render a `TertiaryButton` styled icon
176
+ button. If you give it a base element like `as="button"`, you are responsible for styling the
177
+ element. You can add your own `onClick` to perform side effects. Your callback will be merged with
178
+ the `onClick` that closes the Modal.
156
179
 
157
180
  <ArgsTable of={Modal.CloseButton} />
158
181
 
@@ -2,7 +2,7 @@ import React from 'react';
2
2
 
3
3
  import {Modal} from '@workday/canvas-kit-react/modal';
4
4
  import {DeleteButton} from '@workday/canvas-kit-react/button';
5
- import {HStack} from '@workday/canvas-kit-labs-react';
5
+ import {HStack, Box} from '@workday/canvas-kit-react/layout';
6
6
 
7
7
  export default () => {
8
8
  const handleDelete = () => {
@@ -17,7 +17,9 @@ export default () => {
17
17
  <Modal.CloseIcon aria-label="Close" />
18
18
  <Modal.Heading>Delete Item</Modal.Heading>
19
19
  <Modal.Body>
20
- <p>Are you sure you want to delete the item?</p>
20
+ <Box as="p" marginTop={0} marginBottom="m">
21
+ Are you sure you want to delete the item?
22
+ </Box>
21
23
  <HStack spacing="s">
22
24
  <Modal.CloseButton as={DeleteButton} onClick={handleDelete}>
23
25
  Delete
@@ -0,0 +1,56 @@
1
+ import React from 'react';
2
+
3
+ import {Modal} from '@workday/canvas-kit-react/modal';
4
+ import {DeleteButton} from '@workday/canvas-kit-react/button';
5
+ import {HStack, VStack, Stack, Box} from '@workday/canvas-kit-react/layout';
6
+ import {space} from '@workday/canvas-kit-react/tokens';
7
+
8
+ export default () => {
9
+ const handleDelete = () => {
10
+ console.log('Deleted item');
11
+ };
12
+
13
+ return (
14
+ <Modal>
15
+ <Modal.Target as={DeleteButton}>Delete Item</Modal.Target>
16
+ <Modal.Overlay>
17
+ <Modal.Card>
18
+ <Modal.CloseIcon aria-label="Close" />
19
+ <Modal.Heading>Delete Item</Modal.Heading>
20
+ <Modal.Body>
21
+ <p>Are you sure you want to delete the item?</p>
22
+ <p>Are you sure you want to delete the item?</p>
23
+ <p>Are you sure you want to delete the item?</p>
24
+ <p>Are you sure you want to delete the item?</p>
25
+ <p>Are you sure you want to delete the item?</p>
26
+ <p>Are you sure you want to delete the item?</p>
27
+ <p>Are you sure you want to delete the item?</p>
28
+ <p>Are you sure you want to delete the item?</p>
29
+ <p>Are you sure you want to delete the item?</p>
30
+ <p>Are you sure you want to delete the item?</p>
31
+ <p>Are you sure you want to delete the item?</p>
32
+ <p>Are you sure you want to delete the item?</p>
33
+ <p>Are you sure you want to delete the item?</p>
34
+ <p>Are you sure you want to delete the item?</p>
35
+ <p>Are you sure you want to delete the item?</p>
36
+ <p>Are you sure you want to delete the item?</p>
37
+ <p>Are you sure you want to delete the item?</p>
38
+ <p>Are you sure you want to delete the item?</p>
39
+ <p>Are you sure you want to delete the item?</p>
40
+ <p>Are you sure you want to delete the item?</p>
41
+ <p>Are you sure you want to delete the item?</p>
42
+ <p>Are you sure you want to delete the item?</p>
43
+ <p>Are you sure you want to delete the item?</p>
44
+ <p>Are you sure you want to delete the item?</p>
45
+ </Modal.Body>
46
+ <HStack spacing="s" paddingTop="s">
47
+ <Modal.CloseButton as={DeleteButton} onClick={handleDelete}>
48
+ Delete
49
+ </Modal.CloseButton>
50
+ <Modal.CloseButton>Cancel</Modal.CloseButton>
51
+ </HStack>
52
+ </Modal.Card>
53
+ </Modal.Overlay>
54
+ </Modal>
55
+ );
56
+ };
@@ -3,7 +3,7 @@ import {Modal, useModalModel} from '@workday/canvas-kit-react/modal';
3
3
  import {DeleteButton} from '@workday/canvas-kit-react/button';
4
4
  import FormField from '@workday/canvas-kit-react/form-field';
5
5
  import TextInput from '@workday/canvas-kit-react/text-input';
6
- import {HStack} from '@workday/canvas-kit-labs-react';
6
+ import {HStack, Box} from '@workday/canvas-kit-react/layout';
7
7
 
8
8
  export default () => {
9
9
  const ref = React.useRef<HTMLInputElement>(null);
@@ -24,7 +24,9 @@ export default () => {
24
24
  <Modal.CloseIcon aria-label="Close" />
25
25
  <Modal.Heading>Delete Item</Modal.Heading>
26
26
  <Modal.Body>
27
- <p>Enter name to confirm deletion</p>
27
+ <Box as="p" marginTop={0} marginBottom="m">
28
+ Enter name to confirm deletion
29
+ </Box>
28
30
  <FormField label="Item name">
29
31
  <TextInput ref={ref} value={value} onChange={e => setValue(e.currentTarget.value)} />
30
32
  </FormField>
@@ -0,0 +1,55 @@
1
+ import React from 'react';
2
+
3
+ import {Modal} from '@workday/canvas-kit-react/modal';
4
+ import {DeleteButton} from '@workday/canvas-kit-react/button';
5
+ import {HStack} from '@workday/canvas-kit-react/layout';
6
+
7
+ export default () => {
8
+ const handleDelete = () => {
9
+ console.log('Deleted item');
10
+ };
11
+
12
+ return (
13
+ <Modal>
14
+ <Modal.Target as={DeleteButton}>Delete Item</Modal.Target>
15
+ <Modal.OverflowOverlay>
16
+ <Modal.Card maxHeight="inherit" height="inherit">
17
+ <Modal.CloseIcon aria-label="Close" />
18
+ <Modal.Heading>Delete Item</Modal.Heading>
19
+ <Modal.Body>
20
+ <p>Are you sure you want to delete the item?</p>
21
+ <p>Are you sure you want to delete the item?</p>
22
+ <p>Are you sure you want to delete the item?</p>
23
+ <p>Are you sure you want to delete the item?</p>
24
+ <p>Are you sure you want to delete the item?</p>
25
+ <p>Are you sure you want to delete the item?</p>
26
+ <p>Are you sure you want to delete the item?</p>
27
+ <p>Are you sure you want to delete the item?</p>
28
+ <p>Are you sure you want to delete the item?</p>
29
+ <p>Are you sure you want to delete the item?</p>
30
+ <p>Are you sure you want to delete the item?</p>
31
+ <p>Are you sure you want to delete the item?</p>
32
+ <p>Are you sure you want to delete the item?</p>
33
+ <p>Are you sure you want to delete the item?</p>
34
+ <p>Are you sure you want to delete the item?</p>
35
+ <p>Are you sure you want to delete the item?</p>
36
+ <p>Are you sure you want to delete the item?</p>
37
+ <p>Are you sure you want to delete the item?</p>
38
+ <p>Are you sure you want to delete the item?</p>
39
+ <p>Are you sure you want to delete the item?</p>
40
+ <p>Are you sure you want to delete the item?</p>
41
+ <p>Are you sure you want to delete the item?</p>
42
+ <p>Are you sure you want to delete the item?</p>
43
+ <p>Are you sure you want to delete the item?</p>
44
+ </Modal.Body>
45
+ <HStack spacing="s">
46
+ <Modal.CloseButton as={DeleteButton} onClick={handleDelete}>
47
+ Delete
48
+ </Modal.CloseButton>
49
+ <Modal.CloseButton>Cancel</Modal.CloseButton>
50
+ </HStack>
51
+ </Modal.Card>
52
+ </Modal.OverflowOverlay>
53
+ </Modal>
54
+ );
55
+ };
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import {Modal, useModalModel} from '@workday/canvas-kit-react/modal';
3
- import {DeleteButton, SecondaryButton} from '@workday/canvas-kit-react/button';
3
+ import {DeleteButton} from '@workday/canvas-kit-react/button';
4
4
  import {FormField} from '@workday/canvas-kit-react/form-field';
5
- import {HStack} from '@workday/canvas-kit-labs-react/layout';
5
+ import {HStack, Box} from '@workday/canvas-kit-react/layout';
6
6
  import {Select} from '@workday/canvas-kit-preview-react/select';
7
7
 
8
8
  export default () => {
@@ -39,7 +39,9 @@ export default () => {
39
39
  <Modal.CloseIcon aria-label="Close" />
40
40
  <Modal.Heading>Delete Item</Modal.Heading>
41
41
  <Modal.Body>
42
- <p>Are you sure you want to delete the item?</p>
42
+ <Box as="p" marginTop={0} marginBottom="m">
43
+ Are you sure you want to delete the item?
44
+ </Box>
43
45
  <HStack spacing="s">
44
46
  <Modal.CloseButton as={DeleteButton} onClick={handleDelete}>
45
47
  Delete
@@ -10,7 +10,7 @@ import {
10
10
  useDisableBodyScroll,
11
11
  } from '@workday/canvas-kit-react/popup';
12
12
  import {DeleteButton} from '@workday/canvas-kit-react/button';
13
- import {HStack} from '@workday/canvas-kit-labs-react';
13
+ import {HStack, Box} from '@workday/canvas-kit-react/layout';
14
14
 
15
15
  export default () => {
16
16
  const model = usePopupModel();
@@ -32,7 +32,9 @@ export default () => {
32
32
  <Modal.Card>
33
33
  <Modal.Heading>Delete Item</Modal.Heading>
34
34
  <Modal.Body>
35
- <p>Are you sure you want to delete the item?</p>
35
+ <Box as="p" marginTop={0} marginBottom="m">
36
+ Are you sure you want to delete the item?
37
+ </Box>
36
38
  <HStack spacing="s">
37
39
  <Modal.CloseButton as={DeleteButton} onClick={handleDelete}>
38
40
  Delete
@@ -11,7 +11,7 @@ import {
11
11
  export const PaginationHoistedComponent = (_: {model: PaginationModel}) => <div />;
12
12
 
13
13
  // <ArgsTable of={Pagination.PageButton} /> generates a props table with
14
- // IconButton props. Use this dummy component instead to limit the props shown.
14
+ // Button props. Use this dummy component instead to limit the props shown.
15
15
  export const PageButtonComponent = (_: {pageNumber: number}) => <div />;
16
16
 
17
17
  // <ArgsTable of={Pagination.PageListComponent} /> generates a very large props