@workday/canvas-kit-docs 6.9.0-next.0 → 6.9.0-next.4

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 (185) 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 -2
  6. package/dist/es6/lib/Specifications.d.ts.map +1 -1
  7. package/dist/es6/lib/specs.js +259 -2
  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 +136 -0
  91. package/dist/mdx/react/collection/examples/Basic.tsx +12 -0
  92. package/dist/mdx/react/collection/examples/BasicVirtual.tsx +24 -0
  93. package/dist/mdx/react/collection/examples/DynamicItems.tsx +20 -0
  94. package/dist/mdx/react/collection/examples/IdentifiedItems.tsx +12 -0
  95. package/dist/mdx/react/collection/examples/MultiSelection.tsx +56 -0
  96. package/dist/mdx/react/collection/examples/RovingFocus.tsx +39 -0
  97. package/dist/mdx/react/collection/examples/Selection.tsx +58 -0
  98. package/dist/mdx/react/color-picker/color-input/ColorInput.mdx +2 -2
  99. package/dist/mdx/react/color-picker/color-preview/ColorPreview.mdx +2 -2
  100. package/dist/mdx/{labs-react/common → react/layout}/Box.mdx +3 -6
  101. package/dist/mdx/{labs-react → react}/layout/Flex.mdx +24 -27
  102. package/dist/mdx/{labs-react → react}/layout/Stack.mdx +98 -146
  103. package/dist/mdx/{labs-react/common → react/layout}/examples/As.tsx +1 -1
  104. package/dist/mdx/{labs-react/common → react/layout}/examples/Border.tsx +1 -1
  105. package/dist/mdx/{labs-react/common → react/layout}/examples/Color.tsx +1 -1
  106. package/dist/mdx/{labs-react/common → react/layout}/examples/Depth.tsx +9 -3
  107. package/dist/mdx/{labs-react → react}/layout/examples/Flex/FlexCard.tsx +2 -3
  108. package/dist/mdx/{labs-react → react}/layout/examples/Flex/FlexLayout.tsx +1 -1
  109. package/dist/mdx/{labs-react → react}/layout/examples/Flex/Usage.tsx +2 -3
  110. package/dist/mdx/{labs-react/common → react/layout}/examples/FlexItem.tsx +1 -2
  111. package/dist/mdx/{labs-react/common → react/layout}/examples/Layout.tsx +1 -1
  112. package/dist/mdx/{labs-react/common → react/layout}/examples/Position.tsx +1 -1
  113. package/dist/mdx/{labs-react → react}/layout/examples/PropTables.splitprops.tsx +1 -1
  114. package/dist/mdx/{labs-react/common → react/layout}/examples/Ref.tsx +1 -1
  115. package/dist/mdx/{labs-react/common → react/layout}/examples/Space.tsx +1 -1
  116. package/dist/mdx/{labs-react → react}/layout/examples/Stack/BasicStack.tsx +1 -1
  117. package/dist/mdx/{labs-react → react}/layout/examples/Stack/HStackCards.tsx +2 -3
  118. package/dist/mdx/{labs-react → react}/layout/examples/Stack/NestedStacks.tsx +1 -1
  119. package/dist/mdx/react/layout/examples/Stack/ShouldWrapChildren.tsx +28 -0
  120. package/dist/mdx/{labs-react → react}/layout/examples/Stack/StackCard.tsx +2 -2
  121. package/dist/mdx/{labs-react → react}/layout/examples/Stack/StackItems.tsx +1 -2
  122. package/dist/mdx/{labs-react → react}/layout/examples/Stack/VStackCards.tsx +2 -2
  123. package/dist/mdx/react/menu/Menu.mdx +123 -0
  124. package/dist/mdx/react/menu/examples/Basic.tsx +26 -0
  125. package/dist/mdx/react/menu/examples/ContextMenu.tsx +25 -0
  126. package/dist/mdx/react/menu/examples/Icons.tsx +41 -0
  127. package/dist/mdx/react/modal/Modal.mdx +34 -11
  128. package/dist/mdx/react/modal/examples/Basic.tsx +4 -2
  129. package/dist/mdx/react/modal/examples/BodyOverflow.tsx +56 -0
  130. package/dist/mdx/react/modal/examples/CustomFocus.tsx +4 -2
  131. package/dist/mdx/react/modal/examples/FullOverflow.tsx +55 -0
  132. package/dist/mdx/react/modal/examples/ReturnFocus.tsx +5 -3
  133. package/dist/mdx/react/modal/examples/WithoutCloseIcon.tsx +4 -2
  134. package/dist/mdx/react/pagination/PropTables.splitprops.tsx +1 -1
  135. package/dist/mdx/react/pagination/pagination.mdx +14 -14
  136. package/dist/mdx/react/popup/Popup.mdx +2 -1
  137. package/dist/mdx/react/popup/examples/Basic.tsx +1 -1
  138. package/dist/mdx/react/popup/examples/FocusRedirect.tsx +3 -2
  139. package/dist/mdx/react/popup/examples/FocusTrap.tsx +1 -1
  140. package/dist/mdx/react/popup/examples/FullScreen.tsx +1 -1
  141. package/dist/mdx/react/popup/examples/InitialFocus.tsx +4 -2
  142. package/dist/mdx/react/popup/examples/MultiplePopups.tsx +1 -1
  143. package/dist/mdx/react/popup/examples/NestedPopups.tsx +18 -18
  144. package/dist/mdx/react/popup/examples/RTL.tsx +6 -3
  145. package/dist/mdx/react/radio/Radio.mdx +7 -0
  146. package/dist/mdx/react/radio/examples/Inverse.tsx +23 -0
  147. package/dist/mdx/react/segmented-control/SegmentedControl.mdx +2 -2
  148. package/dist/mdx/react/segmented-control/examples/Basic.tsx +13 -11
  149. package/dist/mdx/react/skeleton/examples/Basic.tsx +1 -1
  150. package/dist/mdx/react/skeleton/examples/Color.tsx +1 -2
  151. package/dist/mdx/react/skeleton/examples/Simulation.tsx +11 -10
  152. package/dist/mdx/react/status-indicator/StatusIndicator.mdx +12 -0
  153. package/dist/mdx/react/status-indicator/examples/MaxWidth.tsx +30 -0
  154. package/dist/mdx/react/tabs/Tabs.mdx +14 -17
  155. package/dist/mdx/react/tabs/examples/DynamicTabs.tsx +6 -13
  156. package/dist/mdx/react/tabs/examples/HoistedModel.tsx +8 -8
  157. package/dist/mdx/react/tabs/examples/Icons.tsx +4 -4
  158. package/dist/mdx/react/tabs/examples/NamedTabs.tsx +10 -10
  159. package/dist/mdx/react/tabs/examples/OverflowTabs.tsx +4 -8
  160. package/dist/mdx/react/tabs/examples/SinglePanel.tsx +3 -3
  161. package/dist/mdx/react/text-input/examples/Basic.tsx +3 -0
  162. package/dist/mdx/react/tooltip/Tooltip.mdx +2 -2
  163. package/dist/mdx/react/tooltip/examples/Default.tsx +2 -2
  164. package/dist/mdx/react/tooltip/examples/UseTooltip.tsx +2 -2
  165. package/package.json +9 -17
  166. package/dist/mdx/labs-react/common/examples/PropTables.splitprops.tsx +0 -91
  167. package/dist/mdx/labs-react/layout/examples/Stack/ShouldWrapChildren.tsx +0 -33
  168. package/dist/mdx/react/button/icon-button/IconButton.mdx +0 -103
  169. package/dist/mdx/react/button/icon-button/examples/Circle.tsx +0 -6
  170. package/dist/mdx/react/button/icon-button/examples/CircleFilled.tsx +0 -8
  171. package/dist/mdx/react/button/icon-button/examples/Inverse.tsx +0 -20
  172. package/dist/mdx/react/button/icon-button/examples/InverseFilled.tsx +0 -20
  173. package/dist/mdx/react/button/icon-button/examples/MirroredIcon.tsx +0 -11
  174. package/dist/mdx/react/button/icon-button/examples/Plain.tsx +0 -8
  175. package/dist/mdx/react/button/icon-button/examples/Square.tsx +0 -8
  176. package/dist/mdx/react/button/icon-button/examples/SquareFilled.tsx +0 -8
  177. package/dist/mdx/react/button/icon-button/examples/Toggleable.tsx +0 -20
  178. package/ts3.5/dist/commonjs/index.d.ts +0 -4
  179. package/ts3.5/dist/commonjs/lib/Specifications.d.ts +0 -6
  180. package/ts3.5/dist/commonjs/lib/docs.d.ts +0 -5
  181. package/ts3.5/dist/commonjs/lib/specs.d.ts +0 -16
  182. package/ts3.5/dist/es6/index.d.ts +0 -4
  183. package/ts3.5/dist/es6/lib/Specifications.d.ts +0 -6
  184. package/ts3.5/dist/es6/lib/docs.d.ts +0 -5
  185. package/ts3.5/dist/es6/lib/specs.d.ts +0 -16
