@workday/canvas-kit-docs 5.3.0-next.10 → 5.3.0-next.24

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 (95) hide show
  1. package/LICENSE +1 -1
  2. package/dist/commonjs/lib/specs.js +295 -33
  3. package/dist/es6/lib/specs.js +295 -33
  4. package/dist/mdx/6.0-MIGRATION-GUIDE.mdx +265 -1
  5. package/dist/mdx/COMPOUND_COMPONENTS.mdx +31 -30
  6. package/dist/mdx/CONTRIBUTING.mdx +90 -63
  7. package/dist/mdx/preview-react/breadcrumbs/Breadcrumbs.mdx +1 -1
  8. package/dist/mdx/preview-react/form-field/FormField.mdx +27 -0
  9. package/dist/mdx/preview-react/form-field/examples/Custom.tsx +57 -0
  10. package/dist/mdx/preview-react/menu/examples/Icons.tsx +1 -1
  11. package/dist/mdx/preview-react/menu/examples/ManyItems.tsx +1 -1
  12. package/dist/mdx/preview-react/text-area/TextArea.mdx +122 -0
  13. package/dist/mdx/preview-react/text-area/examples/Alert.tsx +31 -0
  14. package/dist/mdx/preview-react/text-area/examples/Basic.tsx +17 -0
  15. package/dist/mdx/preview-react/text-area/examples/Disabled.tsx +17 -0
  16. package/dist/mdx/preview-react/text-area/examples/Error.tsx +40 -0
  17. package/dist/mdx/preview-react/text-area/examples/Grow.tsx +17 -0
  18. package/dist/mdx/preview-react/text-area/examples/HiddenLabel.tsx +20 -0
  19. package/dist/mdx/preview-react/text-area/examples/LabelPositionHorizontal.tsx +17 -0
  20. package/dist/mdx/preview-react/text-area/examples/LabelPositionVertical.tsx +17 -0
  21. package/dist/mdx/preview-react/text-area/examples/Placeholder.tsx +21 -0
  22. package/dist/mdx/preview-react/text-area/examples/RefForwarding.tsx +28 -0
  23. package/dist/mdx/preview-react/text-area/examples/Required.tsx +17 -0
  24. package/dist/mdx/preview-react/text-area/examples/ResizeConstraints.tsx +22 -0
  25. package/dist/mdx/{labs-react → preview-react}/text-input/TextInput.mdx +40 -18
  26. package/dist/mdx/preview-react/text-input/examples/Alert.tsx +40 -0
  27. package/dist/mdx/{labs-react/text-input/examples/HiddenLabel.tsx → preview-react/text-input/examples/Basic.tsx} +3 -3
  28. package/dist/mdx/preview-react/text-input/examples/Disabled.tsx +17 -0
  29. package/dist/mdx/{labs-react → preview-react}/text-input/examples/Error.tsx +6 -9
  30. package/dist/mdx/preview-react/text-input/examples/Grow.tsx +17 -0
  31. package/dist/mdx/preview-react/text-input/examples/HiddenLabel.tsx +20 -0
  32. package/dist/mdx/preview-react/text-input/examples/LabelPositionHorizontal.tsx +17 -0
  33. package/dist/mdx/preview-react/text-input/examples/LabelPositionVertical.tsx +17 -0
  34. package/dist/mdx/{labs-react → preview-react}/text-input/examples/LoginForm.tsx +10 -5
  35. package/dist/mdx/preview-react/text-input/examples/Password.tsx +17 -0
  36. package/dist/mdx/preview-react/text-input/examples/Placeholder.tsx +17 -0
  37. package/dist/mdx/{labs-react → preview-react}/text-input/examples/RefForwarding.tsx +7 -6
  38. package/dist/mdx/preview-react/text-input/examples/Required.tsx +17 -0
  39. package/dist/mdx/preview-react/text-input/examples/ThemedAlert.tsx +46 -0
  40. package/dist/mdx/{labs-react → preview-react}/text-input/examples/ThemedError.tsx +8 -11
  41. package/dist/mdx/react/_examples/GlobalHeader.mdx +9 -0
  42. package/dist/mdx/react/_examples/PageHeader.mdx +8 -0
  43. package/dist/mdx/react/_examples/examples/GlobalHeader.tsx +66 -0
  44. package/dist/mdx/react/_examples/examples/PageHeader.tsx +63 -0
  45. package/dist/mdx/react/action-bar/ActionBar.mdx +1 -1
  46. package/dist/mdx/react/button/button/Button.mdx +34 -9
  47. package/dist/mdx/react/button/button/examples/Primary.tsx +10 -1
  48. package/dist/mdx/react/button/button/examples/PrimaryInverse.tsx +14 -0
  49. package/dist/mdx/react/button/button/examples/Secondary.tsx +10 -1
  50. package/dist/mdx/react/button/button/examples/SecondaryInverse.tsx +14 -0
  51. package/dist/mdx/react/button/button/examples/Tertiary.tsx +10 -1
  52. package/dist/mdx/react/button/button/examples/TertiaryInverse.tsx +14 -0
  53. package/dist/mdx/react/button/icon-button/IconButton.mdx +1 -1
  54. package/dist/mdx/react/loading-animation/LoadingAnimation.mdx +5 -0
  55. package/dist/mdx/react/loading-animation/examples/RTL.tsx +16 -0
  56. package/dist/mdx/react/pagination/PropTables.splitprops.tsx +47 -0
  57. package/dist/mdx/react/pagination/examples/{StepControls.tsx → Basic.tsx} +1 -1
  58. package/dist/mdx/react/pagination/examples/GoToForm.tsx +1 -1
  59. package/dist/mdx/react/pagination/examples/HoistedModel.tsx +36 -22
  60. package/dist/mdx/react/pagination/examples/RTL.tsx +1 -1
  61. package/dist/mdx/react/pagination/pagination.mdx +225 -474
  62. package/dist/mdx/react/popup/Popup.mdx +34 -36
  63. package/dist/mdx/react/radio/examples/Alert.tsx +3 -3
  64. package/dist/mdx/react/radio/examples/Basic.tsx +3 -3
  65. package/dist/mdx/react/radio/examples/Disabled.tsx +3 -3
  66. package/dist/mdx/react/radio/examples/Error.tsx +3 -3
  67. package/dist/mdx/react/radio/examples/LabelPosition.tsx +3 -3
  68. package/dist/mdx/react/radio/examples/NoValue.tsx +3 -3
  69. package/dist/mdx/react/radio/examples/RefForwarding.tsx +3 -3
  70. package/dist/mdx/react/radio/examples/Required.tsx +3 -3
  71. package/dist/mdx/react/segmented-control/SegmentedControl.mdx +1 -1
  72. package/dist/mdx/react/tabs/Tabs.mdx +67 -36
  73. package/dist/mdx/react/tabs/examples/DisabledTab.tsx +1 -1
  74. package/dist/mdx/react/tabs/examples/DynamicTabs.tsx +41 -13
  75. package/dist/mdx/react/tabs/examples/HoistedModel.tsx +4 -4
  76. package/dist/mdx/react/tabs/examples/Icons.tsx +36 -0
  77. package/dist/mdx/react/tabs/examples/{NamedKeys.tsx → NamedTabs.tsx} +0 -0
  78. package/dist/mdx/react/tabs/examples/OverflowTabs.tsx +58 -0
  79. package/dist/mdx/react/tabs/examples/SinglePanel.tsx +1 -1
  80. package/dist/mdx/react/toast/toast.mdx +1 -17
  81. package/dist/mdx/react/tooltip/Tooltip.mdx +9 -1
  82. package/dist/mdx/react/tooltip/examples/DelayedTooltip.tsx +16 -0
  83. package/dist/mdx/react/tooltip/examples/Ellipsis.tsx +6 -0
  84. package/package.json +5 -4
  85. package/dist/mdx/CODE_OF_CONDUCT.md +0 -68
  86. package/dist/mdx/labs-react/text-input/examples/Alert.tsx +0 -46
  87. package/dist/mdx/labs-react/text-input/examples/Basic.tsx +0 -20
  88. package/dist/mdx/labs-react/text-input/examples/Disabled.tsx +0 -20
  89. package/dist/mdx/labs-react/text-input/examples/Grow.tsx +0 -20
  90. package/dist/mdx/labs-react/text-input/examples/LabelPosition.tsx +0 -20
  91. package/dist/mdx/labs-react/text-input/examples/Password.tsx +0 -20
  92. package/dist/mdx/labs-react/text-input/examples/Placeholder.tsx +0 -20
  93. package/dist/mdx/labs-react/text-input/examples/Required.tsx +0 -20
  94. package/dist/mdx/labs-react/text-input/examples/ThemedAlert.tsx +0 -51
  95. package/dist/mdx/react/pagination/examples/ShowAdditionalDetails.tsx +0 -52
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import {TextInput} from '@workday/canvas-kit-labs-react/text-input';
2
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
3
3
 
