@workday/canvas-kit-docs 5.3.0-next.3 → 5.3.0-next.32

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 (105) hide show
  1. package/LICENSE +1 -1
  2. package/dist/commonjs/lib/specs.js +429 -33
  3. package/dist/es6/lib/specs.js +429 -33
  4. package/dist/mdx/5.0-MIGRATION-GUIDE.mdx +81 -7
  5. package/dist/mdx/6.0-MIGRATION-GUIDE.mdx +560 -0
  6. package/dist/mdx/COMPOUND_COMPONENTS.mdx +31 -30
  7. package/dist/mdx/CONTRIBUTING.mdx +90 -63
  8. package/dist/mdx/TESTING.mdx +29 -5
  9. package/dist/mdx/labs-react/search-form/SearchForm.mdx +64 -0
  10. package/dist/mdx/labs-react/search-form/examples/Basic.tsx +61 -0
  11. package/dist/mdx/labs-react/search-form/examples/CustomTheme.tsx +72 -0
  12. package/dist/mdx/labs-react/search-form/examples/Grow.tsx +62 -0
  13. package/dist/mdx/labs-react/search-form/examples/PropTables.splitProps.tsx +4 -0
  14. package/dist/mdx/labs-react/search-form/examples/RTL.tsx +70 -0
  15. package/dist/mdx/labs-react/search-form/examples/Theming.tsx +64 -0
  16. package/dist/mdx/preview-react/breadcrumbs/Breadcrumbs.mdx +1 -1
  17. package/dist/mdx/preview-react/form-field/FormField.mdx +27 -0
  18. package/dist/mdx/preview-react/form-field/examples/Custom.tsx +57 -0
  19. package/dist/mdx/preview-react/menu/Menu.mdx +17 -9
  20. package/dist/mdx/preview-react/menu/examples/Basic.tsx +65 -10
  21. package/dist/mdx/preview-react/menu/examples/ContextMenu.tsx +47 -29
  22. package/dist/mdx/preview-react/menu/examples/CustomMenuItem.tsx +2 -2
  23. package/dist/mdx/preview-react/menu/examples/Icons.tsx +1 -1
  24. package/dist/mdx/preview-react/menu/examples/ManyItems.tsx +2 -2
  25. package/dist/mdx/preview-react/text-area/TextArea.mdx +122 -0
  26. package/dist/mdx/preview-react/text-area/examples/Alert.tsx +31 -0
  27. package/dist/mdx/preview-react/text-area/examples/Basic.tsx +17 -0
  28. package/dist/mdx/preview-react/text-area/examples/Disabled.tsx +17 -0
  29. package/dist/mdx/preview-react/text-area/examples/Error.tsx +40 -0
  30. package/dist/mdx/preview-react/text-area/examples/Grow.tsx +17 -0
  31. package/dist/mdx/preview-react/text-area/examples/HiddenLabel.tsx +20 -0
  32. package/dist/mdx/preview-react/text-area/examples/LabelPositionHorizontal.tsx +17 -0
  33. package/dist/mdx/preview-react/text-area/examples/LabelPositionVertical.tsx +17 -0
  34. package/dist/mdx/preview-react/text-area/examples/Placeholder.tsx +21 -0
  35. package/dist/mdx/preview-react/text-area/examples/RefForwarding.tsx +28 -0
  36. package/dist/mdx/preview-react/text-area/examples/Required.tsx +17 -0
  37. package/dist/mdx/preview-react/text-area/examples/ResizeConstraints.tsx +22 -0
  38. package/dist/mdx/preview-react/text-input/TextInput.mdx +145 -0
  39. package/dist/mdx/preview-react/text-input/examples/Alert.tsx +40 -0
  40. package/dist/mdx/preview-react/text-input/examples/Basic.tsx +17 -0
  41. package/dist/mdx/preview-react/text-input/examples/Disabled.tsx +17 -0
  42. package/dist/mdx/preview-react/text-input/examples/Error.tsx +40 -0
  43. package/dist/mdx/preview-react/text-input/examples/Grow.tsx +17 -0
  44. package/dist/mdx/preview-react/text-input/examples/HiddenLabel.tsx +20 -0
  45. package/dist/mdx/preview-react/text-input/examples/LabelPositionHorizontal.tsx +17 -0
  46. package/dist/mdx/preview-react/text-input/examples/LabelPositionVertical.tsx +17 -0
  47. package/dist/mdx/preview-react/text-input/examples/LoginForm.tsx +105 -0
  48. package/dist/mdx/preview-react/text-input/examples/Password.tsx +17 -0
  49. package/dist/mdx/preview-react/text-input/examples/Placeholder.tsx +17 -0
  50. package/dist/mdx/preview-react/text-input/examples/RefForwarding.tsx +28 -0
  51. package/dist/mdx/preview-react/text-input/examples/Required.tsx +17 -0
  52. package/dist/mdx/preview-react/text-input/examples/ThemedAlert.tsx +46 -0
  53. package/dist/mdx/preview-react/text-input/examples/ThemedError.tsx +37 -0
  54. package/dist/mdx/react/_examples/CookieBanner.mdx +8 -0
  55. package/dist/mdx/react/_examples/GlobalHeader.mdx +9 -0
  56. package/dist/mdx/react/_examples/PageHeader.mdx +8 -0
  57. package/dist/mdx/react/_examples/examples/CookieBanner.tsx +97 -0
  58. package/dist/mdx/react/_examples/examples/GlobalHeader.tsx +66 -0
  59. package/dist/mdx/react/_examples/examples/PageHeader.tsx +63 -0
  60. package/dist/mdx/react/action-bar/ActionBar.mdx +1 -1
  61. package/dist/mdx/react/button/button/Button.mdx +34 -9
  62. package/dist/mdx/react/button/button/examples/Primary.tsx +11 -1
  63. package/dist/mdx/react/button/button/examples/PrimaryInverse.tsx +14 -0
  64. package/dist/mdx/react/button/button/examples/Secondary.tsx +10 -1
  65. package/dist/mdx/react/button/button/examples/SecondaryInverse.tsx +14 -0
  66. package/dist/mdx/react/button/button/examples/Tertiary.tsx +10 -1
  67. package/dist/mdx/react/button/button/examples/TertiaryInverse.tsx +14 -0
  68. package/dist/mdx/react/button/icon-button/IconButton.mdx +1 -1
  69. package/dist/mdx/react/loading-animation/LoadingAnimation.mdx +5 -0
  70. package/dist/mdx/react/loading-animation/examples/RTL.tsx +16 -0
  71. package/dist/mdx/react/pagination/PropTables.splitprops.tsx +47 -0
  72. package/dist/mdx/react/pagination/examples/{StepControls.tsx → Basic.tsx} +1 -1
  73. package/dist/mdx/react/pagination/examples/GoToForm.tsx +1 -1
  74. package/dist/mdx/react/pagination/examples/HoistedModel.tsx +36 -22
  75. package/dist/mdx/react/pagination/examples/RTL.tsx +1 -1
  76. package/dist/mdx/react/pagination/pagination.mdx +225 -474
  77. package/dist/mdx/react/popup/Popup.mdx +96 -36
  78. package/dist/mdx/react/popup/examples/FullScreen.tsx +115 -0
  79. package/dist/mdx/react/radio/examples/Alert.tsx +3 -3
  80. package/dist/mdx/react/radio/examples/Basic.tsx +3 -3
  81. package/dist/mdx/react/radio/examples/Disabled.tsx +3 -3
  82. package/dist/mdx/react/radio/examples/Error.tsx +3 -3
  83. package/dist/mdx/react/radio/examples/LabelPosition.tsx +3 -3
  84. package/dist/mdx/react/radio/examples/NoValue.tsx +3 -3
  85. package/dist/mdx/react/radio/examples/RefForwarding.tsx +3 -3
  86. package/dist/mdx/react/radio/examples/Required.tsx +3 -3
  87. package/dist/mdx/react/segmented-control/SegmentedControl.mdx +1 -1
  88. package/dist/mdx/react/tabs/Tabs.mdx +67 -36
  89. package/dist/mdx/react/tabs/examples/DisabledTab.tsx +1 -1
  90. package/dist/mdx/react/tabs/examples/DynamicTabs.tsx +82 -38
  91. package/dist/mdx/react/tabs/examples/HoistedModel.tsx +4 -4
  92. package/dist/mdx/react/tabs/examples/Icons.tsx +36 -0
  93. package/dist/mdx/react/tabs/examples/{NamedKeys.tsx → NamedTabs.tsx} +0 -0
  94. package/dist/mdx/react/tabs/examples/OverflowTabs.tsx +58 -0
  95. package/dist/mdx/react/tabs/examples/SinglePanel.tsx +1 -1
  96. package/dist/mdx/react/text-area/TextArea.mdx +1 -1
  97. package/dist/mdx/react/toast/toast.mdx +1 -17
  98. package/dist/mdx/react/tooltip/Tooltip.mdx +9 -1
  99. package/dist/mdx/react/tooltip/examples/DelayedTooltip.tsx +16 -0
  100. package/dist/mdx/react/tooltip/examples/Ellipsis.tsx +6 -0
  101. package/package.json +5 -4
  102. package/dist/mdx/CODE_OF_CONDUCT.md +0 -68
  103. package/dist/mdx/preview-react/menu/examples/ContextMenuTarget.tsx +0 -33
  104. package/dist/mdx/preview-react/menu/examples/ControlButton.tsx +0 -84
  105. package/dist/mdx/react/pagination/examples/ShowAdditionalDetails.tsx +0 -52
