@workday/canvas-kit-docs 8.3.3 → 8.3.5
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/commonjs/lib/specs.js +42 -42
- package/dist/commonjs/mdx/installBlock.d.ts +6 -0
- package/dist/commonjs/mdx/installBlock.d.ts.map +1 -0
- package/dist/commonjs/mdx/installBlock.js +31 -0
- package/dist/commonjs/mdx/welcomePage.d.ts +2 -0
- package/dist/commonjs/mdx/welcomePage.d.ts.map +1 -0
- package/dist/commonjs/mdx/welcomePage.js +66 -0
- package/dist/es6/lib/specs.js +42 -42
- package/dist/es6/mdx/installBlock.d.ts +6 -0
- package/dist/es6/mdx/installBlock.d.ts.map +1 -0
- package/dist/es6/mdx/installBlock.js +24 -0
- package/dist/es6/mdx/welcomePage.d.ts +2 -0
- package/dist/es6/mdx/welcomePage.d.ts.map +1 -0
- package/dist/es6/mdx/welcomePage.js +59 -0
- package/dist/mdx/4.0-UPGRADE-GUIDE.mdx +10 -0
- package/dist/mdx/5.0-UPGRADE-GUIDE.mdx +10 -0
- package/dist/mdx/6.0-UPGRADE-GUIDE.mdx +12 -2
- package/dist/mdx/7.0-UPGRADE-GUIDE.mdx +13 -3
- package/dist/mdx/8.0-UPGRADE-GUIDE.mdx +16 -10
- package/dist/mdx/API_PATTERN_GUIDELINES.mdx +11 -1
- package/dist/mdx/COMPOUND_COMPONENTS.mdx +10 -0
- package/dist/mdx/CONTRIBUTING.mdx +12 -3
- package/dist/mdx/CREATING_COMPOUND_COMPONENTS.mdx +10 -0
- package/dist/mdx/GETTING_STARTED.mdx +14 -0
- package/dist/mdx/MAINTAINING.mdx +10 -0
- package/dist/mdx/TESTING.mdx +10 -0
- package/dist/mdx/changelog.stories.mdx +9 -0
- package/dist/mdx/preview-react/segmented-control/SegmentedControl.mdx +1 -2
- package/dist/mdx/react/icon/Assets.mdx +28 -0
- package/dist/mdx/react/icon/examples/AccentIconList.tsx +50 -0
- package/dist/mdx/react/icon/examples/AppletIconList.tsx +50 -0
- package/dist/mdx/react/icon/examples/IconList.tsx +49 -0
- package/dist/mdx/react/icon/examples/Overview.tsx +30 -0
- package/dist/mdx/react/layout/Box.mdx +3 -1
- package/dist/mdx/react/layout/Flex.mdx +4 -7
- package/dist/mdx/react/layout/Grid.mdx +7 -4
- package/dist/mdx/react/tabs/Tabs.mdx +2 -3
- package/dist/mdx/react/text/Text.mdx +2 -2
- package/dist/mdx/react/tokens/Tokens.mdx +51 -0
- package/dist/mdx/react/tokens/examples/Overview.tsx +19 -0
- package/dist/mdx/react/tokens/examples/Tokens.tsx +276 -0
- package/dist/mdx/style-props/STYLE_PROPS.mdx +14 -4
- package/dist/mdx/welcome.stories.mdx +31 -1
- package/package.json +4 -3
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import {pickForegroundColor, StyledType} from '@workday/canvas-kit-react/common';
|
|
4
|
+
|
|
5
|
+
import {colors, type, depth, space, borderRadius} from '@workday/canvas-kit-react/tokens';
|
|
6
|
+
import {Box, Flex} from '@workday/canvas-kit-react/layout';
|
|
7
|
+
|
|
8
|
+
const StyledCard = styled(Box)<StyledType>({
|
|
9
|
+
width: 200,
|
|
10
|
+
height: 200,
|
|
11
|
+
margin: 20,
|
|
12
|
+
borderRadius: 4,
|
|
13
|
+
display: 'flex',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
justifyContent: 'center',
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export default () => (
|
|
19
|
+
<Flex>
|
|
20
|
+
<StyledCard depth="none">Depth None</StyledCard>
|
|
21
|
+
<StyledCard depth={1}>Depth 1</StyledCard>
|
|
22
|
+
<StyledCard depth={2}>Depth 2</StyledCard>
|
|
23
|
+
<StyledCard depth={3}>Depth 3</StyledCard>
|
|
24
|
+
<StyledCard depth={4}>Depth 4</StyledCard>
|
|
25
|
+
<StyledCard depth={5}>Depth 5</StyledCard>
|
|
26
|
+
<StyledCard depth={6}>Depth 6</StyledCard>
|
|
27
|
+
</Flex>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const StyledLargeTitle = styled('h3')({
|
|
31
|
+
...type.levels.title.large,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const StyledMediumTitle = styled('h3')({
|
|
35
|
+
...type.levels.title.medium,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const StyledSmallTitle = styled('h3')({
|
|
39
|
+
...type.levels.title.small,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const StyledLargeHeading = styled('h3')({
|
|
43
|
+
...type.levels.heading.large,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const StyledMediumHeading = styled('h3')({
|
|
47
|
+
...type.levels.heading.medium,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const StyledSmallHeading = styled('h3')({
|
|
51
|
+
...type.levels.heading.small,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const StyledLargeBody = styled('h3')({
|
|
55
|
+
...type.levels.body.large,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const StyledMediumBody = styled('h3')({
|
|
59
|
+
...type.levels.body.medium,
|
|
60
|
+
});
|
|
61
|
+
const StyledSmallBody = styled('h3')({
|
|
62
|
+
...type.levels.body.small,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const StyledLargeSubtext = styled('h3')({
|
|
66
|
+
...type.levels.subtext.large,
|
|
67
|
+
});
|
|
68
|
+
const StyledMediumSubtext = styled('h3')({
|
|
69
|
+
...type.levels.subtext.medium,
|
|
70
|
+
});
|
|
71
|
+
const StyledSmallSubtext = styled('h3')({
|
|
72
|
+
...type.levels.subtext.small,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const StyledVariantsContainer = styled(Box)({
|
|
76
|
+
...type.levels.body.medium,
|
|
77
|
+
'& > *': {display: 'block', margin: '4px 0'},
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const StyledErrorText = styled('span')({
|
|
81
|
+
...type.variants.error,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const StyledHintText = styled('span')({
|
|
85
|
+
...type.variants.hint,
|
|
86
|
+
});
|
|
87
|
+
const StyledInverseText = styled('span')({
|
|
88
|
+
...type.variants.inverse,
|
|
89
|
+
display: 'inline-block !important',
|
|
90
|
+
background: '#667380',
|
|
91
|
+
padding: '2px 8px',
|
|
92
|
+
borderRadius: '4px',
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
export default () => (
|
|
96
|
+
<React.Fragment>
|
|
97
|
+
<h2>Levels (Hierarchy)</h2>
|
|
98
|
+
|
|
99
|
+
<StyledLargeTitle>Title Large Heading</StyledLargeTitle>
|
|
100
|
+
<StyledMediumTitle>Title Medium Heading</StyledMediumTitle>
|
|
101
|
+
<StyledSmallTitle>Title Small Heading</StyledSmallTitle>
|
|
102
|
+
|
|
103
|
+
<StyledLargeHeading>Heading Large Heading</StyledLargeHeading>
|
|
104
|
+
<StyledMediumHeading>Heading Medium Heading</StyledMediumHeading>
|
|
105
|
+
<StyledSmallHeading>Heading Small Heading</StyledSmallHeading>
|
|
106
|
+
|
|
107
|
+
<StyledLargeBody>Body Large Heading</StyledLargeBody>
|
|
108
|
+
<StyledMediumBody>Body Medium Heading</StyledMediumBody>
|
|
109
|
+
<StyledSmallBody>Body Small Heading</StyledSmallBody>
|
|
110
|
+
|
|
111
|
+
<StyledLargeSubtext>Subtext Large Heading</StyledLargeSubtext>
|
|
112
|
+
<StyledMediumSubtext>Subtext Medium Heading</StyledMediumSubtext>
|
|
113
|
+
<StyledSmallSubtext>Subtext Small Heading</StyledSmallSubtext>
|
|
114
|
+
|
|
115
|
+
<hr />
|
|
116
|
+
|
|
117
|
+
<h3>Variants</h3>
|
|
118
|
+
<StyledVariantsContainer>
|
|
119
|
+
<StyledErrorText>Error Text</StyledErrorText>
|
|
120
|
+
<StyledHintText>Hint Text</StyledHintText>
|
|
121
|
+
<StyledInverseText>Inverse Text</StyledInverseText>
|
|
122
|
+
</StyledVariantsContainer>
|
|
123
|
+
</React.Fragment>
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
const Shape = styled('div')<{radius?: string | number; size?: string | number}>(
|
|
127
|
+
{
|
|
128
|
+
...type.levels.body.small,
|
|
129
|
+
fontWeight: type.properties.fontWeights.bold,
|
|
130
|
+
margin: space.m,
|
|
131
|
+
background: colors.blueberry400,
|
|
132
|
+
color: colors.frenchVanilla100,
|
|
133
|
+
display: 'flex',
|
|
134
|
+
alignItems: 'center',
|
|
135
|
+
justifyContent: 'center',
|
|
136
|
+
flexDirection: 'column',
|
|
137
|
+
'& span': {
|
|
138
|
+
...type.levels.subtext.medium,
|
|
139
|
+
fontFamily: type.properties.fontFamilies.monospace,
|
|
140
|
+
display: 'block',
|
|
141
|
+
color: colors.blueberry100,
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
({radius}) => ({
|
|
145
|
+
borderRadius: radius,
|
|
146
|
+
}),
|
|
147
|
+
({size}) => ({
|
|
148
|
+
width: size || space.xxl,
|
|
149
|
+
height: size || space.xxl,
|
|
150
|
+
})
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
const SizeLabel = styled('div')({
|
|
154
|
+
...type.levels.body.small,
|
|
155
|
+
fontWeight: type.properties.fontWeights.bold,
|
|
156
|
+
margin: space.s,
|
|
157
|
+
width: 80,
|
|
158
|
+
'& span': {
|
|
159
|
+
...type.levels.subtext.medium,
|
|
160
|
+
fontFamily: type.properties.fontFamilies.monospace,
|
|
161
|
+
...type.variants.hint,
|
|
162
|
+
display: 'block',
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
export default () => (
|
|
167
|
+
<React.Fragment>
|
|
168
|
+
{Object.keys(borderRadius).map(size => (
|
|
169
|
+
<Flex key={size}>
|
|
170
|
+
<SizeLabel>
|
|
171
|
+
{size}
|
|
172
|
+
<span>({borderRadius[size]})</span>
|
|
173
|
+
</SizeLabel>
|
|
174
|
+
<Shape radius={borderRadius[size]} />
|
|
175
|
+
</Flex>
|
|
176
|
+
))}
|
|
177
|
+
</React.Fragment>
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
export default () => (
|
|
181
|
+
<React.Fragment>
|
|
182
|
+
{Object.keys(space).map(size => (
|
|
183
|
+
<Flex key={size}>
|
|
184
|
+
<SizeLabel>
|
|
185
|
+
{size}
|
|
186
|
+
<span>({(space as any)[size]})</span>
|
|
187
|
+
</SizeLabel>
|
|
188
|
+
<Shape size={(space as any)[size]} radius={borderRadius.m} />
|
|
189
|
+
</Flex>
|
|
190
|
+
))}
|
|
191
|
+
</React.Fragment>
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
const Palettes = styled('div')({
|
|
195
|
+
display: 'flex',
|
|
196
|
+
margin: -20,
|
|
197
|
+
flexWrap: 'wrap',
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
const Palette = styled('ul')({
|
|
201
|
+
...depth[3],
|
|
202
|
+
listStyle: 'none',
|
|
203
|
+
margin: 20,
|
|
204
|
+
padding: 0,
|
|
205
|
+
overflow: 'hidden',
|
|
206
|
+
width: 250,
|
|
207
|
+
alignSelf: 'flex-start',
|
|
208
|
+
borderRadius: borderRadius.l,
|
|
209
|
+
display: 'flex',
|
|
210
|
+
flexDirection: 'column',
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
const Swatch = styled('li')<{bg: string; primary?: boolean}>(
|
|
214
|
+
{
|
|
215
|
+
...type.levels.subtext.large,
|
|
216
|
+
fontWeight: type.properties.fontWeights.bold,
|
|
217
|
+
padding: `0 ${space.m}`,
|
|
218
|
+
height: space.xl,
|
|
219
|
+
display: 'flex',
|
|
220
|
+
justifyContent: 'space-between',
|
|
221
|
+
alignItems: 'center',
|
|
222
|
+
},
|
|
223
|
+
({primary, bg}) =>
|
|
224
|
+
primary && {
|
|
225
|
+
...type.levels.body.large,
|
|
226
|
+
fontWeight: type.properties.fontWeights.bold,
|
|
227
|
+
height: space.xxxl,
|
|
228
|
+
paddingTop: space.s,
|
|
229
|
+
paddingBottom: space.s,
|
|
230
|
+
display: 'flex',
|
|
231
|
+
flexDirection: 'column',
|
|
232
|
+
justifyContent: 'space-around',
|
|
233
|
+
alignItems: 'flex-start',
|
|
234
|
+
textTransform: 'capitalize',
|
|
235
|
+
},
|
|
236
|
+
({bg}) => ({
|
|
237
|
+
background: bg,
|
|
238
|
+
color: pickForegroundColor(bg),
|
|
239
|
+
})
|
|
240
|
+
);
|
|
241
|
+
|
|
242
|
+
const colorNames = Object.keys(colors)
|
|
243
|
+
.map(color => color.replace(/\d+$/, '')) // Remove shade numbers
|
|
244
|
+
.reduce((collection: string[], color: string) => {
|
|
245
|
+
// Remove duplicates
|
|
246
|
+
if (collection.indexOf(color) < 0) {
|
|
247
|
+
collection.push(color);
|
|
248
|
+
}
|
|
249
|
+
return collection;
|
|
250
|
+
}, []);
|
|
251
|
+
|
|
252
|
+
const StyledColors = styled('span')({
|
|
253
|
+
fontFamily: type.properties.fontFamilies.monospace,
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
export default () => (
|
|
257
|
+
<Palettes>
|
|
258
|
+
{colorNames.map(colorName => (
|
|
259
|
+
<Palette key={colorName}>
|
|
260
|
+
<Swatch bg={(colors as any)[`${colorName}500`]} primary={true}>
|
|
261
|
+
<div>{colorName}</div>
|
|
262
|
+
<div>500</div>
|
|
263
|
+
</Swatch>
|
|
264
|
+
{[1, 2, 3, 4, 5, 6].map(level => {
|
|
265
|
+
const color = `${colorName}${level}00`;
|
|
266
|
+
return (
|
|
267
|
+
<Swatch bg={(colors as any)[color]} key={color}>
|
|
268
|
+
<span>{level}00</span>
|
|
269
|
+
<StyledColors>{(colors as any)[color]}</StyledColors>
|
|
270
|
+
</Swatch>
|
|
271
|
+
);
|
|
272
|
+
})}
|
|
273
|
+
</Palette>
|
|
274
|
+
))}
|
|
275
|
+
</Palettes>
|
|
276
|
+
);
|
|
@@ -33,17 +33,27 @@ import TextExample from './examples/Text';
|
|
|
33
33
|
|
|
34
34
|
# Style Props
|
|
35
35
|
|
|
36
|
-
Style props provide a common, ergonomic API for modifying a component's styles by passing styles
|
|
36
|
+
Style props provide a common, ergonomic API for modifying a component's styles by passing styles
|
|
37
|
+
with props.
|
|
37
38
|
|
|
38
39
|
## System Prop Values
|
|
39
40
|
|
|
40
|
-
Many style props are design-system-aware and translate `SystemPropValues` for you automatically. In
|
|
41
|
+
Many style props are design-system-aware and translate `SystemPropValues` for you automatically. In
|
|
42
|
+
the example below, the `padding` prop translates the value `s` to `16px` and `frenchVanilla100` to
|
|
43
|
+
`#ffffff`. These `SystemPropValues` are also included in our types, so your IDE's intellisense
|
|
44
|
+
should suggest these values as you work. This allows you to use Canvas design tokens fluidly without
|
|
45
|
+
disrupting your workflow.
|
|
41
46
|
|
|
42
47
|
```tsx
|
|
43
|
-
<Box padding="s" backgroundColor="frenchVanilla100">
|
|
48
|
+
<Box padding="s" backgroundColor="frenchVanilla100">
|
|
49
|
+
Hello, style props!
|
|
50
|
+
</Box>
|
|
44
51
|
```
|
|
45
52
|
|
|
46
|
-
There are seven types of system prop values: `color`, `depth`, `font`, `fontSize`, `fontWeight`,
|
|
53
|
+
There are seven types of system prop values: `color`, `depth`, `font`, `fontSize`, `fontWeight`,
|
|
54
|
+
`shape`, and `space` — corresponding to our Canvas design tokens. Each style prop section below
|
|
55
|
+
includes a table. The "System" column in that table will tell you which system prop values are
|
|
56
|
+
supported.
|
|
47
57
|
|
|
48
58
|
## Background
|
|
49
59
|
|
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
import Readme from '../../../README.md';
|
|
2
2
|
import Markdown from '../../../utils/storybook/Markdown.tsx';
|
|
3
|
+
import {WelcomePage} from './welcomePage';
|
|
4
|
+
import {InstallBlock} from './installBlock';
|
|
5
|
+
import {version} from '../../../lerna.json';
|
|
3
6
|
|
|
7
|
+
<Meta
|
|
8
|
+
title="Welcome"
|
|
9
|
+
parameters={{
|
|
10
|
+
viewMode: 'docs',
|
|
11
|
+
previewTabs: {
|
|
12
|
+
canvas: { hidden: true }
|
|
13
|
+
},
|
|
14
|
+
}}
|
|
15
|
+
/>
|
|
4
16
|
|
|
5
|
-
<
|
|
17
|
+
<WelcomePage />
|
|
18
|
+
|
|
19
|
+
After installing Canvas Kit, you need to set up the CanvasProvider at the root of your application.
|
|
20
|
+
This can be either in your `index.jsx`,`index.tsx` or `App.jsx` depending on the framework you use.
|
|
21
|
+
This ensures proper styling, theming, and focus behavior on our components.
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import * as React from 'react';
|
|
25
|
+
// 1. import `CanvasProvider` component
|
|
26
|
+
import {CanvasProvider} from '@workday/canvas-kit-react';
|
|
27
|
+
function App() {
|
|
28
|
+
// 2. Wrap CanvasProvider at the root of your app
|
|
29
|
+
return (
|
|
30
|
+
<CanvasProvider>
|
|
31
|
+
<YourApp />
|
|
32
|
+
</CanvasProvider>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.5",
|
|
4
4
|
"description": "Documentation components of Canvas Kit components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -42,7 +42,8 @@
|
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@storybook/csf": "0.0.1",
|
|
45
|
-
"@workday/canvas-kit-react": "^8.3.
|
|
45
|
+
"@workday/canvas-kit-react": "^8.3.5",
|
|
46
|
+
"@workday/canvas-system-icons-web": "^3.0.0"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"fs-extra": "^10.0.0",
|
|
@@ -50,5 +51,5 @@
|
|
|
50
51
|
"mkdirp": "^1.0.3",
|
|
51
52
|
"typescript": "4.1"
|
|
52
53
|
},
|
|
53
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "f9ae8bd7a68fe3e22eae4c4ea791c75f815684ec"
|
|
54
55
|
}
|