@workday/canvas-kit-docs 6.0.0-alpha.0-next.30 → 6.0.0-alpha.0-next.36
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.
- package/LICENSE +1 -1
- package/dist/commonjs/lib/specs.js +295 -33
- package/dist/es6/lib/specs.js +295 -33
- package/dist/mdx/6.0-MIGRATION-GUIDE.mdx +117 -14
- package/dist/mdx/7.0-MIGRATION-GUIDE.mdx +33 -0
- package/dist/mdx/COMPOUND_COMPONENTS.mdx +31 -30
- package/dist/mdx/CONTRIBUTING.mdx +90 -63
- package/dist/mdx/preview-react/breadcrumbs/Breadcrumbs.mdx +1 -1
- package/dist/mdx/preview-react/form-field/FormField.mdx +27 -0
- package/dist/mdx/preview-react/form-field/examples/Custom.tsx +57 -0
- package/dist/mdx/preview-react/menu/examples/Icons.tsx +1 -1
- package/dist/mdx/preview-react/menu/examples/ManyItems.tsx +1 -1
- package/dist/mdx/preview-react/text-area/TextArea.mdx +122 -0
- package/dist/mdx/preview-react/text-area/examples/Alert.tsx +31 -0
- package/dist/mdx/preview-react/text-area/examples/Basic.tsx +17 -0
- package/dist/mdx/preview-react/text-area/examples/Disabled.tsx +17 -0
- package/dist/mdx/preview-react/text-area/examples/Error.tsx +40 -0
- package/dist/mdx/preview-react/text-area/examples/Grow.tsx +17 -0
- package/dist/mdx/preview-react/text-area/examples/HiddenLabel.tsx +20 -0
- package/dist/mdx/preview-react/text-area/examples/LabelPositionHorizontal.tsx +17 -0
- package/dist/mdx/preview-react/text-area/examples/LabelPositionVertical.tsx +17 -0
- package/dist/mdx/preview-react/text-area/examples/Placeholder.tsx +21 -0
- package/dist/mdx/preview-react/text-area/examples/RefForwarding.tsx +28 -0
- package/dist/mdx/preview-react/text-area/examples/Required.tsx +17 -0
- package/dist/mdx/preview-react/text-area/examples/ResizeConstraints.tsx +22 -0
- package/dist/mdx/{labs-react → preview-react}/text-input/TextInput.mdx +40 -18
- package/dist/mdx/preview-react/text-input/examples/Alert.tsx +40 -0
- package/dist/mdx/{labs-react/text-input/examples/HiddenLabel.tsx → preview-react/text-input/examples/Basic.tsx} +3 -3
- package/dist/mdx/preview-react/text-input/examples/Disabled.tsx +17 -0
- package/dist/mdx/{labs-react → preview-react}/text-input/examples/Error.tsx +6 -9
- package/dist/mdx/preview-react/text-input/examples/Grow.tsx +17 -0
- package/dist/mdx/preview-react/text-input/examples/HiddenLabel.tsx +20 -0
- package/dist/mdx/preview-react/text-input/examples/LabelPositionHorizontal.tsx +17 -0
- package/dist/mdx/preview-react/text-input/examples/LabelPositionVertical.tsx +17 -0
- package/dist/mdx/{labs-react → preview-react}/text-input/examples/LoginForm.tsx +10 -5
- package/dist/mdx/preview-react/text-input/examples/Password.tsx +17 -0
- package/dist/mdx/preview-react/text-input/examples/Placeholder.tsx +17 -0
- package/dist/mdx/{labs-react → preview-react}/text-input/examples/RefForwarding.tsx +7 -6
- package/dist/mdx/preview-react/text-input/examples/Required.tsx +17 -0
- package/dist/mdx/preview-react/text-input/examples/ThemedAlert.tsx +46 -0
- package/dist/mdx/{labs-react → preview-react}/text-input/examples/ThemedError.tsx +8 -11
- package/dist/mdx/react/_examples/GlobalHeader.mdx +9 -0
- package/dist/mdx/react/_examples/PageHeader.mdx +8 -0
- package/dist/mdx/react/_examples/examples/GlobalHeader.tsx +66 -0
- package/dist/mdx/react/_examples/examples/PageHeader.tsx +63 -0
- package/dist/mdx/react/action-bar/ActionBar.mdx +1 -1
- package/dist/mdx/react/button/button/Button.mdx +7 -7
- package/dist/mdx/react/button/icon-button/IconButton.mdx +1 -1
- package/dist/mdx/react/loading-animation/LoadingAnimation.mdx +5 -0
- package/dist/mdx/react/loading-animation/examples/RTL.tsx +16 -0
- package/dist/mdx/react/pagination/PropTables.splitprops.tsx +47 -0
- package/dist/mdx/react/pagination/examples/{StepControls.tsx → Basic.tsx} +1 -1
- package/dist/mdx/react/pagination/examples/GoToForm.tsx +1 -1
- package/dist/mdx/react/pagination/examples/HoistedModel.tsx +36 -22
- package/dist/mdx/react/pagination/examples/RTL.tsx +1 -1
- package/dist/mdx/react/pagination/pagination.mdx +225 -474
- package/dist/mdx/react/popup/Popup.mdx +34 -36
- package/dist/mdx/react/radio/examples/Alert.tsx +3 -3
- package/dist/mdx/react/radio/examples/Basic.tsx +3 -3
- package/dist/mdx/react/radio/examples/Disabled.tsx +3 -3
- package/dist/mdx/react/radio/examples/Error.tsx +3 -3
- package/dist/mdx/react/radio/examples/LabelPosition.tsx +3 -3
- package/dist/mdx/react/radio/examples/NoValue.tsx +3 -3
- package/dist/mdx/react/radio/examples/RefForwarding.tsx +3 -3
- package/dist/mdx/react/radio/examples/Required.tsx +3 -3
- package/dist/mdx/react/segmented-control/SegmentedControl.mdx +1 -1
- package/dist/mdx/react/tabs/Tabs.mdx +67 -36
- package/dist/mdx/react/tabs/examples/DisabledTab.tsx +1 -1
- package/dist/mdx/react/tabs/examples/DynamicTabs.tsx +41 -13
- package/dist/mdx/react/tabs/examples/HoistedModel.tsx +4 -4
- package/dist/mdx/react/tabs/examples/Icons.tsx +36 -0
- package/dist/mdx/react/tabs/examples/{NamedKeys.tsx → NamedTabs.tsx} +0 -0
- package/dist/mdx/react/tabs/examples/OverflowTabs.tsx +58 -0
- package/dist/mdx/react/tabs/examples/SinglePanel.tsx +1 -1
- package/dist/mdx/react/toast/toast.mdx +1 -17
- package/dist/mdx/react/tooltip/Tooltip.mdx +9 -1
- package/dist/mdx/react/tooltip/examples/DelayedTooltip.tsx +16 -0
- package/dist/mdx/react/tooltip/examples/Ellipsis.tsx +6 -0
- package/package.json +5 -4
- package/dist/mdx/CODE_OF_CONDUCT.md +0 -68
- package/dist/mdx/labs-react/text-input/examples/Alert.tsx +0 -46
- package/dist/mdx/labs-react/text-input/examples/Basic.tsx +0 -20
- package/dist/mdx/labs-react/text-input/examples/Disabled.tsx +0 -20
- package/dist/mdx/labs-react/text-input/examples/Grow.tsx +0 -20
- package/dist/mdx/labs-react/text-input/examples/LabelPosition.tsx +0 -20
- package/dist/mdx/labs-react/text-input/examples/Password.tsx +0 -20
- package/dist/mdx/labs-react/text-input/examples/Placeholder.tsx +0 -20
- package/dist/mdx/labs-react/text-input/examples/Required.tsx +0 -20
- package/dist/mdx/labs-react/text-input/examples/ThemedAlert.tsx +0 -51
- package/dist/mdx/react/pagination/examples/ShowAdditionalDetails.tsx +0 -52
|
@@ -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-
|
|
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
|
-
<
|
|
36
|
-
<TextInput
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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-
|
|
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=
|
|
52
|
-
<TextInput
|
|
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
|
-
|
|
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 {
|
|
2
|
+
import {changeFocus} from '@workday/canvas-kit-react/common';
|
|
3
3
|
import {VStack} from '@workday/canvas-kit-labs-react/layout';
|
|
4
|
-
import {
|
|
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
|
|
16
|
+
changeFocus(ref.current)
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
return (
|
|
19
|
-
<VStack spacing=
|
|
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
|
-
<
|
|
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-
|
|
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
|
-
<
|
|
30
|
-
<TextInput
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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,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,7 +51,7 @@ when you need to place a Primary Button on a dark or colorful background such as
|
|
|
51
51
|
|
|
52
52
|
#### Props
|
|
53
53
|
|
|
54
|
-
Undocumented props are spread to the underlying
|
|
54
|
+
Undocumented props are spread to the underlying `<button>` element.
|
|
55
55
|
|
|
56
56
|
<ArgsTable of={PrimaryButton} />
|
|
57
57
|
|
|
@@ -73,7 +73,7 @@ a dark or colorful background such as `blueberry400`.
|
|
|
73
73
|
|
|
74
74
|
#### Props
|
|
75
75
|
|
|
76
|
-
Undocumented props are spread to the underlying
|
|
76
|
+
Undocumented props are spread to the underlying `<button>` element.
|
|
77
77
|
|
|
78
78
|
<ArgsTable of={SecondaryButton} />
|
|
79
79
|
|
|
@@ -97,7 +97,7 @@ a dark or colorful background such as `blueberry400`.
|
|
|
97
97
|
|
|
98
98
|
#### Props
|
|
99
99
|
|
|
100
|
-
Undocumented props are spread to the underlying
|
|
100
|
+
Undocumented props are spread to the underlying `<button>` element.
|
|
101
101
|
|
|
102
102
|
<ArgsTable of={TertiaryButton} />
|
|
103
103
|
|
|
@@ -111,16 +111,16 @@ before deleting.
|
|
|
111
111
|
|
|
112
112
|
#### Props
|
|
113
113
|
|
|
114
|
-
Undocumented props are spread to the underlying
|
|
114
|
+
Undocumented props are spread to the underlying `<button>` element.
|
|
115
115
|
|
|
116
116
|
<ArgsTable of={DeleteButton} />
|
|
117
117
|
|
|
118
118
|
### Accessible Use of the `as` Prop
|
|
119
119
|
|
|
120
120
|
Like many of our components, Buttons accept an `as` prop, which lets you change the underlying
|
|
121
|
-
semantic element - usually an
|
|
122
|
-
|
|
123
|
-
|
|
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.
|
|
124
124
|
|
|
125
125
|
## Specifications
|
|
126
126
|
|
|
@@ -98,6 +98,6 @@ The `toggle` prop can be used to make icon buttons toggleable.
|
|
|
98
98
|
|
|
99
99
|
## Props
|
|
100
100
|
|
|
101
|
-
Undocumented props are spread to the underlying
|
|
101
|
+
Undocumented props are spread to the underlying `<button>` element.
|
|
102
102
|
|
|
103
103
|
<ArgsTable of={IconButton} />
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {LoadingAnimation} from '@workday/canvas-kit-react/loading-animation';
|
|
2
2
|
|
|
3
3
|
import Basic from './examples/Basic';
|
|
4
|
+
import RTL from './examples/RTL';
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
# Canvas Kit Loading Animation
|
|
@@ -22,6 +23,10 @@ yarn add @workday/canvas-kit-react
|
|
|
22
23
|
|
|
23
24
|
<ExampleCodeBlock code={Basic} />
|
|
24
25
|
|
|
26
|
+
### Right-to-Left (RTL)
|
|
27
|
+
|
|
28
|
+
<ExampleCodeBlock code={RTL} />
|
|
29
|
+
|
|
25
30
|
## Props
|
|
26
31
|
|
|
27
32
|
Loading Animation does not have any documented props. Undocumented props are spread to its outermost
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {LoadingAnimation} from '@workday/canvas-kit-react/loading-animation';
|
|
3
|
+
import {CanvasProvider, ContentDirection} from '@workday/canvas-kit-react/common';
|
|
4
|
+
|
|
5
|
+
export default () => {
|
|
6
|
+
const theme = {
|
|
7
|
+
canvas: {
|
|
8
|
+
direction: ContentDirection.RTL,
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
return (
|
|
12
|
+
<CanvasProvider theme={theme}>
|
|
13
|
+
<LoadingAnimation />
|
|
14
|
+
</CanvasProvider>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PaginationModel,
|
|
3
|
+
PaginationState,
|
|
4
|
+
PaginationEvents,
|
|
5
|
+
UsePaginationModelConfig,
|
|
6
|
+
} from '@workday/canvas-kit-react/pagination';
|
|
7
|
+
|
|
8
|
+
// <ArgsTable of={Pagination} /> generates a very large props table given that
|
|
9
|
+
// PaginationProps includes FlexProps. Use this dummy component instead to
|
|
10
|
+
// limit the props shown.
|
|
11
|
+
export const PaginationHoistedComponent = (_: {model: PaginationModel}) => <div />;
|
|
12
|
+
|
|
13
|
+
// <ArgsTable of={Pagination.PageButton} /> generates a props table with
|
|
14
|
+
// IconButton props. Use this dummy component instead to limit the props shown.
|
|
15
|
+
export const PageButtonComponent = (_: {pageNumber: number}) => <div />;
|
|
16
|
+
|
|
17
|
+
// <ArgsTable of={Pagination.PageListComponent} /> generates a very large props
|
|
18
|
+
// table given that PageListProps includes FlexProps. Use this dummy component
|
|
19
|
+
// instead to limit the props shown.
|
|
20
|
+
export const PageListComponent = (_: {
|
|
21
|
+
/**
|
|
22
|
+
* Accepts child elements or a render prop.
|
|
23
|
+
*/
|
|
24
|
+
children: (model: PaginationModel) => React.ReactNode | React.ReactNode;
|
|
25
|
+
}) => <div />;
|
|
26
|
+
|
|
27
|
+
// <ArgsTable of={Pagination.AdditionalDetails} /> generates a very large props
|
|
28
|
+
// table given that AdditionalDetailsProps includes FlexProps. Use this dummy
|
|
29
|
+
// component instead to limit the props shown.
|
|
30
|
+
export const AdditionalDetailsComponent = (_: {
|
|
31
|
+
/**
|
|
32
|
+
* Accepts child elements or a render prop.
|
|
33
|
+
*/
|
|
34
|
+
children: (model: PaginationModel) => React.ReactNode | React.ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
shouldAnnounceToScreenReader?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
shouldHideDetails?: boolean;
|
|
43
|
+
}) => <div />;
|
|
44
|
+
|
|
45
|
+
export const PaginationModelConfigComponent = (_: UsePaginationModelConfig) => <div />;
|
|
46
|
+
export const PaginationStateComponent = (_: PaginationState) => <div />;
|
|
47
|
+
export const PaginationEventsComponent = (_: PaginationEvents) => <div />;
|
|
@@ -30,7 +30,7 @@ export default () => {
|
|
|
30
30
|
</Pagination.PageList>
|
|
31
31
|
<Pagination.StepToNextButton aria-label="Next" />
|
|
32
32
|
</Pagination.Controls>
|
|
33
|
-
<Pagination.AdditionalDetails
|
|
33
|
+
<Pagination.AdditionalDetails>
|
|
34
34
|
{({state}) =>
|
|
35
35
|
`${getVisibleResultsMin(state.currentPage, resultCount)}-${getVisibleResultsMax(
|
|
36
36
|
state.currentPage,
|
|
@@ -33,7 +33,7 @@ export default () => {
|
|
|
33
33
|
<Pagination.JumpToLastButton aria-label="Last" />
|
|
34
34
|
<Pagination.GoToForm>
|
|
35
35
|
<Pagination.GoToTextInput aria-label="Go to page number" />
|
|
36
|
-
<Pagination.GoToLabel>{({state}) => `of ${
|
|
36
|
+
<Pagination.GoToLabel>{({state}) => `of ${state.lastPage} pages`}</Pagination.GoToLabel>
|
|
37
37
|
</Pagination.GoToForm>
|
|
38
38
|
</Pagination.Controls>
|
|
39
39
|
<Pagination.AdditionalDetails shouldHideDetails>
|