@@ -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
+ };
@@ -0,0 +1,105 @@
1
+ import React from 'react';
2
+
3
+ import {useFormik} from 'formik';
4
+ import * as yup from 'yup';
5
+
6
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
7
+ import {HStack, VStack} from '@workday/canvas-kit-labs-react/layout';
8
+ import {IconButton, PrimaryButton} from '@workday/canvas-kit-react/button';
9
+ import {visibleIcon, invisibleIcon} from '@workday/canvas-system-icons-web';
10
+ import {useUniqueId} from '@workday/canvas-kit-react/common';
11
+
12
+ export default () => {
13
+ const passwordMinimum = 8;
14
+ const passwordHint = `Password should be of minimum ${passwordMinimum} characters length`;
15
+ const emailRequired = 'Email is required';
16
+ const passwordRequired = 'Password is required';
17
+
18
+ const validationSchema = yup.object({
19
+ email: yup
20
+ .string()
21
+ .email('Enter a valid email')
22
+ .required(emailRequired),
23
+ password: yup
24
+ .string()
25
+ .min(passwordMinimum, passwordHint)
26
+ .required(passwordRequired),
27
+ });
28
+
29
+ const passwordRef = React.useRef<HTMLInputElement>(null);
30
+ const [showPassword, setShowPassword] = React.useState(false);
31
+ const passwordId = useUniqueId();
32
+
33
+ const formik = useFormik({
34
+ initialValues: {
35
+ email: 'example@baz.com',
36
+ password: 'foobarbaz',
37
+ },
38
+ validationSchema: validationSchema,
39
+ onSubmit: values => {
40
+ passwordRef.current.type = 'password';
41
+
42
+ // Send data to server
43
+ setTimeout(() => {
44
+ alert(JSON.stringify(values, null, 2));
45
+ }, 0);
46
+ },
47
+ });
48
+
49
+ return (
50
+ <form onSubmit={formik.handleSubmit} action=".">
51
+ <VStack spacing='xs' alignItems='flex-start'>
52
+ <TextInput
53
+ orientation='vertical'
54
+ isRequired={true}
55
+ hasError={formik.touched.email && !!formik.errors.email}
56
+ >
57
+ <TextInput.Label>Email</TextInput.Label>
58
+ <TextInput.Field
59
+ name="email"
60
+ autoComplete="username"
61
+ placeholder="yourName@example.com"
62
+ onChange={formik.handleChange}
63
+ onBlur={formik.handleBlur}
64
+ value={formik.values.email}
65
+ />
66
+ <TextInput.Hint>{formik.touched.email && formik.errors.email}</TextInput.Hint>
67
+ </TextInput>
68
+ <TextInput
69
+ orientation='vertical'
70
+ id={passwordId}
71
+ hasError={formik.touched.password && !!formik.errors.password}
72
+ isRequired={true}
73
+ >
74
+ <TextInput.Label>Password</TextInput.Label>
75
+ <HStack spacing="xxs">
76
+ <TextInput.Field
77
+ type={showPassword ? 'text' : 'password'}
78
+ name="password"
79
+ autoComplete="current-password"
80
+ ref={passwordRef}
81
+ onChange={formik.handleChange}
82
+ onBlur={formik.handleBlur}
83
+ value={formik.values.password}
84
+ />
85
+ <IconButton
86
+ type="button"
87
+ icon={showPassword ? invisibleIcon : visibleIcon}
88
+ aria-label={showPassword ? 'Hide Password' : 'Show Password'}
89
+ aria-controls={`input-${passwordId}`}
90
+ onClick={() => {
91
+ setShowPassword(state => !state);
92
+ passwordRef.current.focus();
93
+ }}
94
+ />
95
+ </HStack>
96
+ <TextInput.Hint>
97
+ {(formik.touched.password && formik.errors.password) || passwordHint}
98
+ </TextInput.Hint>
99
+ </TextInput>
100
+
101
+ <PrimaryButton type="submit">Submit</PrimaryButton>
102
+ </VStack>
103
+ </form>
104
+ );
105
+ };
@@ -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
+ };
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import {changeFocus} from '@workday/canvas-kit-react/common';
3
+ import {VStack} from '@workday/canvas-kit-labs-react/layout';
4
+ import {SecondaryButton} from '@workday/canvas-kit-react/button';
5
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
6
+
7
+ export default () => {
8
+ const [value, setValue] = React.useState('');
9
+ const ref = React.useRef(null);
10
+
11
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
12
+ setValue(event.target.value);
13
+ };
14
+
15
+ const handleClick = () => {
16
+ changeFocus(ref.current)
17
+ };
18
+
19
+ return (
20
+ <VStack spacing='xxxs' alignItems='flex-start'>
21
+ <TextInput orientation='vertical'>
22
+ <TextInput.Label>Email</TextInput.Label>
23
+ <TextInput.Field onChange={handleChange} value={value} ref={ref} />
24
+ </TextInput>
25
+ <SecondaryButton onClick={handleClick}>Focus Text Input</SecondaryButton>
26
+ </VStack>
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
+ };
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
3
+ import {CanvasProvider, PartialEmotionCanvasTheme} from '@workday/canvas-kit-react/common';
4
+ import {colors, space} from '@workday/canvas-kit-react/tokens';
5
+
6
+ export default () => {
7
+ const [value, setValue] = React.useState('');
8
+
9
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
10
+ setValue(event.target.value);
11
+ };
12
+
13
+ const theme: PartialEmotionCanvasTheme = {
14
+ canvas: {
15
+ palette: {
16
+ common: {
17
+ focusOutline: colors.grapeSoda300,
18
+ },
19
+ error: {
20
+ main: colors.islandPunch400,
21
+ },
22
+ },
23
+ },
24
+ };
25
+
26
+ return (
27
+ <CanvasProvider theme={theme}>
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>
35
+ </CanvasProvider>
36
+ );
37
+ };
@@ -0,0 +1,8 @@
1
+ import Basic from './examples/CookieBanner';
2
+
3
+
4
+ # Canvas Kit Examples
5
+
6
+ ## CookieBanner
7
+
8
+ <ExampleCodeBlock code={Basic} />
@@ -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,97 @@
1
+ import * as React from 'react';
2
+
3
+ import {createComponent, styled, StyledType} from '@workday/canvas-kit-react/common';
4
+ import {colors, commonColors, depth, type, space} from '@workday/canvas-kit-react/tokens';
5
+ import {PrimaryButton, TertiaryButton} from '@workday/canvas-kit-react/button';
6
+
7
+ const CookieBannerItem = createComponent('div')({
8
+ displayName: 'CookieBanner.Item',
9
+ Component: ({isRow, ...elProps}: ItemProps, ref) => (
10
+ <BannerItem ref={ref} isRow={isRow} {...elProps} />
11
+ ),
12
+ });
13
+
14
+ const CookieBanner = createComponent('div')({
15
+ displayName: 'CookieBanner',
16
+ Component: (props: BannerProps, ref, Element) => <Banner ref={ref} as={Element} {...props} />,
17
+ subComponents: {Item: CookieBannerItem},
18
+ });
19
+
20
+ export default () => {
21
+ const DefaultNotice = `We use cookies to ensure that we give you the best experience on our website.
22
+ If you continue without changing your settings, we'll assume that you are willing to receive cookies.`;
23
+
24
+ return (
25
+ <ExampleContainer>
26
+ <CookieBanner isClosed={false}>
27
+ <CookieBanner.Item>{DefaultNotice}</CookieBanner.Item>
28
+ <CookieBanner.Item isRow>
29
+ <TertiaryButton>Settings</TertiaryButton>
30
+ <PrimaryButton>Continue</PrimaryButton>
31
+ </CookieBanner.Item>
32
+ </CookieBanner>
33
+ </ExampleContainer>
34
+ );
35
+ };
36
+
37
+ interface BannerProps {
38
+ isClosed?: boolean;
39
+ }
40
+
41
+ interface ItemProps {
42
+ isRow?: boolean;
43
+ }
44
+
45
+ const ExampleContainer = styled('div')({
46
+ minHeight: 84,
47
+ margin: space.xs,
48
+ position: 'relative',
49
+ });
50
+
51
+ const Banner = styled('div')<BannerProps & StyledType>(
52
+ type.levels.subtext.medium,
53
+ {
54
+ backgroundColor: commonColors.background,
55
+ borderTop: `1px solid ${colors.soap400}`,
56
+ display: 'flex',
57
+ ...depth[1],
58
+ padding: space.m,
59
+ alignItems: 'center',
60
+ justifyContent: 'space-between',
61
+ position: 'absolute',
62
+ bottom: 0,
63
+ left: 0,
64
+ right: 0,
65
+ zIndex: 99,
66
+ transition: 'transform 0.2s ease-out',
67
+ '@media (max-width: 450px)': {
68
+ flexDirection: 'column',
69
+ alignItems: 'stretch',
70
+ textAlign: 'center',
71
+ padding: `${space.s} 0`,
72
+ },
73
+ },
74
+ ({isClosed}) => isClosed && {transform: 'translateY(100%)'}
75
+ );
76
+
77
+ const BannerItem = styled('div')<ItemProps & StyledType>(
78
+ {
79
+ marginLeft: space.s,
80
+ marginRight: space.s,
81
+ '@media (max-width: 450px)': {
82
+ '&:not(:first-of-type)': {
83
+ marginTop: space.s,
84
+ '> *': {
85
+ flex: 1,
86
+ },
87
+ },
88
+ },
89
+ },
90
+ ({isRow}) =>
91
+ isRow && {
92
+ display: 'flex',
93
+ '> *': {
94
+ marginLeft: space.s,
95
+ },
96
+ }
97
+ );
@@ -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 default () => (
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} />