@@ -13,7 +13,7 @@ import {
13
13
  useTransferOnFullscreenExit,
14
14
  useTransferOnFullscreenEnter,
15
15
  } from '@workday/canvas-kit-react/popup';
16
- import {HStack, Flex} from '@workday/canvas-kit-labs-react/layout';
16
+ import {HStack, Flex} from '@workday/canvas-kit-react/layout';
17
17
  import {useIsFullscreen} from '@workday/canvas-kit-react/common';
18
18
  import screenfull from 'screenfull';
19
19
 
@@ -8,6 +8,7 @@ import {
8
8
  useInitialFocus,
9
9
  useReturnFocus,
10
10
  } from '@workday/canvas-kit-react/popup';
11
+ import {HStack} from '@workday/canvas-kit-react/layout';
11
12
 
12
13
  export default () => {
13
14
  const initialFocusRef = React.useRef(null);
@@ -29,11 +30,12 @@ export default () => {
29
30
  <Popup.Heading>Confirmation</Popup.Heading>
30
31
  <Popup.Body>
31
32
  <p id="popup-message">Your message has been sent!</p>
32
-
33
+ </Popup.Body>
34
+ <HStack spacing="s">
33
35
  <Popup.CloseButton ref={initialFocusRef} aria-describedby="popup-message">
34
36
  OK
35
37
  </Popup.CloseButton>
36
- </Popup.Body>
38
+ </HStack>
37
39
  </Popup.Card>
38
40
  </Popup.Popper>
39
41
  </Popup>
@@ -6,7 +6,7 @@ import {
6
6
  useCloseOnEscape,
7
7
  usePopupModel,
8
8
  } from '@workday/canvas-kit-react/popup';
9
- import {HStack} from '@workday/canvas-kit-labs-react/layout';
9
+ import {HStack} from '@workday/canvas-kit-react/layout';
10
10
 
11
11
  export default () => {
12
12
  const popup1 = usePopupModel();
@@ -10,7 +10,7 @@ import {
10
10
  useReturnFocus,
11
11
  } from '@workday/canvas-kit-react/popup';
12
12
  import {SecondaryButton} from '@workday/canvas-kit-react/button';
13
- import {HStack} from '@workday/canvas-kit-labs-react/layout';
13
+ import {HStack} from '@workday/canvas-kit-react/layout';
14
14
 
15
15
  export default () => {
16
16
  const popup1 = usePopupModel();
@@ -37,24 +37,24 @@ export default () => {
37
37
  <Popup.CloseIcon aria-label="Close" size="small" />
38
38
  <Popup.Body>
39
39
  <p>Contents of Popup 1</p>
40
- <Popup model={popup2}>
41
- <Popup.Target>Open Popup 2</Popup.Target>
42
- <Popup.Popper>
43
- <Popup.Card aria-label="Popup 2">
44
- <Popup.CloseIcon aria-label="Close" size="small" />
45
- <Popup.Body>
46
- <p>Contents of Popup 2</p>
47
- <HStack spacing="s">
48
- <Popup.CloseButton as={Popup.CloseButton} model={popup1}>
49
- Close Both (as)
50
- </Popup.CloseButton>
51
- <SecondaryButton {...closeBothProps}>Close Both (props)</SecondaryButton>
52
- </HStack>
53
- </Popup.Body>
54
- </Popup.Card>
55
- </Popup.Popper>
56
- </Popup>
57
40
  </Popup.Body>
41
+ <Popup model={popup2}>
42
+ <Popup.Target>Open Popup 2</Popup.Target>
43
+ <Popup.Popper>
44
+ <Popup.Card aria-label="Popup 2">
45
+ <Popup.CloseIcon aria-label="Close" size="small" />
46
+ <Popup.Body>
47
+ <p>Contents of Popup 2</p>
48
+ </Popup.Body>
49
+ <HStack spacing="s">
50
+ <Popup.CloseButton as={Popup.CloseButton} model={popup1}>
51
+ Close Both (as)
52
+ </Popup.CloseButton>
53
+ <SecondaryButton {...closeBothProps}>Close Both (props)</SecondaryButton>
54
+ </HStack>
55
+ </Popup.Card>
56
+ </Popup.Popper>
57
+ </Popup>
58
58
  </Popup.Card>
59
59
  </Popup.Popper>
60
60
  </Popup>
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import {SecondaryButton, DeleteButton} from '@workday/canvas-kit-react/button';
4
4
  import {CanvasProvider, ContentDirection} from '@workday/canvas-kit-react/common';
5
5
  import {Popup} from '@workday/canvas-kit-react/popup';
6
+ import {HStack} from '@workday/canvas-kit-react/layout';
6
7
 
7
8
  export default () => {
8
9
  return (
@@ -11,10 +12,12 @@ export default () => {
11
12
  <Popup.CloseIcon aria-label="סגור" />
12
13
  <Popup.Heading>למחוק פריט</Popup.Heading>
13
14
  <Popup.Body>
14
- <p style={{marginBottom: '24px'}}>האם ברצונך למחוק פריט זה</p>
15
- <DeleteButton style={{marginLeft: '16px'}}>לִמְחוֹק</DeleteButton>
16
- <SecondaryButton>לְבַטֵל</SecondaryButton>
15
+ <p>האם ברצונך למחוק פריט זה</p>
17
16
  </Popup.Body>
17
+ <HStack spacing="s">
18
+ <DeleteButton>לִמְחוֹק</DeleteButton>
19
+ <SecondaryButton>לְבַטֵל</SecondaryButton>
20
+ </HStack>
18
21
  </Popup.Card>
19
22
  </CanvasProvider>
20
23
  );
@@ -5,6 +5,7 @@ import {Radio, RadioGroup} from '@workday/canvas-kit-react/radio';
5
5
  import Alert from './examples/Alert';
6
6
  import Basic from './examples/Basic';
7
7
  import Disabled from './examples/Disabled';
8
+ import Inverse from './examples/Inverse';
8
9
  import Error from './examples/Error';
9
10
  import LabelPosition from './examples/LabelPosition';
10
11
  import NoValue from './examples/NoValue';
@@ -41,6 +42,12 @@ Set the `disabled` prop of the Radio Button to prevent users from interacting wi
41
42
 
42
43
  <ExampleCodeBlock code={Disabled} />
43
44
 
45
+ ### Inverse
46
+
47
+ Radio with inverse variant
48
+
49
+ <ExampleCodeBlock code={Inverse} />
50
+
44
51
  ### Radio Buttons with No Values
45
52
 
46
53
  The `value` prop may be omitted from Radio Buttons, in which case the `value` prop of the Radio
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import {FormField} from '@workday/canvas-kit-react/form-field';
3
+ import {Radio, RadioGroup} from '@workday/canvas-kit-react/radio';
4
+ import {Box} from '@workday/canvas-kit-react/layout';
5
+
6
+ export default () => {
7
+ const [value, setValue] = React.useState<string | number>('deep-dish');
8
+
9
+ const handleChange = (value: string | number) => {
10
+ setValue(value);
11
+ };
12
+
13
+ return (
14
+ <Box backgroundColor="blueberry400" padding="s">
15
+ <RadioGroup name="crust" onChange={handleChange} value={value}>
16
+ <Radio variant="inverse" label="Deep dish" value="deep-dish" />
17
+ <Radio variant="inverse" label="Thin" value="thin" />
18
+ <Radio variant="inverse" label="Gluten free" value="gluten-free" />
19
+ <Radio variant="inverse" label="Cauliflower" value="cauliflower" />
20
+ </RadioGroup>
21
+ </Box>
22
+ );
23
+ };
@@ -19,8 +19,8 @@ yarn add @workday/canvas-kit-react
19
19
 
20
20
  ### Basic Example
21
21
 
22
- Here is a basic example of a Segmented Control with multiple nested `IconButton`s. **Note:** while
23
- managing state using a unique `value` for each `IconButton` child is encouraged, you can also use
22
+ Here is a basic example of a Segmented Control with multiple nested `Button`s. **Note:** while
23
+ managing state using a unique `value` for each `Button` child is encouraged, you can also use
24
24
  indexes and omit the `value` field. It is strongly recommended to not mix these two methods.
25
25
 
26
26
  <ExampleCodeBlock code={Basic} />
@@ -6,7 +6,6 @@ import {
6
6
  deviceTabletIcon,
7
7
  percentageIcon,
8
8
  } from '@workday/canvas-system-icons-web';
9
- import {IconButton} from '@workday/canvas-kit-react/button';
10
9
  import {SegmentedControl} from '@workday/canvas-kit-react/segmented-control';
11
10
 
12
11
  export default () => {
@@ -17,20 +16,23 @@ export default () => {
17
16
 
18
17
  return (
19
18
  <SegmentedControl value={value} onChange={handleToggle}>
20
- <IconButton
19
+ <SegmentedControl.Button
21
20
  icon={listViewIcon}
22
21
  value="list-view"
23
- aria-label="List View"
24
- onClick={e => console.log('Existing IconButton onClick callback')}
22
+ onClick={e => console.log('Existing TertiaryButton onClick callback')}
23
+ id="test"
25
24
  />
26
- <IconButton
27
- icon={worksheetsIcon}
28
- value="table-view"
29
- aria-label="Table View"
30
- disabled={true}
25
+ <SegmentedControl.Button icon={worksheetsIcon} value="table-view" disabled={true} />
26
+ <SegmentedControl.Button
27
+ icon={deviceTabletIcon}
28
+ value="device-view"
29
+ aria-label="Device View"
30
+ />
31
+ <SegmentedControl.Button
32
+ icon={percentageIcon}
33
+ value="percent-view"
34
+ aria-label="Percent View"
31
35
  />
32
- <IconButton icon={deviceTabletIcon} value="device-view" aria-label="Device View" />
33
- <IconButton icon={percentageIcon} value="percent-view" aria-label="Percent View" />
34
36
  </SegmentedControl>
35
37
  );
36
38
  };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import {Skeleton} from '@workday/canvas-kit-react/skeleton';
3
- import {Box, Flex} from '@workday/canvas-kit-labs-react';
3
+ import {Box, Flex} from '@workday/canvas-kit-react/layout';
4
4
  import {borderRadius, space} from '@workday/canvas-kit-react/tokens';
5
5
 
6
6
  export default () => {
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import {Skeleton} from '@workday/canvas-kit-react/skeleton';
3
- import {Box} from '@workday/canvas-kit-labs-react/common';
4
- import {Flex} from '@workday/canvas-kit-labs-react/layout';
3
+ import {Box, Flex} from '@workday/canvas-kit-react/layout';
5
4
  import {borderRadius, colors, space} from '@workday/canvas-kit-react/tokens';
6
5
 
7
6
  export default () => {
@@ -1,6 +1,5 @@
1
- /** @jsx jsx */
2
1
  import React from 'react';
3
- import {jsx, keyframes} from '@emotion/core';
2
+ import {keyframes} from '@emotion/react';
4
3
 
5
4
  import {
6
5
  Card,
@@ -9,13 +8,15 @@ import {
9
8
  SecondaryButton,
10
9
  SystemIconCircle,
11
10
  TextInput,
11
+ styled,
12
12
  } from '@workday/canvas-kit-react';
13
13
 
14
- import {Box, Flex} from '@workday/canvas-kit-labs-react';
14
+ import {Box, Flex} from '@workday/canvas-kit-react/layout';
15
15
 
16
16
  import {Skeleton} from '@workday/canvas-kit-react/skeleton';
17
17
  import {borderRadius, space, type} from '@workday/canvas-kit-react/tokens';
18
18
  import {patternIcon} from '@workday/canvas-system-icons-web';
19
+ import {StyledType} from '@workday/canvas-kit-react/common';
19
20
 
20
21
  const fadeOut = keyframes`
21
22
  from {
@@ -27,6 +28,10 @@ const fadeOut = keyframes`
27
28
  }
28
29
  `;
29
30
 
31
+ const StyledSimulation = styled(Box)<StyledType>({
32
+ pointerEvents: 'none',
33
+ });
34
+
30
35
  export default () => {
31
36
  const [loading, setLoading] = React.useState(true);
32
37
  const [loadTime, setLoadTime] = React.useState('3000');
@@ -96,16 +101,12 @@ export default () => {
96
101
  </Box>
97
102
  )}
98
103
 
99
- <Box
104
+ <StyledSimulation
100
105
  position="absolute"
101
106
  top={0}
102
107
  left={0}
103
108
  width="100%"
104
- css={{
105
- pointerEvents: 'none',
106
- animation: !loading ? `${fadeOut} 150ms ease-out` : undefined,
107
- animationFillMode: !loading ? 'forwards' : undefined,
108
- }}
109
+ animation={!loading ? `${fadeOut} 150ms ease-out forwards` : undefined}
109
110
  >
110
111
  <Skeleton>
111
112
  <Flex alignItems="center">
@@ -120,7 +121,7 @@ export default () => {
120
121
  </Flex>
121
122
  <Skeleton.Text lineCount={3} />
122
123
  </Skeleton>
123
- </Box>
124
+ </StyledSimulation>
124
125
  </Box>
125
126
  </Card.Body>
126
127
  </Card>
@@ -3,6 +3,7 @@ import {StatusIndicator} from '@workday/canvas-kit-react/status-indicator';
3
3
  import Basic from './examples/Basic';
4
4
  import Icon from './examples/Icon';
5
5
  import Emphasis from './examples/Emphasis';
6
+ import MaxWidth from './examples/MaxWidth';
6
7
 
7
8
 
8
9
  # Canvas Kit Status Indicator
@@ -54,6 +55,17 @@ label.
54
55
 
55
56
  <ExampleCodeBlock code={Icon} />
56
57
 
58
+ ### Max Width
59
+
60
+ By default, the maximum width of a Status Indicator is `200px`. When the text in the StatusIndicator
61
+ exceeds the max width, it will be truncated with an ellipsis. This maxWidth can be customized.
62
+
63
+ Avoid truncation wherever possible by using shorter text in Status Indicators. In the case where
64
+ truncation is necessary, you should use an `OverflowTooltip`. For the full text to be accessible
65
+ when you do this, you should make the tooltip focusable with `tabIndex`.
66
+
67
+ <ExampleCodeBlock code={MaxWidth} />
68
+
57
69
  ## Props
58
70
 
59
71
  Undocumented props are spread to the outermost element rendered by Status Indicator.
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import styled from '@emotion/styled';
3
+ import {StatusIndicator} from '@workday/canvas-kit-react/status-indicator';
4
+ import {OverflowTooltip} from '@workday/canvas-kit-react/tooltip';
5
+ import {space} from '@workday/canvas-kit-react/tokens';
6
+
7
+ const StatusIndicators = styled('div')({
8
+ '& > *': {
9
+ margin: space.xxs,
10
+ },
11
+ });
12
+
13
+ export default () => {
14
+ return (
15
+ <StatusIndicators>
16
+ <StatusIndicator
17
+ label="Longer Than Normal Ellipsized Status"
18
+ type={StatusIndicator.Type.Blue}
19
+ maxWidth={250}
20
+ />
21
+ <OverflowTooltip>
22
+ <StatusIndicator
23
+ label="Overflow Tooltip On Hover/Focus Status"
24
+ type={StatusIndicator.Type.Green}
25
+ tabIndex={0}
26
+ />
27
+ </OverflowTooltip>
28
+ </StatusIndicators>
29
+ );
30
+ };
@@ -75,9 +75,9 @@ trigger an event to change the active tab.
75
75
 
76
76
  ### Named Tabs
77
77
 
78
- `Tabs.Item` and `Tabs.Panel` both take an optional `name` attribute that is used for the
79
- `onActivate` callback. This example is identical to the Basic Example, but with named tabs for the
80
- `Tabs.Item` and `Tabs.Panel` subcomponents.
78
+ `Tabs.Item` and `Tabs.Panel` both take an optional `data-id` attribute that is used for the
79
+ `onActivate` callback. This example is identical to the Basic Example, but with tabs named using
80
+ `data-id` for the `Tabs.Item` and `Tabs.Panel` subcomponents.
81
81
 
82
82
  <ExampleCodeBlock code={NamedTabs} />
83
83
 
@@ -95,9 +95,7 @@ Set the `disabled` prop of a `Tabs.Item` to `true` to disable it.
95
95
 
96
96
  ### Tab Icons
97
97
 
98
- Tabs can have icons. You must set `hasIcon` on the `Tabs.Item` and use the `Icon` and `Text`
99
- subcomponent. The `hasIcon` changes the `Tabs.Item` to change where overflow detection is from the
100
- `Tabs.Item` element to the `Tabs.Item.Text` element.
98
+ Tabs can have icons. Use the `Icon` and `Text` subcomponents.
101
99
 
102
100
  <ExampleCodeBlock code={Icons} />
103
101
 
@@ -139,17 +137,15 @@ array.
139
137
  its subcomponents using React context. It does not represent a real element.
140
138
 
141
139
  ```tsx
142
- <Tabs onActivate={({data}) => console.log('Activated tab', data.tab)}>
143
- {/* Child components */}
144
- </Tabs>
140
+ <Tabs onSelect={data => console.log('Activated tab', data.id)}>{/* Child components */}</Tabs>
145
141
  ```
146
142
 
147
143
  Alternatively, you may pass in a model using the hoisted model pattern.
148
144
 
149
145
  ```tsx
150
146
  const model = useTabsModel({
151
- onActivate({data}) {
152
- console.log('Activated Tab', data.tab);
147
+ onSelect(data) {
148
+ console.log('Activated Tab', data.id);
153
149
  },
154
150
  });
155
151
 
@@ -184,11 +180,11 @@ Undocumented props are spread to the underlying `<div>` element.
184
180
  #### Usage
185
181
 
186
182
  `Tabs.Item` is a `<button role="tab">` element. Each `Tabs.Item` is associated with a `Tabs.Panel`
187
- either by a `name` attribute or by the position in the list. If a `name` is provided, it must match
188
- the name passed to the corresponding `Tabs.Panel` component.
183
+ either by a `data-id` attribute or by the position in the list. If a `data-id` is provided, it must
184
+ match the `data-id` passed to the corresponding `Tabs.Panel` component.
189
185
 
190
186
  ```tsx
191
- <Tabs.Item name="first">First Tab</Tabs.Item>
187
+ <Tabs.Item data-id="first">First Tab</Tabs.Item>
192
188
  ```
193
189
 
194
190
  #### Props
@@ -202,11 +198,12 @@ Undocumented props are spread to the underlying `button` element.
202
198
  #### Usage
203
199
 
204
200
  `Tabs.Panel` is a `<div role="tabpanel">` element. It is focusable by default. Each `Tabs.Panel` is
205
- controlled by a `Tabs.Item` either by a `name` attribute or by the position in the list. If a `name`
206
- is provided, it must match the name passed to the corresponding `Tabs.Item` component.
201
+ controlled by a `Tabs.Item` either by a `data-id` attribute or by the position in the list. If a
202
+ `data-id` is provided, it must match the `data-id` passed to the corresponding `Tabs.Item`
203
+ component.
207
204
 
208
205
  ```tsx
209
- <Tabs.Panel name="first">{/* Contents of the tab panel */}</Tabs.Panel>
206
+ <Tabs.Panel data-id="first">{/* Contents of the tab panel */}</Tabs.Panel>
210
207
  ```
211
208
 
212
209
  #### Props
@@ -1,8 +1,6 @@
1
1
  import React from 'react';
2
- import {space} from '@workday/canvas-kit-react/tokens';
3
2
 
4
- import {Tabs, useTabsModel, TabsModel} from '@workday/canvas-kit-react/tabs';
5
- import {SelectionModel} from '../../lib/selection';
3
+ import {Tabs, useTabsModel} from '@workday/canvas-kit-react/tabs';
6
4
 
7
5
  type Tab = {
8
6
  tab: string;
@@ -19,7 +17,7 @@ export default () => {
19
17
  const addedRef = React.useRef(tabs.length - 1);
20
18
  const model = useTabsModel({
21
19
  items: tabs,
22
- shouldSelect: ({data}) => data.id !== 'add',
20
+ shouldSelect: data => data.id !== 'add',
23
21
  });
24
22
 
25
23
  // A ref of the model for the render functions to work around the caching done to lists
@@ -33,9 +31,8 @@ export default () => {
33
31
  * * **Item is selected**: Selection will be moved to the next item in the list
34
32
  * @param id The id of the item that will be removed
35
33
  */
36
- const removeItem = <T extends unknown>(id: string, model: SelectionModel<T>) => {
34
+ const removeItem = <T extends unknown>(id: string, model: ReturnType<typeof useTabsModel>) => {
37
35
  const index = model.state.items.findIndex(item => model.getId(item) === model.state.cursorId);
38
- console.log('index', index, id, model.state.cursorId, model.state.items);
39
36
  const nextIndex = index === model.state.items.length - 1 ? index - 1 : index + 1;
40
37
  const nextId = model.getId(model.state.items[nextIndex]);
41
38
  if (model.state.selectedIds[0] === id) {
@@ -80,7 +77,7 @@ export default () => {
80
77
  <Tabs model={model}>
81
78
  <Tabs.List overflowButton={<Tabs.OverflowButton>More</Tabs.OverflowButton>}>
82
79
  {(item: Tab) => (
83
- <Tabs.Item name={item.id} onKeyDown={onKeyDown(item.id)} onClick={onClick(item.id)}>
80
+ <Tabs.Item onKeyDown={onKeyDown(item.id)} onClick={onClick(item.id)}>
84
81
  {item.tab}
85
82
  </Tabs.Item>
86
83
  )}
@@ -88,16 +85,12 @@ export default () => {
88
85
  <Tabs.Menu.Popper>
89
86
  <Tabs.Menu.Card maxWidth={300} maxHeight={200}>
90
87
  <Tabs.Menu.List>
91
- {(item: Tab) => <Tabs.Menu.Item name={item.id}>{item.tab}</Tabs.Menu.Item>}
88
+ {(item: Tab) => <Tabs.Menu.Item>{item.tab}</Tabs.Menu.Item>}
92
89
  </Tabs.Menu.List>
93
90
  </Tabs.Menu.Card>
94
91
  </Tabs.Menu.Popper>
95
92
  <Tabs.Panels>
96
- {(item: Tab) => (
97
- <Tabs.Panel marginTop="m" name={item.id}>
98
- Contents of {item.tab}
99
- </Tabs.Panel>
100
- )}
93
+ {(item: Tab) => <Tabs.Panel marginTop="m">Contents of {item.tab}</Tabs.Panel>}
101
94
  </Tabs.Panels>
102
95
  </Tabs>
103
96
  );
@@ -6,8 +6,8 @@ import {Tabs, useTabsModel} from '@workday/canvas-kit-react/tabs';
6
6
 
7
7
  export default () => {
8
8
  const model = useTabsModel({
9
- onSelect({data, prevState}) {
10
- console.log('Selected Tab', data, prevState);
9
+ onSelect(data, prevState) {
10
+ console.log('Selected Tab', data.id, prevState);
11
11
  },
12
12
  });
13
13
 
@@ -15,14 +15,14 @@ export default () => {
15
15
  <>
16
16
  <Tabs model={model}>
17
17
  <Tabs.List>
18
- <Tabs.Item name="first">First Tab</Tabs.Item>
19
- <Tabs.Item name="second">Second Tab</Tabs.Item>
20
- <Tabs.Item name="third">Third Tab</Tabs.Item>
18
+ <Tabs.Item data-id="first">First Tab</Tabs.Item>
19
+ <Tabs.Item data-id="second">Second Tab</Tabs.Item>
20
+ <Tabs.Item data-id="third">Third Tab</Tabs.Item>
21
21
  </Tabs.List>
22
22
  <div style={{marginTop: space.m}}>
23
- <Tabs.Panel name="first">Contents of First Tab</Tabs.Panel>
24
- <Tabs.Panel name="second">Contents of Second Tab</Tabs.Panel>
25
- <Tabs.Panel name="third">Contents of Third Tab</Tabs.Panel>
23
+ <Tabs.Panel data-id="first">Contents of First Tab</Tabs.Panel>
24
+ <Tabs.Panel data-id="second">Contents of Second Tab</Tabs.Panel>
25
+ <Tabs.Panel data-id="third">Contents of Third Tab</Tabs.Panel>
26
26
  </div>
27
27
  </Tabs>
28
28
  <SecondaryButton
@@ -8,19 +8,19 @@ export default () => {
8
8
  return (
9
9
  <Tabs>
10
10
  <Tabs.List>
11
- <Tabs.Item hasIcon>
11
+ <Tabs.Item>
12
12
  <Tabs.Item.Icon icon={starIcon} />
13
13
  <Tabs.Item.Text>First Tab</Tabs.Item.Text>
14
14
  </Tabs.Item>
15
- <Tabs.Item hasIcon>
15
+ <Tabs.Item>
16
16
  <Tabs.Item.Icon icon={searchIcon} />
17
17
  <Tabs.Item.Text>Second Tab</Tabs.Item.Text>
18
18
  </Tabs.Item>
19
- <Tabs.Item hasIcon>
19
+ <Tabs.Item>
20
20
  <Tabs.Item.Icon icon={selectIcon} />
21
21
  <Tabs.Item.Text>Third Tab</Tabs.Item.Text>
22
22
  </Tabs.Item>
23
- <Tabs.Item hasIcon>
23
+ <Tabs.Item>
24
24
  <Tabs.Item.Icon icon={shareIcon} />
25
25
  <Tabs.Item.Text>Fourth Tab</Tabs.Item.Text>
26
26
  </Tabs.Item>
@@ -7,18 +7,18 @@ export default () => {
7
7
  return (
8
8
  <Tabs>
9
9
  <Tabs.List>
10
- <Tabs.Item name="first">First Tab</Tabs.Item>
11
- <Tabs.Item name="second">Second Tab</Tabs.Item>
12
- <Tabs.Item name="third">Third Tab</Tabs.Item>
13
- <Tabs.Item name="fourth">Fourth Tab</Tabs.Item>
14
- <Tabs.Item name="fifth">Fifth Tab</Tabs.Item>
10
+ <Tabs.Item data-id="first">First Tab</Tabs.Item>
11
+ <Tabs.Item data-id="second">Second Tab</Tabs.Item>
12
+ <Tabs.Item data-id="third">Third Tab</Tabs.Item>
13
+ <Tabs.Item data-id="fourth">Fourth Tab</Tabs.Item>
14
+ <Tabs.Item data-id="fifth">Fifth Tab</Tabs.Item>
15
15
  </Tabs.List>
16
16
  <div style={{marginTop: space.m}}>
17
- <Tabs.Panel name="first">Contents of First Tab</Tabs.Panel>
18
- <Tabs.Panel name="second">Contents of Second Tab</Tabs.Panel>
19
- <Tabs.Panel name="third">Contents of Third Tab</Tabs.Panel>
20
- <Tabs.Panel name="fourth">Contents of Fourth Tab</Tabs.Panel>
21
- <Tabs.Panel name="fifth">Contents of Fifth Tab</Tabs.Panel>
17
+ <Tabs.Panel data-id="first">Contents of First Tab</Tabs.Panel>
18
+ <Tabs.Panel data-id="second">Contents of Second Tab</Tabs.Panel>
19
+ <Tabs.Panel data-id="third">Contents of Third Tab</Tabs.Panel>
20
+ <Tabs.Panel data-id="fourth">Contents of Fourth Tab</Tabs.Panel>
21
+ <Tabs.Panel data-id="fifth">Contents of Fifth Tab</Tabs.Panel>
22
22
  </div>
23
23
  </Tabs>
24
24
  );
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
3
  import {Tabs, useTabsModel} from '@workday/canvas-kit-react/tabs';
4
- import {HStack} from '@workday/canvas-kit-labs-react';
4
+ import {HStack} from '@workday/canvas-kit-react/layout';
5
5
  import {SecondaryButton} from '@workday/canvas-kit-react/button';
6
6
 
7
7
  type MyTabItem = {
@@ -28,21 +28,17 @@ export default () => {
28
28
  <div style={{width: containerWidth}}>
29
29
  <Tabs model={model}>
30
30
  <Tabs.List overflowButton={<Tabs.OverflowButton>More</Tabs.OverflowButton>}>
31
- {(item: MyTabItem) => <Tabs.Item name={item.id}>{item.text}</Tabs.Item>}
31
+ {(item: MyTabItem) => <Tabs.Item>{item.text}</Tabs.Item>}
32
32
  </Tabs.List>
33
33
  <Tabs.Menu.Popper>
34
34
  <Tabs.Menu.Card maxWidth={300} maxHeight={200}>
35
35
  <Tabs.Menu.List>
36
- {(item: MyTabItem) => <Tabs.Menu.Item name={item.id}>{item.text}</Tabs.Menu.Item>}
36
+ {(item: MyTabItem) => <Tabs.Menu.Item>{item.text}</Tabs.Menu.Item>}
37
37
  </Tabs.Menu.List>
38
38
  </Tabs.Menu.Card>
39
39
  </Tabs.Menu.Popper>
40
40
  <Tabs.Panels>
41
- {(item: MyTabItem) => (
42
- <Tabs.Panel marginTop="m" name={item.id}>
43
- {item.contents}
44
- </Tabs.Panel>
45
- )}
41
+ {(item: MyTabItem) => <Tabs.Panel marginTop="m">{item.contents}</Tabs.Panel>}
46
42
  </Tabs.Panels>
47
43
  </Tabs>
48
44
  <hr />
@@ -23,13 +23,13 @@ export default () => {
23
23
  return (
24
24
  <Tabs model={model}>
25
25
  <Tabs.List>
26
- <Tabs.Item name="first" aria-controls="mytab-panel">
26
+ <Tabs.Item data-id="first" aria-controls="mytab-panel">
27
27
  First Tab
28
28
  </Tabs.Item>
29
- <Tabs.Item name="second" aria-controls="mytab-panel">
29
+ <Tabs.Item data-id="second" aria-controls="mytab-panel">
30
30
  Second Tab
31
31
  </Tabs.Item>
32
- <Tabs.Item name="third" aria-controls="mytab-panel">
32
+ <Tabs.Item data-id="third" aria-controls="mytab-panel">
33
33
  Third Tab
34
34
  </Tabs.Item>
35
35
  </Tabs.List>
@@ -1,3 +1,6 @@
1
+ /** @jsxRuntime classic */
2
+ /** @jsx jsx */
3
+ import {css, jsx} from '@emotion/react';
1
4
  import React from 'react';
2
5
  import {FormField} from '@workday/canvas-kit-react/form-field';
3
6
  import {TextInput} from '@workday/canvas-kit-react/text-input';