4
4
  export default () => {
5
5
  const [value, setValue] = React.useState('');
@@ -9,8 +9,8 @@ export default () => {
9
9
  };
10
10
 
11
11
  return (
12
- <TextInput>
13
- <TextInput.Label isVisuallyHidden={true}>Email</TextInput.Label>
12
+ <TextInput orientation='vertical'>
13
+ <TextInput.Label>Email</TextInput.Label>
14
14
  <TextInput.Field onChange={handleChange} value={value} />
15
15
  </TextInput>
16
16
  );
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
3
+
4
+ export default () => {
5
+ const [value, setValue] = React.useState('');
6
+
7
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
8
+ setValue(event.target.value);
9
+ };
10
+
11
+ return (
12
+ <TextInput orientation='vertical'>
13
+ <TextInput.Label>Email</TextInput.Label>
14
+ <TextInput.Field onChange={handleChange} value={value} disabled />
15
+ </TextInput>
16
+ );
17
+ };
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
- import {TextInput} from '@workday/canvas-kit-labs-react/text-input';
3
- import {VStack} from '@workday/canvas-kit-labs-react/layout';
2
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
4
3
  import {space} from '@workday/canvas-kit-react/tokens';
5
4
 
6
5
  export default () => {
@@ -32,12 +31,10 @@ export default () => {
32
31
  };
33
32
 
34
33
  return (
35
- <VStack spacing="xxxs" alignItems="flex-start">
36
- <TextInput hasError={hasError}>
37
- <TextInput.Label>A three letter word</TextInput.Label>
38
- <TextInput.Field onChange={handleChange} value={value} />
39
- <TextInput.Hint paddingTop={space.xxs}>{hint}</TextInput.Hint>
40
- </TextInput>
41
- </VStack>
34
+ <TextInput hasError={hasError} orientation='vertical'>
35
+ <TextInput.Label>A three letter word</TextInput.Label>
36
+ <TextInput.Field onChange={handleChange} value={value} />
37
+ <TextInput.Hint paddingTop={space.xxs}>{hint}</TextInput.Hint>
38
+ </TextInput>
42
39
  );
43
40
  };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
