@workday/canvas-kit-docs 8.0.0-alpha.144-next.0 → 8.0.0-alpha.151-next.3
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/dist/mdx/8.0-UPGRADE-GUIDE.mdx +28 -2
- package/dist/mdx/preview-react/_examples/examples/SidePanelWithOverlay.tsx +5 -8
- package/dist/mdx/preview-react/side-panel/examples/AlwaysOpen.tsx +12 -9
- package/dist/mdx/preview-react/side-panel/examples/Basic.tsx +11 -9
- package/dist/mdx/preview-react/side-panel/examples/ExternalControl.tsx +10 -9
- package/dist/mdx/preview-react/side-panel/examples/RightOrigin.tsx +10 -8
- package/dist/mdx/preview-react/side-panel/examples/Variant.tsx +11 -9
- package/dist/mdx/preview-react/text-area/examples/Alert.tsx +3 -2
- package/dist/mdx/react/_examples/examples/PageHeader.tsx +13 -11
- package/dist/mdx/react/layout/Box.mdx +30 -3
- package/dist/mdx/react/layout/Grid.mdx +130 -0
- package/dist/mdx/react/layout/examples/Flex/FlexCard.tsx +7 -19
- package/dist/mdx/react/layout/examples/Flex/Usage.tsx +31 -48
- package/dist/mdx/react/layout/examples/Font.tsx +21 -0
- package/dist/mdx/react/layout/examples/Grid/GridCard.tsx +44 -0
- package/dist/mdx/react/layout/examples/Grid/GridLayout.tsx +65 -0
- package/dist/mdx/react/layout/examples/Grid/GridLayoutInteractive.tsx +114 -0
- package/dist/mdx/react/layout/examples/Grid/UIExample.tsx +71 -0
- package/dist/mdx/react/layout/examples/PropTables.splitprops.tsx +3 -1
- package/dist/mdx/react/layout/examples/Stack/HStackCards.tsx +7 -3
- package/dist/mdx/react/layout/examples/Stack/StackCard.tsx +6 -4
- package/dist/mdx/react/layout/examples/Stack/VStackCards.tsx +7 -3
- package/dist/mdx/react/layout/examples/Text.tsx +32 -0
- package/dist/mdx/react/radio/examples/NoValue.tsx +2 -2
- package/dist/mdx/react/skeleton/examples/Simulation.tsx +4 -8
- package/dist/mdx/react/text/PropTables.splitprops.tsx +15 -0
- package/dist/mdx/react/text/Text.mdx +129 -0
- package/dist/mdx/react/text/examples/BodyText.tsx +10 -0
- package/dist/mdx/react/text/examples/Heading.tsx +16 -0
- package/dist/mdx/react/text/examples/Label.tsx +14 -0
- package/dist/mdx/react/text/examples/Subtext.tsx +10 -0
- package/dist/mdx/react/text/examples/Text.tsx +23 -0
- package/dist/mdx/react/text/examples/Title.tsx +16 -0
- package/package.json +3 -3
|
@@ -1,23 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {Flex, FlexProps
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
// temporary placeholder until type components are added to canvas-kit
|
|
6
|
-
const H3 = props => (
|
|
7
|
-
<h3
|
|
8
|
-
style={{
|
|
9
|
-
...type.levels.body.large,
|
|
10
|
-
...type.variants.inverse,
|
|
11
|
-
margin: 0,
|
|
12
|
-
fontWeight: type.properties.fontWeights.bold,
|
|
13
|
-
}}
|
|
14
|
-
{...props}
|
|
15
|
-
/>
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
const Body = props => (
|
|
19
|
-
<p style={{...type.levels.body.small, ...type.variants.inverse, margin: 0}} {...props} />
|
|
20
|
-
);
|
|
2
|
+
import {Flex, FlexProps} from '@workday/canvas-kit-react/layout';
|
|
3
|
+
import {BodyText} from '@workday/canvas-kit-react/text';
|
|
21
4
|
|
|
22
5
|
const Card = ({children, ...props}: FlexProps) => (
|
|
23
6
|
<Flex
|
|
@@ -40,41 +23,41 @@ export default () => {
|
|
|
40
23
|
<h2>Canvas Principles</h2>
|
|
41
24
|
<Flex alignItems="stretch" flexWrap="wrap">
|
|
42
25
|
<Card backgroundColor="blueberry400">
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
</
|
|
26
|
+
<BodyText as="h3" size="large" variant="inverse" fontWeight="bold" margin={0}>
|
|
27
|
+
Empower over Enforce
|
|
28
|
+
</BodyText>
|
|
29
|
+
<BodyText size="small" variant="inverse" margin={0} paddingY="xs">
|
|
30
|
+
Encourage our user's expression. Stay out of the way and provide them with the tools and
|
|
31
|
+
resources to build their vision.
|
|
32
|
+
</BodyText>
|
|
50
33
|
</Card>
|
|
51
34
|
<Card backgroundColor="juicyPear500">
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
</
|
|
35
|
+
<BodyText as="h3" size="large" variant="inverse" fontWeight="bold" margin={0}>
|
|
36
|
+
Evolution over Perfection
|
|
37
|
+
</BodyText>
|
|
38
|
+
<BodyText size="small" variant="inverse" margin={0} paddingY="xs">
|
|
39
|
+
Nothing is ever perfect – embrace that. Make educated assumptions, validate and test our
|
|
40
|
+
decisions, then iterate! Aim of continous rather than perfect solutions.
|
|
41
|
+
</BodyText>
|
|
59
42
|
</Card>
|
|
60
43
|
<Card backgroundColor="chiliMango400">
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
</
|
|
44
|
+
<BodyText as="h3" size="large" variant="inverse" fontWeight="bold" margin={0}>
|
|
45
|
+
Simple over Clever
|
|
46
|
+
</BodyText>
|
|
47
|
+
<BodyText size="small" variant="inverse" margin={0} paddingY="xs">
|
|
48
|
+
Simple solutions invite the user in - clever solutions invite complexity. Make the
|
|
49
|
+
system easy and predictable, and progressively disclose advanced functionality.
|
|
50
|
+
</BodyText>
|
|
68
51
|
</Card>
|
|
69
52
|
<Card backgroundColor="blackberry400">
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
</
|
|
53
|
+
<BodyText as="h3" size="large" variant="inverse" fontWeight="bold" margin={0}>
|
|
54
|
+
Everyone over Every One
|
|
55
|
+
</BodyText>
|
|
56
|
+
<BodyText size="small" variant="inverse" margin={0} paddingY="xs">
|
|
57
|
+
Each piece of the system is designs and built to be accessible, while still providing
|
|
58
|
+
the best experience for all consumers. But not if something is focused on a single use
|
|
59
|
+
case and negates the usability for others.
|
|
60
|
+
</BodyText>
|
|
78
61
|
</Card>
|
|
79
62
|
</Flex>
|
|
80
63
|
</Flex>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {Box} from '@workday/canvas-kit-react/layout';
|
|
3
|
+
|
|
4
|
+
export default () => (
|
|
5
|
+
<>
|
|
6
|
+
<Box fontSize={14} fontWeight="bold" border="1px solid black" margin="xxs" padding="s">
|
|
7
|
+
Default font, 14px, medium weight
|
|
8
|
+
</Box>
|
|
9
|
+
<Box
|
|
10
|
+
fontFamily="monospace"
|
|
11
|
+
fontSize={12}
|
|
12
|
+
fontWeight="bold"
|
|
13
|
+
fontStyle="italic"
|
|
14
|
+
border="1px solid black"
|
|
15
|
+
margin="xxs"
|
|
16
|
+
padding="s"
|
|
17
|
+
>
|
|
18
|
+
Monospace font, 12px, italic style
|
|
19
|
+
</Box>
|
|
20
|
+
</>
|
|
21
|
+
);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {Grid, Box} from '@workday/canvas-kit-react/layout';
|
|
3
|
+
import {PrimaryButton, SecondaryButton} from '@workday/canvas-kit-react/button';
|
|
4
|
+
import {type} from '@workday/canvas-kit-react/tokens';
|
|
5
|
+
|
|
6
|
+
// temporary placeholder until type components are added to canvas-kit
|
|
7
|
+
const H3 = props => (
|
|
8
|
+
<h3
|
|
9
|
+
style={{
|
|
10
|
+
...type.levels.body.large,
|
|
11
|
+
margin: 0,
|
|
12
|
+
fontWeight: type.properties.fontWeights.bold,
|
|
13
|
+
}}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const Body = props => <p style={{...type.levels.body.small, margin: 0}} {...props} />;
|
|
19
|
+
|
|
20
|
+
export default () => {
|
|
21
|
+
const [isComplete, setIsComplete] = React.useState(false);
|
|
22
|
+
return (
|
|
23
|
+
<Grid
|
|
24
|
+
padding="m"
|
|
25
|
+
depth={1}
|
|
26
|
+
borderRadius="l"
|
|
27
|
+
border="solid 1px"
|
|
28
|
+
borderColor="soap400"
|
|
29
|
+
maxWidth={600}
|
|
30
|
+
gridTemplate="auto / auto"
|
|
31
|
+
>
|
|
32
|
+
<H3>Learn about Grid {isComplete && '🥳'}</H3>
|
|
33
|
+
<Box paddingY="s">
|
|
34
|
+
<Body>Complete this task when you have a functional understanding of Grid.</Body>
|
|
35
|
+
</Box>
|
|
36
|
+
<Grid gridTemplate="auto / 1fr auto" justifyItems="end">
|
|
37
|
+
<Box marginRight="xxs">
|
|
38
|
+
<PrimaryButton onClick={() => setIsComplete(true)}>Complete</PrimaryButton>
|
|
39
|
+
</Box>
|
|
40
|
+
<SecondaryButton onClick={() => setIsComplete(false)}>Cancel</SecondaryButton>
|
|
41
|
+
</Grid>
|
|
42
|
+
</Grid>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {Grid} from '@workday/canvas-kit-react/layout';
|
|
3
|
+
|
|
4
|
+
const Cell = (props: {children: React.ReactNode}) => {
|
|
5
|
+
return (
|
|
6
|
+
<Grid
|
|
7
|
+
alignContent="center"
|
|
8
|
+
padding="xs"
|
|
9
|
+
justifyContent="center"
|
|
10
|
+
backgroundColor="soap500"
|
|
11
|
+
color="blackPepper500"
|
|
12
|
+
borderRadius="m"
|
|
13
|
+
>
|
|
14
|
+
{props.children}
|
|
15
|
+
</Grid>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const CellItem = (props: {children: React.ReactNode}) => {
|
|
20
|
+
return (
|
|
21
|
+
<Grid
|
|
22
|
+
alignContent="center"
|
|
23
|
+
gridAutoColumns="max-content"
|
|
24
|
+
gridGap="0 16px"
|
|
25
|
+
height="100%"
|
|
26
|
+
gridAutoFlow="column"
|
|
27
|
+
padding="xs"
|
|
28
|
+
justifyContent="center"
|
|
29
|
+
backgroundColor="peach300"
|
|
30
|
+
color="blackPepper500"
|
|
31
|
+
borderRadius="m"
|
|
32
|
+
>
|
|
33
|
+
{props.children}
|
|
34
|
+
</Grid>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default () => {
|
|
39
|
+
return (
|
|
40
|
+
<Grid gridAutoFlow="row" padding="xs" gridGap="10px 0">
|
|
41
|
+
<Grid
|
|
42
|
+
gridTemplateColumns="repeat(auto-fit, minmax(300px, 1fr))"
|
|
43
|
+
gridGap="10px"
|
|
44
|
+
padding="xxs"
|
|
45
|
+
border="5px solid #c860d1"
|
|
46
|
+
>
|
|
47
|
+
<Grid.Item gridRowStart="2">
|
|
48
|
+
<Grid gridTemplateColumns="repeat(auto-fit, minmax(300px, 1fr))" gridGap="10px">
|
|
49
|
+
<Cell>1</Cell>
|
|
50
|
+
<Cell>2</Cell>
|
|
51
|
+
</Grid>
|
|
52
|
+
</Grid.Item>
|
|
53
|
+
<Grid.Item gridRowStart="1">
|
|
54
|
+
<Grid gridTemplateColumns="repeat(auto-fit, minmax(100px, 1fr))" gridGap="10px">
|
|
55
|
+
<CellItem>3</CellItem>
|
|
56
|
+
<CellItem>4</CellItem>
|
|
57
|
+
<CellItem>5</CellItem>
|
|
58
|
+
<CellItem>6</CellItem>
|
|
59
|
+
<CellItem>7</CellItem>
|
|
60
|
+
</Grid>
|
|
61
|
+
</Grid.Item>
|
|
62
|
+
</Grid>
|
|
63
|
+
</Grid>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import React, {useState, useEffect, useRef} from 'react';
|
|
2
|
+
import {Grid} from '@workday/canvas-kit-react/layout';
|
|
3
|
+
import {PrimaryButton} from '@workday/canvas-kit-react/button';
|
|
4
|
+
// eslint-disable-next-line no-duplicate-imports
|
|
5
|
+
import {
|
|
6
|
+
arrowDownIcon,
|
|
7
|
+
arrowLeftIcon,
|
|
8
|
+
arrowRightIcon,
|
|
9
|
+
arrowUpIcon,
|
|
10
|
+
} from '@workday/canvas-system-icons-web';
|
|
11
|
+
|
|
12
|
+
const Cell = (props: {children: React.ReactNode}) => {
|
|
13
|
+
return (
|
|
14
|
+
<Grid
|
|
15
|
+
alignContent="center"
|
|
16
|
+
padding="xs"
|
|
17
|
+
justifyContent="center"
|
|
18
|
+
backgroundColor="soap500"
|
|
19
|
+
color="blackPepper500"
|
|
20
|
+
borderRadius="m"
|
|
21
|
+
>
|
|
22
|
+
{props.children}
|
|
23
|
+
</Grid>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const CellItem = (props: {children: React.ReactNode}) => {
|
|
28
|
+
return (
|
|
29
|
+
<Grid
|
|
30
|
+
alignContent="center"
|
|
31
|
+
gridAutoColumns="max-content"
|
|
32
|
+
gridGap="0 16px"
|
|
33
|
+
height="100%"
|
|
34
|
+
gridAutoFlow="column"
|
|
35
|
+
padding="xs"
|
|
36
|
+
justifyContent="center"
|
|
37
|
+
backgroundColor="peach300"
|
|
38
|
+
color="frenchVanilla100"
|
|
39
|
+
borderRadius="m"
|
|
40
|
+
>
|
|
41
|
+
{props.children}
|
|
42
|
+
</Grid>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default () => {
|
|
47
|
+
const [rowCount, setRowCount] = useState(1);
|
|
48
|
+
const [colCount, setColCount] = useState(1);
|
|
49
|
+
|
|
50
|
+
const Prev = val => {
|
|
51
|
+
const ref = useRef();
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
ref.current = val;
|
|
54
|
+
}, [val]);
|
|
55
|
+
return ref.current;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const prevRowCount = Prev(rowCount);
|
|
59
|
+
const prevColCount = Prev(colCount);
|
|
60
|
+
|
|
61
|
+
const plusMinus = (curr, prev) => {
|
|
62
|
+
if (curr <= 2 && (!prev || prev <= 2)) {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const incDec = (curr, prev, func) => {
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
69
|
+
plusMinus(curr, prev) ? func(curr + 1) : func(curr - 1);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<Grid gridAutoFlow="row" padding="xs" gridGap="10px 0">
|
|
74
|
+
<Grid
|
|
75
|
+
gridTemplateColumns="repeat(3, 1fr)"
|
|
76
|
+
gridTemplateRows="repeat(3, 1fr)"
|
|
77
|
+
gridGap="10px"
|
|
78
|
+
padding="xs"
|
|
79
|
+
border="5px solid #c860d1"
|
|
80
|
+
>
|
|
81
|
+
<Grid.Item gridRowStart={rowCount} gridColumnStart={colCount}>
|
|
82
|
+
<CellItem>
|
|
83
|
+
<PrimaryButton
|
|
84
|
+
size="extraSmall"
|
|
85
|
+
icon={plusMinus(rowCount, prevRowCount) ? arrowDownIcon : arrowUpIcon}
|
|
86
|
+
onClick={() => {
|
|
87
|
+
incDec(rowCount, prevRowCount, setRowCount);
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
Row: {rowCount}
|
|
91
|
+
</PrimaryButton>
|
|
92
|
+
<PrimaryButton
|
|
93
|
+
size="extraSmall"
|
|
94
|
+
icon={plusMinus(colCount, prevColCount) ? arrowRightIcon : arrowLeftIcon}
|
|
95
|
+
onClick={() => {
|
|
96
|
+
incDec(colCount, prevColCount, setColCount);
|
|
97
|
+
}}
|
|
98
|
+
>
|
|
99
|
+
Col: {colCount}
|
|
100
|
+
</PrimaryButton>
|
|
101
|
+
</CellItem>
|
|
102
|
+
</Grid.Item>
|
|
103
|
+
<Cell>2</Cell>
|
|
104
|
+
<Cell>3</Cell>
|
|
105
|
+
<Cell>4</Cell>
|
|
106
|
+
<Cell>5</Cell>
|
|
107
|
+
<Cell>6</Cell>
|
|
108
|
+
<Cell>7</Cell>
|
|
109
|
+
<Cell>8</Cell>
|
|
110
|
+
<Cell>9</Cell>
|
|
111
|
+
</Grid>
|
|
112
|
+
</Grid>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {Grid, GridProps, Box} from '@workday/canvas-kit-react/layout';
|
|
3
|
+
import {type} from '@workday/canvas-kit-react/tokens';
|
|
4
|
+
import {fontSizes} from '../../../../tokens/lib/type/fontSizes';
|
|
5
|
+
import styled from '@emotion/styled';
|
|
6
|
+
|
|
7
|
+
// temporary placeholder until type components are added to canvas-kit
|
|
8
|
+
|
|
9
|
+
const StyledHeading = styled(Box.as('h3'))({
|
|
10
|
+
...type.levels.body.large,
|
|
11
|
+
...type.variants.inverse,
|
|
12
|
+
margin: 0,
|
|
13
|
+
fontWeight: type.properties.fontWeights.bold,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const borderPadProps = {
|
|
17
|
+
borderRadius: 'm',
|
|
18
|
+
padding: 's',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const Header = ({children, ...props}: GridProps) => (
|
|
22
|
+
<Grid gridArea="Header" depth={1} {...props} {...borderPadProps}>
|
|
23
|
+
{children}
|
|
24
|
+
</Grid>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const BodyContent = ({children, ...props}: GridProps) => (
|
|
28
|
+
<Grid gridArea="BodyContent" depth={1} {...props} {...borderPadProps}>
|
|
29
|
+
{children}
|
|
30
|
+
</Grid>
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const SideBar = ({children, ...props}: GridProps) => (
|
|
34
|
+
<Grid gridArea="SideBar" depth={1} {...props} {...borderPadProps}>
|
|
35
|
+
{children}
|
|
36
|
+
</Grid>
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const Footer = ({children, ...props}: GridProps) => (
|
|
40
|
+
<Grid gridArea="Footer" depth={1} {...props} {...borderPadProps}>
|
|
41
|
+
{children}
|
|
42
|
+
</Grid>
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
export default () => {
|
|
46
|
+
const parentCont = {
|
|
47
|
+
gridTemplateAreas:
|
|
48
|
+
"'Header Header Header Header' 'SideBar BodyContent BodyContent BodyContent' 'Footer Footer Footer Footer'",
|
|
49
|
+
gridGap: fontSizes[16],
|
|
50
|
+
gridTemplateColumns: '3fr 9fr',
|
|
51
|
+
gridTemplateRows: 'auto 300px auto',
|
|
52
|
+
};
|
|
53
|
+
return (
|
|
54
|
+
<Grid as="section" padding="s">
|
|
55
|
+
<Grid {...parentCont}>
|
|
56
|
+
<Header backgroundColor="blueberry400">
|
|
57
|
+
<StyledHeading>Header</StyledHeading>
|
|
58
|
+
</Header>
|
|
59
|
+
<SideBar backgroundColor="blueberry300">
|
|
60
|
+
<StyledHeading>SideBar</StyledHeading>
|
|
61
|
+
</SideBar>
|
|
62
|
+
<BodyContent backgroundColor="plum300">
|
|
63
|
+
<StyledHeading>Body Content</StyledHeading>
|
|
64
|
+
</BodyContent>
|
|
65
|
+
<Footer backgroundColor="berrySmoothie300">
|
|
66
|
+
<StyledHeading>Footer</StyledHeading>
|
|
67
|
+
</Footer>
|
|
68
|
+
</Grid>
|
|
69
|
+
</Grid>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {FlexStyleProps, StackStyleProps} from '@workday/canvas-kit-react/layout';
|
|
3
|
+
import {FlexStyleProps, StackStyleProps, GridStyleProps} from '@workday/canvas-kit-react/layout';
|
|
4
4
|
|
|
5
5
|
export const FlexStyle = (props: FlexStyleProps) => <div />;
|
|
6
6
|
|
|
7
7
|
export const StackStyle = (props: StackStyleProps) => <div />;
|
|
8
|
+
|
|
9
|
+
export const GridStyle = (props: GridStyleProps) => <div />;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import {HStack, Stack, Flex, Box} from '@workday/canvas-kit-react/layout';
|
|
3
3
|
import {TertiaryButton} from '@workday/canvas-kit-react/button';
|
|
4
|
-
import {
|
|
4
|
+
import {BodyText, Heading} from '@workday/canvas-kit-react/text';
|
|
5
5
|
|
|
6
6
|
const Card = ({heading = '', body = ''}) => (
|
|
7
7
|
<Flex flex={1} flexBasis="auto" depth={1} padding="s" backgroundColor="frenchVanilla100">
|
|
8
8
|
<Stack flexDirection="column" spacing="xs">
|
|
9
|
-
<h3
|
|
9
|
+
<Heading as="h3" size="small" margin={0}>
|
|
10
|
+
{heading}
|
|
11
|
+
</Heading>
|
|
10
12
|
<Box maxWidth={240}>
|
|
11
|
-
<
|
|
13
|
+
<BodyText size="small" margin={0}>
|
|
14
|
+
{body}
|
|
15
|
+
</BodyText>
|
|
12
16
|
</Box>
|
|
13
17
|
<Box>
|
|
14
18
|
<TertiaryButton>Add to order</TertiaryButton>
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import {Stack, Flex} from '@workday/canvas-kit-react/layout';
|
|
3
3
|
import {TertiaryButton} from '@workday/canvas-kit-react/button';
|
|
4
|
-
import {
|
|
4
|
+
import {BodyText, Heading} from '@workday/canvas-kit-react/text';
|
|
5
5
|
|
|
6
6
|
export default () => {
|
|
7
7
|
return (
|
|
8
8
|
<Flex backgroundColor="soap100" alignItems="flex-start" padding="s">
|
|
9
9
|
<Flex depth={1} padding="s" backgroundColor="frenchVanilla100">
|
|
10
10
|
<Stack flexDirection="column" spacing="xs">
|
|
11
|
-
<h3
|
|
12
|
-
|
|
11
|
+
<Heading as="h3" size="small" margin={0}>
|
|
12
|
+
Stack
|
|
13
|
+
</Heading>
|
|
14
|
+
<BodyText size="small" margin={0}>
|
|
13
15
|
Stack provides a simple API for managing consistent space between elements in
|
|
14
16
|
one-dimensional layouts. In this Card example, we are setting extra-small spacing the
|
|
15
17
|
heading, body text, and button elements.
|
|
16
|
-
</
|
|
18
|
+
</BodyText>
|
|
17
19
|
<Flex>
|
|
18
20
|
<TertiaryButton>Learn more</TertiaryButton>
|
|
19
21
|
</Flex>
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import {VStack, Stack, Flex} from '@workday/canvas-kit-react/layout';
|
|
3
3
|
import {TertiaryButton} from '@workday/canvas-kit-react/button';
|
|
4
|
-
import {
|
|
4
|
+
import {BodyText, Heading} from '@workday/canvas-kit-react/text';
|
|
5
5
|
|
|
6
6
|
const Card = ({heading = '', body = ''}) => (
|
|
7
7
|
<Flex flex={1} flexBasis="auto" depth={1} padding="s" backgroundColor="frenchVanilla100">
|
|
8
8
|
<Stack flexDirection="column" spacing="xs">
|
|
9
|
-
<h3
|
|
10
|
-
|
|
9
|
+
<Heading as="h3" size="small" margin={0}>
|
|
10
|
+
{heading}
|
|
11
|
+
</Heading>
|
|
12
|
+
<BodyText size="small" margin={0}>
|
|
13
|
+
{body}
|
|
14
|
+
</BodyText>
|
|
11
15
|
<Flex>
|
|
12
16
|
<TertiaryButton>Add to order</TertiaryButton>
|
|
13
17
|
</Flex>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {Box} from '@workday/canvas-kit-react/layout';
|
|
3
|
+
|
|
4
|
+
const Card = props => <Box border="1px solid black" margin="xxs" padding="s" {...props} />;
|
|
5
|
+
|
|
6
|
+
export default () => (
|
|
7
|
+
<>
|
|
8
|
+
<Card
|
|
9
|
+
textAlign="center"
|
|
10
|
+
textDecoration="line-through"
|
|
11
|
+
textTransform="uppercase"
|
|
12
|
+
letterSpacing="0.05em"
|
|
13
|
+
lineHeight="2em"
|
|
14
|
+
wordBreak="break-all"
|
|
15
|
+
whiteSpace="break-spaces"
|
|
16
|
+
>
|
|
17
|
+
Centered text, uppercase, with line through, 0.05em letter-spacing, 2em line-height, with
|
|
18
|
+
breack-all and break-spaces.
|
|
19
|
+
</Card>
|
|
20
|
+
<Card
|
|
21
|
+
textAlign="left"
|
|
22
|
+
textDecoration="underline"
|
|
23
|
+
textTransform="lowercase"
|
|
24
|
+
letterSpacing="0.1em"
|
|
25
|
+
lineHeight="1em"
|
|
26
|
+
whiteSpace="nowrap"
|
|
27
|
+
>
|
|
28
|
+
Nowrap, Left-aligned text, with lowercase and underline, 0.1em letter-spacing, 1em
|
|
29
|
+
line-height,
|
|
30
|
+
</Card>
|
|
31
|
+
</>
|
|
32
|
+
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {FormField} from '@workday/canvas-kit-react/form-field';
|
|
3
3
|
import {Radio, RadioGroup} from '@workday/canvas-kit-react/radio';
|
|
4
|
-
import {
|
|
4
|
+
import {Subtext} from '@workday/canvas-kit-react/text';
|
|
5
5
|
|
|
6
6
|
export default () => {
|
|
7
7
|
const [value, setValue] = React.useState<string | number>(0);
|
|
@@ -20,7 +20,7 @@ export default () => {
|
|
|
20
20
|
<Radio label="Cauliflower" />
|
|
21
21
|
</RadioGroup>
|
|
22
22
|
</FormField>
|
|
23
|
-
<
|
|
23
|
+
<Subtext size="large">Value: {value}</Subtext>
|
|
24
24
|
</>
|
|
25
25
|
);
|
|
26
26
|
};
|
|
@@ -14,9 +14,10 @@ import {
|
|
|
14
14
|
import {Box, Flex} from '@workday/canvas-kit-react/layout';
|
|
15
15
|
|
|
16
16
|
import {Skeleton} from '@workday/canvas-kit-react/skeleton';
|
|
17
|
-
import {borderRadius, space
|
|
17
|
+
import {borderRadius, space} from '@workday/canvas-kit-react/tokens';
|
|
18
18
|
import {patternIcon} from '@workday/canvas-system-icons-web';
|
|
19
19
|
import {StyledType} from '@workday/canvas-kit-react/common';
|
|
20
|
+
import {Heading} from '@workday/canvas-kit-react/text';
|
|
20
21
|
|
|
21
22
|
const fadeOut = keyframes`
|
|
22
23
|
from {
|
|
@@ -105,14 +106,9 @@ export default () => {
|
|
|
105
106
|
<Box>
|
|
106
107
|
<Flex alignItems="center" display="inline-flex" marginBottom="s">
|
|
107
108
|
<SystemIconCircle icon={patternIcon} />
|
|
108
|
-
<h3
|
|
109
|
-
style={{
|
|
110
|
-
...type.levels.heading.small,
|
|
111
|
-
margin: `0 0 0 ${space.xxs}`,
|
|
112
|
-
}}
|
|
113
|
-
>
|
|
109
|
+
<Heading as="h3" size="small" margin={`0 0 0 ${space.xxs}`}>
|
|
114
110
|
Patterns
|
|
115
|
-
</
|
|
111
|
+
</Heading>
|
|
116
112
|
</Flex>
|
|
117
113
|
<p>
|
|
118
114
|
Canvas Patterns classify and document reusable solutions built to respond to
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {TextProps, TypeLabelProps, TypeLevelProps} from '@workday/canvas-kit-react/text';
|
|
3
|
+
|
|
4
|
+
// <ArgsTable of={Text} /> generates a very large props table given that
|
|
5
|
+
// Text includes BoxProps. Use this dummy component instead to
|
|
6
|
+
// limit the props shown.
|
|
7
|
+
export const TextComponent = (_: TextProps) => <div />;
|
|
8
|
+
|
|
9
|
+
// <ArgsTable of={Label} /> generates a props table with
|
|
10
|
+
// Text and Box props. Use this dummy component instead to limit the props shown.
|
|
11
|
+
export const LabelComponent = (_: TypeLabelProps) => <div />;
|
|
12
|
+
|
|
13
|
+
// <ArgsTable of={Heading} /> generates a props table with
|
|
14
|
+
// Text and Box props. Use this dummy component instead to limit the props shown.
|
|
15
|
+
export const TypeLevelComponent = (_: TypeLevelProps) => <div />;
|