3
+
4
+ export default () => {
5
+ const [value, setValue] = React.useState('');
6
+
7
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
8
+ setValue(event.target.value);
9
+ };
10
+
11
+ return (
12
+ <TextInput orientation='vertical' alignItems='stretch'>
13
+ <TextInput.Label>Street Address</TextInput.Label>
14
+ <TextInput.Field onChange={handleChange} value={value} />
15
+ </TextInput>
16
+ );
17
+ };
@@ -0,0 +1,20 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/core'
3
+ import React from 'react';
4
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
5
+ import { accessibleHide } from '@workday/canvas-kit-react/common';
6
+
7
+ export default () => {
8
+ const [value, setValue] = React.useState('');
9
+
10
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
11
+ setValue(event.target.value);
12
+ };
13
+
14
+ return (
15
+ <TextInput orientation='vertical' spacing='zero'>
16
+ <TextInput.Label css={{...accessibleHide}}>Email</TextInput.Label>
17
+ <TextInput.Field onChange={handleChange} value={value} />
18
+ </TextInput>
19
+ );
20
+ };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
3
+
4
+ export default () => {
5
+ const [value, setValue] = React.useState('');
6
+
7
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
8
+ setValue(event.target.value);
9
+ };
10
+
11
+ return (
12
+ <TextInput orientation='horizontal'>
13
+ <TextInput.Label>Email</TextInput.Label>
14
+ <TextInput.Field onChange={handleChange} value={value} />
15
+ </TextInput>
16
+ );
17
+ };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
3
+
4
+ export default () => {
5
+ const [value, setValue] = React.useState('');
6
+
7
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
8
+ setValue(event.target.value);
9
+ };
10
+
11
+ return (
12
+ <TextInput orientation='vertical' spacing='xxxs'>
13
+ <TextInput.Label>Email</TextInput.Label>
14
+ <TextInput.Field onChange={handleChange} value={value} />
15
+ </TextInput>
16
+ );
17
+ };
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import {useFormik} from 'formik';
4
4
  import * as yup from 'yup';
5
5
 
6
- import {TextInput} from '@workday/canvas-kit-labs-react/text-input';
6
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
7
7
  import {HStack, VStack} from '@workday/canvas-kit-labs-react/layout';
8
8
  import {IconButton, PrimaryButton} from '@workday/canvas-kit-react/button';
9
9
  import {visibleIcon, invisibleIcon} from '@workday/canvas-system-icons-web';
@@ -48,8 +48,12 @@ export default () => {
48
48
 
49
49
  return (
50
50
  <form onSubmit={formik.handleSubmit} action=".">
51
- <VStack spacing="xs" alignItems="flex-start">
52
- <TextInput isRequired={true} hasError={formik.touched.email && !!formik.errors.email}>
51
+ <VStack spacing='xs' alignItems='flex-start'>
52
+ <TextInput
53
+ orientation='vertical'
54
+ isRequired={true}
55
+ hasError={formik.touched.email && !!formik.errors.email}
56
+ >
53
57
  <TextInput.Label>Email</TextInput.Label>
54
58
  <TextInput.Field
55
59
  name="email"
@@ -62,7 +66,8 @@ export default () => {
62
66
  <TextInput.Hint>{formik.touched.email && formik.errors.email}</TextInput.Hint>
63
67
  </TextInput>
64
68
  <TextInput
65
- inputId={passwordId}
69
+ orientation='vertical'
70
+ id={passwordId}
66
71
  hasError={formik.touched.password && !!formik.errors.password}
67
72
  isRequired={true}
68
73
  >
@@ -81,7 +86,7 @@ export default () => {
81
86
  type="button"
82
87
  icon={showPassword ? invisibleIcon : visibleIcon}
83
88
  aria-label={showPassword ? 'Hide Password' : 'Show Password'}
84
- aria-controls={passwordId}
89
+ aria-controls={`input-${passwordId}`}
85
90
  onClick={() => {
86
91
  setShowPassword(state => !state);
87
92
  passwordRef.current.focus();
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
3
+
4
+ export default () => {
5
+ const [value, setValue] = React.useState('SuperSecret1');
6
+
7
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
8
+ setValue(event.target.value);
9
+ };
10
+
11
+ return (
12
+ <TextInput orientation='vertical'>
13
+ <TextInput.Label>Password</TextInput.Label>
14
+ <TextInput.Field onChange={handleChange} value={value} type="password" />
15
+ </TextInput>
16
+ );
17
+ };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
3
+
4
+ export default () => {
5
+ const [value, setValue] = React.useState('');
6
+
7
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
8
+ setValue(event.target.value);
9
+ };
10
+
11
+ return (
12
+ <TextInput orientation='vertical'>
13
+ <TextInput.Label>Email</TextInput.Label>
14
+ <TextInput.Field onChange={handleChange} value={value} placeholder="user@email.com" />
15
+ </TextInput>
16
+ );
17
+ };
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
- import {TextInput} from '@workday/canvas-kit-labs-react/text-input';
2
+ import {changeFocus} from '@workday/canvas-kit-react/common';
3
3
  import {VStack} from '@workday/canvas-kit-labs-react/layout';
4
- import {PrimaryButton} from '@workday/canvas-kit-react/button';
4
+ import {SecondaryButton} from '@workday/canvas-kit-react/button';
5
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
5
6
 
6
7
  export default () => {
7
8
  const [value, setValue] = React.useState('');
@@ -12,16 +13,16 @@ export default () => {
12
13
  };
13
14
 
14
15
  const handleClick = () => {
15
- ref.current.focus();
16
+ changeFocus(ref.current)
16
17
  };
17
18
 
18
19
  return (
19
- <VStack spacing="xxxs" alignItems="flex-start">
20
- <TextInput>
20
+ <VStack spacing='xxxs' alignItems='flex-start'>
21
+ <TextInput orientation='vertical'>
21
22
  <TextInput.Label>Email</TextInput.Label>
22
23
  <TextInput.Field onChange={handleChange} value={value} ref={ref} />
23
24
  </TextInput>
24
- <PrimaryButton onClick={handleClick}>Focus Text Input</PrimaryButton>
25
+ <SecondaryButton onClick={handleClick}>Focus Text Input</SecondaryButton>
25
26
  </VStack>
26
27
  );
27
28
  };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
3
+
4
+ export default () => {
5
+ const [value, setValue] = React.useState('');
6
+
7
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
8
+ setValue(event.target.value);
9
+ };
10
+
11
+ return (
12
+ <TextInput isRequired={true} orientation='vertical'>
13
+ <TextInput.Label>Email</TextInput.Label>
14
+ <TextInput.Field onChange={handleChange} value={value} />
15
+ </TextInput>
16
+ );
17
+ };
@@ -0,0 +1,46 @@
1
+ /** @jsx jsx */
2
+ import {jsx} from '@emotion/core';
3
+ import React from 'react';
4
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
5
+ import {useThemedRing} from '@workday/canvas-kit-labs-react/common';
6
+ import {CanvasProvider, PartialEmotionCanvasTheme} from '@workday/canvas-kit-react/common';
7
+ import {colors, space} from '@workday/canvas-kit-react/tokens';
8
+
9
+ export default () => {
10
+ const theme: PartialEmotionCanvasTheme = {
11
+ canvas: {
12
+ palette: {
13
+ common: {
14
+ focusOutline: colors.grapeSoda300,
15
+ },
16
+ alert: {
17
+ main: colors.kiwi200,
18
+ darkest: colors.kiwi600,
19
+ },
20
+ },
21
+ },
22
+ };
23
+ return (
24
+ <CanvasProvider theme={theme}>
25
+ <AlertInput />
26
+ </CanvasProvider>
27
+ );
28
+ };
29
+
30
+ const AlertInput = () => {
31
+ const [value, setValue] = React.useState('invalid@email');
32
+
33
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
34
+ setValue(event.target.value);
35
+ };
36
+
37
+ const alertStyles = useThemedRing('alert');
38
+
39
+ return (
40
+ <TextInput orientation='vertical'>
41
+ <TextInput.Label>Email</TextInput.Label>
42
+ <TextInput.Field css={alertStyles} onChange={handleChange} value={value} />
43
+ <TextInput.Hint paddingTop={space.xxs}>Please enter a valid email.</TextInput.Hint>
44
+ </TextInput>
45
+ );
46
+ };
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
- import {TextInput} from '@workday/canvas-kit-labs-react/text-input';
3
- import {VStack} from '@workday/canvas-kit-labs-react/layout';
2
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
4
3
  import {CanvasProvider, PartialEmotionCanvasTheme} from '@workday/canvas-kit-react/common';
5
4
  import {colors, space} from '@workday/canvas-kit-react/tokens';
6
5
 
@@ -26,15 +25,13 @@ export default () => {
26
25
 
27
26
  return (
28
27
  <CanvasProvider theme={theme}>
29
- <VStack spacing="xxxs" alignItems="flex-start">
30
- <TextInput hasError={!value} isRequired={true}>
31
- <TextInput.Label>Email</TextInput.Label>
32
- <TextInput.Field onChange={handleChange} value={value} />
33
- <TextInput.Hint paddingTop={space.xxs}>
34
- {!value && 'Please enter an email.'}
35
- </TextInput.Hint>
36
- </TextInput>
37
- </VStack>
28
+ <TextInput hasError={!value} isRequired={true} orientation='vertical'>
29
+ <TextInput.Label>Email</TextInput.Label>
30
+ <TextInput.Field onChange={handleChange} value={value} />
31
+ <TextInput.Hint paddingTop={space.xxs}>
32
+ {!value && 'Please enter an email.'}
33
+ </TextInput.Hint>
34
+ </TextInput>
38
35
  </CanvasProvider>
39
36
  );
40
37
  };
@@ -0,0 +1,9 @@
1
+ import Basic from './examples/GlobalHeader';
2
+
3
+
4
+ # Canvas Kit Examples
5
+
6
+ ## GlobalHeader
7
+ Developers building internal Workday applications will likely not need to create this component. However, if you're building components to be used outside of Workday, this is a helpful reference for building a global navigation header that looks like our internal `GlobalHeader`.
8
+
9
+ <ExampleCodeBlock code={Basic} />
@@ -0,0 +1,8 @@
1
+ import {Basic} from "./examples/PageHeader";
2
+
3
+
4
+ # Canvas Kit Examples
5
+
6
+ ## PageHeader
7
+
8
+ <ExampleCodeBlock code={Basic} />
@@ -0,0 +1,66 @@
1
+ import * as React from 'react';
2
+ import {styled, createComponent, dubLogoBlue} from '@workday/canvas-kit-react/common';
3
+ import {colors, depth, space, type} from '@workday/canvas-kit-react/tokens';
4
+
5
+ import {
6
+ notificationsIcon,
7
+ inboxIcon,
8
+ justifyIcon,
9
+ assistantIcon,
10
+ } from '@workday/canvas-system-icons-web';
11
+
12
+ import {IconButton, Hyperlink} from '@workday/canvas-kit-react/button';
13
+ import {Avatar} from '@workday/canvas-kit-react/avatar';
14
+ import {SearchForm, HStack, HStackProps, StackSpacing} from '@workday/canvas-kit-labs-react';
15
+
16
+ interface HeaderItemProps extends Omit<HStackProps, 'spacing'> {
17
+ spacing?: StackSpacing;
18
+ }
19
+
20
+ export const Basic = () => (
21
+ <GlobalHeader>
22
+ <GlobalHeader.Item>
23
+ <IconButton aria-label="menu" icon={justifyIcon} />
24
+ <Hyperlink>
25
+ <WorkdayLogo dangerouslySetInnerHTML={{__html: dubLogoBlue}} />
26
+ </Hyperlink>
27
+ </GlobalHeader.Item>
28
+ <GlobalHeader.Item margin="auto" width="100%" maxWidth={`calc(${space.xxxl} * 6)`}>
29
+ <SearchForm onSubmit={() => 1} />
30
+ </GlobalHeader.Item>
31
+ <GlobalHeader.Item>
32
+ <IconButton aria-label="messages" icon={assistantIcon} />
33
+ <IconButton aria-label="notifications" icon={notificationsIcon} />
34
+ <IconButton aria-label="inbox" icon={inboxIcon} />
35
+ <Avatar size={Avatar.Size.m} variant={Avatar.Variant.Light} />
36
+ </GlobalHeader.Item>
37
+ </GlobalHeader>
38
+ );
39
+
40
+ const GlobalHeaderItem = createComponent('div')({
41
+ displayName: 'GlobalHeader.Item',
42
+ Component: ({spacing = 's', ...props}: HeaderItemProps, ref) => (
43
+ <HStack spacing={spacing} alignItems="center" marginX={space.xs} ref={ref} {...props} />
44
+ ),
45
+ });
46
+
47
+ const GlobalHeader = createComponent('header')({
48
+ displayName: 'GlobalHeader',
49
+ Component: (props, ref, Element) => <HeaderWrapper ref={ref} as={Element} {...props} />,
50
+ subComponents: {Item: GlobalHeaderItem},
51
+ });
52
+
53
+ const HeaderWrapper = styled('header')({
54
+ display: 'flex',
55
+ alignItems: 'center',
56
+ justifyContent: 'space-between',
57
+ boxSizing: 'border-box',
58
+ ...type.levels.subtext.large,
59
+ WebkitFontSmoothing: 'antialiased',
60
+ MozOsxFontSmoothing: 'grayscale',
61
+ backgroundColor: colors.frenchVanilla100,
62
+ ...depth[1],
63
+ padding: space.xxs,
64
+ });
65
+
66
+ const WorkdayLogo = styled('span')({lineHeight: 0});
@@ -0,0 +1,63 @@
1
+ import * as React from 'react';
2
+ import {styled, createComponent} from '@workday/canvas-kit-react/common';
3
+
4
+ import {colors, gradients, space, type} from '@workday/canvas-kit-react/tokens';
5
+
6
+ import {HStack, HStackProps, StackSpacing} from '@workday/canvas-kit-labs-react';
7
+ import {IconButton} from '@workday/canvas-kit-react/button';
8
+ import {justifyIcon, notificationsIcon} from '@workday/canvas-system-icons-web';
9
+
10
+ interface HeaderItemProps extends Omit<HStackProps, 'spacing'> {
11
+ spacing?: StackSpacing;
12
+ }
13
+
14
+ export default () => (
15
+ <PageHeader>
16
+ <PageHeader.Title>Page Header</PageHeader.Title>
17
+ <PageHeader.Item>
18
+ <IconButton aria-label="notifications" icon={notificationsIcon} variant="inverse" />
19
+ <IconButton aria-label="menu" icon={justifyIcon} variant="inverse" />
20
+ </PageHeader.Item>
21
+ </PageHeader>
22
+ );
23
+
24
+ const PageHeaderItem = createComponent('div')({
25
+ displayName: 'PageHeader.Item',
26
+ Component: ({spacing = 'xxs', ...props}: HeaderItemProps, ref, Element) => (
27
+ <HStack spacing={spacing} ref={ref} as={Element} {...props} />
28
+ ),
29
+ });
30
+
31
+ const PageHeaderTitle = createComponent('h2')({
32
+ displayName: 'PageHeader.Title',
33
+ Component: ({children, ...props}, ref, Element) => (
34
+ <Title ref={ref} as={Element} {...props}>
35
+ {children}
36
+ </Title>
37
+ ),
38
+ });
39
+
40
+ const PageHeader = createComponent('header')({
41
+ displayName: 'PageHeader',
42
+ Component: (props, ref, Element) => <Header ref={ref} as={Element} {...props} />,
43
+ subComponents: {Item: PageHeaderItem, Title: PageHeaderTitle},
44
+ });
45
+
46
+ const Header = styled('header')({
47
+ padding: `${space.xs} ${space.xl}`,
48
+ backgroundImage: gradients.blueberry,
49
+ color: colors.frenchVanilla100,
50
+ WebkitFontSmoothing: 'antialiased',
51
+ MozOsxFontSmoothing: 'grayscale',
52
+ display: 'flex',
53
+ alignItems: 'center',
54
+ justifyContent: 'space-between',
55
+ });
56
+
57
+ const Title = styled('h2')({
58
+ ...type.levels.heading.medium,
59
+ color: colors.frenchVanilla100,
60
+ padding: `${space.xs} 0`,
61
+ margin: 0,
62
+ whiteSpace: 'nowrap',
63
+ });
@@ -51,6 +51,6 @@ At 575px, responsive styles will take effect:
51
51
 
52
52
  ## Props
53
53
 
54
- Undocumented props are spread to the underlying container `div` element.
54
+ Undocumented props are spread to the underlying container `<div>` element.
55
55
 
56
56
  <ArgsTable of={ActionBar} />
@@ -7,8 +7,11 @@ import {
7
7
  import {Specifications} from '@workday/canvas-kit-docs';
8
8
 
9
9
  import Primary from './examples/Primary';
10
+ import PrimaryInverse from './examples/PrimaryInverse';
10
11
  import Secondary from './examples/Secondary';
12
+ import SecondaryInverse from './examples/SecondaryInverse';
11
13
  import Tertiary from './examples/Tertiary';
14
+ import TertiaryInverse from './examples/TertiaryInverse';
12
15
  import Delete from './examples/Delete';
13
16
 
14
17
 
@@ -35,11 +38,20 @@ Primary Buttons are high emphasis. Use once per screen to draw attention to the
35
38
  action. Multiple primary buttons make it confusing for the user to understand what action they
36
39
  should take. Not all screens require a Primary Button.
37
40
 
41
+ Primary Buttons have four sizes: `extraSmall`, `small`, `medium`, and `large`. Icons are supported
42
+ for every size and can be positioned to the `left` or `right` with the `iconPosition` prop.
43
+
38
44
  <ExampleCodeBlock code={Primary} />
39
45
 
46
+ Primary Buttons also have an `inverse` variant. While it looks similar to the default Secondary
47
+ Button, the default outline as well as the hover and focus states are different. Use this variant
48
+ when you need to place a Primary Button on a dark or colorful background such as `blueberry400`.
49
+
50
+ <ExampleCodeBlock code={PrimaryInverse} />
51
+
40
52
  #### Props
41
53
 
42
- Undocumented props are spread to the underlying `button` element.
54
+ Undocumented props are spread to the underlying `<button>` element.
43
55
 
44
56
  <ArgsTable of={PrimaryButton} />
45
57
 
@@ -49,13 +61,19 @@ Secondary Buttons have a medium level of emphasis. Use them for non-critical act
49
61
  Buttons can be used on most pages without restrictions and work well for multiple actions of equal
50
62
  weight. They can be used in conjunction with a Primary Button or independently.
51
63
 
52
- Use the `inverse` variants on dark or colorful backgrounds.
64
+ Secondary Buttons have four sizes: `extraSmall`, `small`, `medium`, and `large`. Icons are supported
65
+ for every size and can be positioned to the `left` or `right` with the `iconPosition` prop.
53
66
 
54
67
  <ExampleCodeBlock code={Secondary} />
55
68
 
69
+ Secondary Buttons also have an `inverse` variant. Use this when you need to place a Secondary Button on
70
+ a dark or colorful background such as `blueberry400`.
71
+
72
+ <ExampleCodeBlock code={SecondaryInverse} />
73
+
56
74
  #### Props
57
75
 
58
- Undocumented props are spread to the underlying `button` element.
76
+ Undocumented props are spread to the underlying `<button>` element.
59
77
 
60
78
  <ArgsTable of={SecondaryButton} />
61
79
 
@@ -66,13 +84,20 @@ the user may not often be looking to do. Tertiary Buttons have lower prominence
66
84
  not visible until it is interacted with. Use Tertiary Buttons for supplemental actions such as “View
67
85
  More”, “Read More” or “Select a File”. Tertiary Buttons are frequently used on Cards.
68
86
 
69
- Use the `inverse` variants on dark or colorful backgrounds.
87
+ Tertiary Buttons have three sizes: `extraSmall`, `small`, and `medium`. Icons are supported
88
+ for every size and can be positioned to the `left` or `right` with the `iconPosition` prop.
70
89
 
71
90
  <ExampleCodeBlock code={Tertiary} />
72
91
 
92
+ Tertiary Buttons also have an `inverse` variant. Use this when you need to place a Tertiary Button on
93
+ a dark or colorful background such as `blueberry400`.
94
+
95
+ <ExampleCodeBlock code={TertiaryInverse} />
96
+
97
+
73
98
  #### Props
74
99
 
75
- Undocumented props are spread to the underlying `button` element.
100
+ Undocumented props are spread to the underlying `<button>` element.
76
101
 
77
102
  <ArgsTable of={TertiaryButton} />
78
103
 
@@ -86,16 +111,16 @@ before deleting.
86
111
 
87
112
  #### Props
88
113
 
89
- Undocumented props are spread to the underlying `button` element.
114
+ Undocumented props are spread to the underlying `<button>` element.
90
115
 
91
116
  <ArgsTable of={DeleteButton} />
92
117
 
93
118
  ### Accessible Use of the `as` Prop
94
119
 
95
120
  Like many of our components, Buttons accept an `as` prop, which lets you change the underlying
96
- semantic element - usually an `a` (anchor), or a `button`. This should be done with caution to
97
- ensure the best accessibility. Generally, `button` elements should be used for actions, and `a`
98
- (anchor) elements should be used for navigation.
121
+ semantic element - usually an `<a>`, or a `<button>`. This should be done with caution to ensure the
122
+ best accessibility. Generally, `<button>` elements should be used for actions, and `<a>` elements
123
+ should be used for navigation.
99
124
 
100
125
  ## Specifications
101
126
 
@@ -1,5 +1,14 @@
1
1
  import React from 'react';
2
2
 
3
3
  import {PrimaryButton} from '@workday/canvas-kit-react/button';
4
+ import {HStack} from '@workday/canvas-kit-labs-react/layout';
5
+ import {plusIcon} from '@workday/canvas-system-icons-web';
4
6
 
5
- export default () => <PrimaryButton>Click Me</PrimaryButton>;
7
+ export default () => (
8
+ <HStack spacing="s" padding="s">
9
+ <PrimaryButton>Primary</PrimaryButton>
10
+ <PrimaryButton icon={plusIcon} iconPosition="right">
11
+ Primary
12
+ </PrimaryButton>
13
+ </HStack>
14
+ );
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+
3
+ import {PrimaryButton} from '@workday/canvas-kit-react/button';
4
+ import {HStack} from '@workday/canvas-kit-labs-react/layout';
5
+ import {plusIcon} from '@workday/canvas-system-icons-web';
6
+
7
+ export default () => (
8
+ <HStack spacing="s" backgroundColor="blueberry400" padding="s">
9
+ <PrimaryButton variant="inverse">Primary</PrimaryButton>
10
+ <PrimaryButton icon={plusIcon} iconPosition="right" variant="inverse">
11
+ Primary
12
+ </PrimaryButton>
13
+ </HStack>
14
+ );
@@ -1,5 +1,14 @@
1
1
  import React from 'react';
2
2
 
3
3
  import {SecondaryButton} from '@workday/canvas-kit-react/button';
4
+ import {HStack} from '@workday/canvas-kit-labs-react/layout';
5
+ import {plusIcon} from '@workday/canvas-system-icons-web';
4
6
 
5
- export default () => <SecondaryButton>Click Me</SecondaryButton>;
7
+ export default () => (
8
+ <HStack spacing="s" padding="s">
9
+ <SecondaryButton>Secondary</SecondaryButton>
10
+ <SecondaryButton icon={plusIcon} iconPosition="right">
11
+ Secondary
12
+ </SecondaryButton>
13
+ </HStack>
14
+ );