@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.
Files changed (44) hide show
  1. package/dist/commonjs/lib/specs.js +42 -42
  2. package/dist/commonjs/mdx/installBlock.d.ts +6 -0
  3. package/dist/commonjs/mdx/installBlock.d.ts.map +1 -0
  4. package/dist/commonjs/mdx/installBlock.js +31 -0
  5. package/dist/commonjs/mdx/welcomePage.d.ts +2 -0
  6. package/dist/commonjs/mdx/welcomePage.d.ts.map +1 -0
  7. package/dist/commonjs/mdx/welcomePage.js +66 -0
  8. package/dist/es6/lib/specs.js +42 -42
  9. package/dist/es6/mdx/installBlock.d.ts +6 -0
  10. package/dist/es6/mdx/installBlock.d.ts.map +1 -0
  11. package/dist/es6/mdx/installBlock.js +24 -0
  12. package/dist/es6/mdx/welcomePage.d.ts +2 -0
  13. package/dist/es6/mdx/welcomePage.d.ts.map +1 -0
  14. package/dist/es6/mdx/welcomePage.js +59 -0
  15. package/dist/mdx/4.0-UPGRADE-GUIDE.mdx +10 -0
  16. package/dist/mdx/5.0-UPGRADE-GUIDE.mdx +10 -0
  17. package/dist/mdx/6.0-UPGRADE-GUIDE.mdx +12 -2
  18. package/dist/mdx/7.0-UPGRADE-GUIDE.mdx +13 -3
  19. package/dist/mdx/8.0-UPGRADE-GUIDE.mdx +16 -10
  20. package/dist/mdx/API_PATTERN_GUIDELINES.mdx +11 -1
  21. package/dist/mdx/COMPOUND_COMPONENTS.mdx +10 -0
  22. package/dist/mdx/CONTRIBUTING.mdx +12 -3
  23. package/dist/mdx/CREATING_COMPOUND_COMPONENTS.mdx +10 -0
  24. package/dist/mdx/GETTING_STARTED.mdx +14 -0
  25. package/dist/mdx/MAINTAINING.mdx +10 -0
  26. package/dist/mdx/TESTING.mdx +10 -0
  27. package/dist/mdx/changelog.stories.mdx +9 -0
  28. package/dist/mdx/preview-react/segmented-control/SegmentedControl.mdx +1 -2
  29. package/dist/mdx/react/icon/Assets.mdx +28 -0
  30. package/dist/mdx/react/icon/examples/AccentIconList.tsx +50 -0
  31. package/dist/mdx/react/icon/examples/AppletIconList.tsx +50 -0
  32. package/dist/mdx/react/icon/examples/IconList.tsx +49 -0
  33. package/dist/mdx/react/icon/examples/Overview.tsx +30 -0
  34. package/dist/mdx/react/layout/Box.mdx +3 -1
  35. package/dist/mdx/react/layout/Flex.mdx +4 -7
  36. package/dist/mdx/react/layout/Grid.mdx +7 -4
  37. package/dist/mdx/react/tabs/Tabs.mdx +2 -3
  38. package/dist/mdx/react/text/Text.mdx +2 -2
  39. package/dist/mdx/react/tokens/Tokens.mdx +51 -0
  40. package/dist/mdx/react/tokens/examples/Overview.tsx +19 -0
  41. package/dist/mdx/react/tokens/examples/Tokens.tsx +276 -0
  42. package/dist/mdx/style-props/STYLE_PROPS.mdx +14 -4
  43. package/dist/mdx/welcome.stories.mdx +31 -1
  44. package/package.json +4 -3
@@ -1,3 +1,13 @@
1
+ <Meta
2
+ title="Guides/Contributing"
3
+ parameters={{
4
+ viewMode: 'docs',
5
+ previewTabs: {
6
+ canvas: {hidden: true},
7
+ },
8
+ }}
9
+ />
10
+
1
11
  # Contributing to Canvas
2
12
 
3
13
  On behalf of the Canvas team, thank you so much for your contribution to this project and being a
@@ -155,7 +165,7 @@ Upon commit, [lint-staged](https://github.com/okonet/lint-staged) will run your
155
165
  ### Releases
156
166
 
157
167
  - Releases are prepared by updating package versions with `lerna version`, and updating the
158
- [changelog](./CHANGELOG.md)
168
+ [changelog](/docs/changelog--page)
159
169
  - A PR is created for the above updates
160
170
  - After the release PR is approved and merged, we create a release in GitHub with the contents of
161
171
  the changelog updates.
@@ -205,8 +215,7 @@ This will start the unit tests.
205
215
 
206
216
  ### Code Style Guide
207
217
 
208
- Refer to the
209
- [API & Pattern Guidelines](/getting-started/for-developers/resources/api-pattern-guidelines/).
218
+ Refer to the [API & Pattern Guidelines](/getting-started/for-developers/resources/api-pattern-guidelines/).
210
219
 
211
220
  Rules are enforced using [ESLint](https://eslint.org) and code formatting is provided through
212
221
  [Prettier](https://prettier.io).
@@ -1,3 +1,13 @@
1
+ <Meta
2
+ title="Guides/Creating Compound Components"
3
+ parameters={{
4
+ viewMode: 'docs',
5
+ previewTabs: {
6
+ canvas: {hidden: true},
7
+ },
8
+ }}
9
+ />
10
+
1
11
  # Building a Compound Component
2
12
 
3
13
  Refer to the
@@ -0,0 +1,14 @@
1
+ import Readme from '../../../README.md';
2
+ import Markdown from '../../../utils/storybook/Markdown.tsx';
3
+
4
+ <Meta
5
+ title="Guides/Getting Started"
6
+ parameters={{
7
+ viewMode: 'docs',
8
+ previewTabs: {
9
+ canvas: { hidden: true }
10
+ },
11
+ }}
12
+ />
13
+
14
+ <Markdown content={Readme} />
@@ -1,3 +1,13 @@
1
+ <Meta
2
+ title="Guides/Maintaining"
3
+ parameters={{
4
+ viewMode: 'docs',
5
+ previewTabs: {
6
+ canvas: { hidden: true }
7
+ },
8
+ }}
9
+ />
10
+
1
11
  # Maintaining Canvas Kit
2
12
 
3
13
  If you're a Canvas Kit core maintainer, this doc is for you! Consider this a field guide to help you
@@ -1,3 +1,13 @@
1
+ <Meta
2
+ title="Guides/Testing"
3
+ parameters={{
4
+ viewMode: 'docs',
5
+ previewTabs: {
6
+ canvas: { hidden: true }
7
+ },
8
+ }}
9
+ />
10
+
1
11
  # Testing
2
12
 
3
13
  `canvas-kit` has 3 levels of testing: unit, functional and visual. Each area has special use-cases
@@ -1,5 +1,14 @@
1
1
  import Changelog from '../../../CHANGELOG.md';
2
2
  import Markdown from '../../../utils/storybook/Markdown.tsx';
3
3
 
4
+ <Meta
5
+ title="Changelog"
6
+ parameters={{
7
+ viewMode: 'docs',
8
+ previewTabs: {
9
+ canvas: {hidden: true},
10
+ },
11
+ }}
12
+ />
4
13
 
5
14
  <Markdown content={Changelog} />
@@ -106,8 +106,7 @@ Set the `disabled` prop of `SegmentedControl` to disable the entire component in
106
106
 
107
107
  ### Dynamic Items
108
108
 
109
- `SegmentedControl` supports a
110
- [dynamic API](/getting-started/for-developers/resources/collection-api/#dynamic-items) where instead
109
+ `SegmentedControl` supports a [dynamic API](/getting-started/for-developers/resources/collection-api/#dynamic-items) where instead
111
110
  of statically providing the JSX for each `SegmentedControl.Item`, you pass an array of `items` in
112
111
  the `model` state and provide a render function to display the items.
113
112
 
@@ -0,0 +1,28 @@
1
+ import SystemIconList from './examples/IconList';
2
+ import AppletIconList from './examples/AppletIconList';
3
+ import{AccentIconList} from './examples/AccentIconList.tsx'
4
+ import Overview from './examples/Overview'
5
+
6
+
7
+ # Assets
8
+ Assets are graphics which help communicate meaning or highlight areas of interaction to our users. These may be presented individually or as part of a group with related information in components and patterns.
9
+
10
+ <ExampleCodeBlock code={Overview} />
11
+
12
+ ## Accent Icon List
13
+
14
+ Accent Icons add clarity, and visual interest, they bring delight to the experience by communicating the overall tone and meaning of a page.
15
+
16
+ <ExampleCodeBlock code={AccentIconList} />
17
+
18
+ ## Applet Icon List
19
+
20
+ Applet Icons convey entry points, categories of actions, or information sources on the Workday homepage.
21
+
22
+ <ExampleCodeBlock code={AppletIconList} />
23
+
24
+ ## System Icon List
25
+
26
+ System Icons are symbols used to convey simple actions and functions, they are the most common icons encountered in products and help communicate metaphors at a glance.
27
+
28
+ <ExampleCodeBlock code={SystemIconList} />
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+ import * as CanvasAccenttIcons from '@workday/canvas-accent-icons-web';
3
+ import {Box, Flex} from '@workday/canvas-kit-react/layout';
4
+ import {AccentIcon} from '@workday/canvas-kit-react/icon';
5
+ import {TextInput} from '@workday/canvas-kit-react/text-input';
6
+
7
+ const ImportedIcons = Object.keys(CanvasAccenttIcons);
8
+
9
+ const allIcons = ImportedIcons.filter(icon => icon !== 'CanvasAccenttIcons');
10
+
11
+ export default () => {
12
+ const [value, setValue] = React.useState('');
13
+
14
+ const handleSearch = (e: any) => {
15
+ setValue(e.target.value);
16
+ };
17
+
18
+ return (
19
+ <Flex flexDirection="column" alignItems="center" gap="m">
20
+ <TextInput onKeyDown={e => handleSearch(e)} placeholder="Search for an icon" />
21
+ <Flex flexWrap="wrap">
22
+ {allIcons
23
+ .filter(icon => {
24
+ if (value === '') {
25
+ return 'No icons found';
26
+ } else if (icon.toLocaleLowerCase().includes(value.toLocaleLowerCase())) {
27
+ return icon;
28
+ }
29
+ })
30
+ .map((singleIcon, index) => {
31
+ return (
32
+ <Flex
33
+ alignItems="center"
34
+ width={'max(320px,20%)'}
35
+ flexDirection="row"
36
+ gap="xs"
37
+ padding="xs"
38
+ key={index}
39
+ >
40
+ <Box>
41
+ <AccentIcon icon={CanvasAccenttIcons[singleIcon]} />
42
+ </Box>
43
+ <Box>{singleIcon}</Box>
44
+ </Flex>
45
+ );
46
+ })}
47
+ </Flex>
48
+ </Flex>
49
+ );
50
+ };
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+ import * as CanvasAppletIcons from '@workday/canvas-applet-icons-web';
3
+ import {Box, Flex} from '@workday/canvas-kit-react/layout';
4
+ import {AppletIcon} from '@workday/canvas-kit-react/icon';
5
+ import {TextInput} from '@workday/canvas-kit-react/text-input';
6
+
7
+ const ImportedIcons = Object.keys(CanvasAppletIcons);
8
+
9
+ const allIcons = ImportedIcons.filter(icon => icon !== 'CanvasAppletIcons');
10
+
11
+ export default () => {
12
+ const [value, setValue] = React.useState('');
13
+
14
+ const handleSearch = (e: any) => {
15
+ setValue(e.target.value);
16
+ };
17
+
18
+ return (
19
+ <Flex flexDirection="column" alignItems="center" gap="m">
20
+ <TextInput onKeyDown={e => handleSearch(e)} placeholder="Search for an icon" />
21
+ <Flex flexWrap="wrap">
22
+ {allIcons
23
+ .filter(icon => {
24
+ if (value === '') {
25
+ return 'No icons found';
26
+ } else if (icon.toLocaleLowerCase().includes(value.toLocaleLowerCase())) {
27
+ return icon;
28
+ }
29
+ })
30
+ .map((singleIcon, index) => {
31
+ return (
32
+ <Flex
33
+ alignItems="center"
34
+ width={'max(320px,20%)'}
35
+ flexDirection="row"
36
+ gap="xs"
37
+ padding="xs"
38
+ key={index}
39
+ >
40
+ <Box>
41
+ <AppletIcon icon={CanvasAppletIcons[singleIcon]} />
42
+ </Box>
43
+ <Box>{singleIcon}</Box>
44
+ </Flex>
45
+ );
46
+ })}
47
+ </Flex>
48
+ </Flex>
49
+ );
50
+ };
@@ -0,0 +1,49 @@
1
+ import React from 'react';
2
+ import * as CanvasIcons from '@workday/canvas-system-icons-web';
3
+ import {Box, Flex} from '@workday/canvas-kit-react/layout';
4
+ import {SystemIcon} from '@workday/canvas-kit-react/icon';
5
+ import {TextInput} from '@workday/canvas-kit-react/text-input';
6
+
7
+ const ImportedIcons = Object.keys(CanvasIcons);
8
+
9
+ const allIcons = ImportedIcons.filter(icon => icon !== 'CanvasSystemIcons');
10
+ export default () => {
11
+ const [value, setValue] = React.useState('');
12
+
13
+ const handleSearch = (e: any) => {
14
+ setValue(e.target.value);
15
+ };
16
+
17
+ return (
18
+ <Flex flexDirection="column" alignItems="center" gap="m">
19
+ <TextInput onKeyDown={e => handleSearch(e)} placeholder="Search for an icon" />
20
+ <Flex flexWrap="wrap">
21
+ {allIcons
22
+ .filter(icon => {
23
+ if (value === '') {
24
+ return 'No icons found';
25
+ } else if (icon.toLocaleLowerCase().includes(value.toLocaleLowerCase())) {
26
+ return icon;
27
+ }
28
+ })
29
+ .map((singleIcon, index) => {
30
+ return (
31
+ <Flex
32
+ alignItems="center"
33
+ width={'max(320px,20%)'}
34
+ flexDirection="row"
35
+ gap="xs"
36
+ padding="xs"
37
+ key={index}
38
+ >
39
+ <Box>
40
+ <SystemIcon icon={CanvasIcons[singleIcon]} />
41
+ </Box>
42
+ <Box>{singleIcon}</Box>
43
+ </Flex>
44
+ );
45
+ })}
46
+ </Flex>
47
+ </Flex>
48
+ );
49
+ };
@@ -0,0 +1,30 @@
1
+ import * as React from 'react';
2
+ import styled from '@emotion/styled';
3
+
4
+ import {Flex} from '@workday/canvas-kit-react/layout';
5
+ import {shieldIcon} from '@workday/canvas-accent-icons-web';
6
+ import {benefitsIcon} from '@workday/canvas-applet-icons-web';
7
+ import {CanvasGraphic, CanvasIconTypes} from '@workday/design-assets-types';
8
+
9
+ import {AccentIcon, AppletIcon, SystemIcon, SystemIconCircle, Graphic} from '../../index';
10
+ import {activityStreamIcon} from '@workday/canvas-system-icons-web';
11
+
12
+ const graphicExample: CanvasGraphic = {
13
+ name: 'badgeAchievement',
14
+ type: CanvasIconTypes.Graphic,
15
+ svg:
16
+ '<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" class="wd-graphic wd-graphic-badge-achievement" focusable="false" role="presentation" viewBox="0 0 50 50"><g fill="none" fill-rule="nonzero" class="wd-icon-container"><circle cx="25" cy="25" r="25" fill="#FFC943"/><path fill="#FF7A45" d="M17 12h23l-4.373 7.5L40 27H17z"/><path fill="#656464" d="M15 12h2v31h-2z"/><circle cx="16" cy="11.5" r="1.5" fill="#656464"/></g></svg>',
17
+ filename: 'wd-graphic-badge-achievement.svg',
18
+ category: '',
19
+ tags: [],
20
+ };
21
+
22
+ export default () => (
23
+ <Flex flexDirection="row" alignItems="center" gap="s">
24
+ <AccentIcon icon={shieldIcon} />
25
+ <AppletIcon icon={benefitsIcon} />
26
+ <SystemIcon icon={activityStreamIcon} />
27
+ <SystemIconCircle icon={activityStreamIcon} />
28
+ <Graphic src={graphicExample} />
29
+ </Flex>
30
+ );
@@ -33,7 +33,9 @@ supports all `BoxProps` such as `padding`, it also supports semantic anchor elem
33
33
 
34
34
  ### Style Props
35
35
 
36
- `Box` exposes [style props](/getting-started/for-developers/resources/style-props/) that allow you to modify styles in an ergonomic way across components. To learn more about individual sets of `Box` style props, consult the lists below.
36
+ `Box` exposes [style props](/getting-started/for-developers/resources/style-props/) that allow
37
+ you to modify styles in an ergonomic way across components. To learn more about individual sets of
38
+ `Box` style props, consult the lists below.
37
39
 
38
40
  - [Background Style Props](/getting-started/for-developers/resources/style-props/#background)
39
41
  - [Border Style Props](/getting-started/for-developers/resources/style-props/#border)
@@ -55,16 +55,14 @@ building layouts.
55
55
 
56
56
  #### Props
57
57
 
58
- `Flex` exposes
59
- [flex container style props](/getting-started/for-developers/resources/style-props/#flex) and `Box`
58
+ `Flex` exposes [flex container style props](/getting-started/for-developers/resources/style-props/#flex) and `Box`
60
59
  style props.
61
60
 
62
61
  ### Flex.Item
63
62
 
64
63
  `Flex.Item` is a subcomponent of `Flex`. It is a `Box` component under the hood and exposes
65
- [flex item style props](/getting-started/for-developers/resources/style-props/#flex-item) that map
66
- to CSS Flexbox Item properties. This provides greater control over how child components render in
67
- your layout.
64
+ [flex item style props](/getting-started/for-developers/resources/style-props/#flex-item) that map to CSS Flexbox Item
65
+ properties. This provides greater control over how child components render in your layout.
68
66
 
69
67
  #### Usage
70
68
 
@@ -78,6 +76,5 @@ your layout.
78
76
 
79
77
  #### Props
80
78
 
81
- `Flex.Item` exposes
82
- [flex item style props](/getting-started/for-developers/resources/style-props/#flex-item) and `Box`
79
+ `Flex.Item` exposes [flex item style props](/getting-started/for-developers/resources/style-props/#flex-item) and `Box`
83
80
  style props.
@@ -96,12 +96,14 @@ layouts.
96
96
 
97
97
  #### Props
98
98
 
99
- `Grid` exposes [grid container style props](/getting-started/for-developers/resources/style-props/#grid) and `Box` style props.
99
+ `Grid` exposes [grid container style props](/getting-started/for-developers/resources/style-props/#grid) and `Box`
100
+ style props.
100
101
 
101
102
  ### Grid.Item
102
103
 
103
- `Grid.Item` is a subcomponent of `Grid`. It is a `Box` component under the hood and exposes [grid item style props](/getting-started/for-developers/resources/style-props/#grid-item) that map to CSS Grid
104
- Item properties. This provides greater control over how child components render in your layout.
104
+ `Grid.Item` is a subcomponent of `Grid`. It is a `Box` component under the hood and exposes
105
+ [grid item style props](/getting-started/for-developers/resources/style-props/#grid) that map to CSS Grid Item
106
+ properties. This provides greater control over how child components render in your layout.
105
107
 
106
108
  #### Usage
107
109
 
@@ -117,4 +119,5 @@ Item properties. This provides greater control over how child components render
117
119
 
118
120
  #### Props
119
121
 
120
- `Grid.Item` exposes [grid item style props](/getting-started/for-developers/resources/style-props/#grid-item) and `Box` style props.
122
+ `Grid.Item` exposes [grid item style props](/docs/features-style-props--grid-item-example) and `Box`
123
+ style props.
@@ -20,9 +20,8 @@ import {
20
20
 
21
21
  # Canvas Kit Tabs
22
22
 
23
- `Tabs` is a [compound component](/getting-started/for-developers/resources/compound-components/)
24
- that allows users to navigate between related views of content while remaining in context of the
25
- page.
23
+ `Tabs` is a [compound component](/getting-started/for-developers/resources/compound-components/) that allows users to navigate between
24
+ related views of content while remaining in context of the page.
26
25
 
27
26
  [> Workday Design Reference](https://design.workday.com/components/navigation/tabs)
28
27
 
@@ -21,8 +21,8 @@ yarn add @workday/canvas-kit-react
21
21
  ### Basic Example
22
22
 
23
23
  `Text` is built on top of [`Box`](/components/layout/box/) and supports a multitude of
24
- [style props](/getting-started/for-developers/resources/style-props/) including spacing props such
25
- as `margin` and `padding`, as well as text styling props such as `fontSize` and `fontWeight`.
24
+ [style props](/getting-started/for-developers/resources/style-props/) including spacing props such as
25
+ `margin` and `padding`, as well as text styling props such as `fontSize` and `fontWeight`.
26
26
 
27
27
  `Text` renders a `<span>` element by default. You may override the rendered element using the `as`
28
28
  prop.
@@ -0,0 +1,51 @@
1
+ import {BorderRadius, Space, Depth, Colors, Type} from './examples/Tokens';
2
+ import Overview from './examples/Overview';
3
+
4
+
5
+ # Tokens
6
+
7
+ Tokens are the smallest pieces of our Design System with the primary function of storing UI
8
+ information. They enable building components and patterns with consistency across our platforms.
9
+
10
+ <ExampleCodeBlock code={Overview} />
11
+
12
+ ## Border Radius
13
+
14
+ ### Usage
15
+
16
+ <ExampleCodeBlock code={BorderRadius} />
17
+
18
+ ## Colors
19
+
20
+ Our color system enables consistency and recognition across many contexts. There are 27 sets of hues
21
+ with six shades in each color set.
22
+
23
+ ### Usage
24
+
25
+ <ExampleCodeBlock code={Colors} />
26
+
27
+ ## Depth
28
+
29
+ Light and shadows are utilized to indicate a sense of depth. This establishes hierarchy and provides
30
+ predictability within the Canvas user interface.
31
+
32
+ ### Usage
33
+
34
+ <ExampleCodeBlock code={Depth} />
35
+
36
+ ## Space
37
+
38
+ This guide will help you make decisions when spacing elements in your designs using our space Tokens
39
+
40
+ ### Usage
41
+
42
+ <ExampleCodeBlock code={Space} />
43
+
44
+ ## Type
45
+
46
+ Typography is at the core of our interface. With it, we create clear hierarchies that guide users
47
+ through our products.
48
+
49
+ ### Usage
50
+
51
+ <ExampleCodeBlock code={Type} />
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+ import styled from '@emotion/styled';
3
+
4
+ import {colors, type, depth, space, borderRadius} from '@workday/canvas-kit-react/tokens';
5
+ import {Flex} from '@workday/canvas-kit-react/layout';
6
+
7
+ const StyledCard = styled('div')({
8
+ ...depth[3],
9
+ padding: space.m,
10
+ borderRadius: borderRadius.m,
11
+ backgroundColor: colors.cinnamon300,
12
+ ...type.levels.body.medium,
13
+ });
14
+
15
+ export default () => (
16
+ <Flex>
17
+ <StyledCard>Using Tokens To Style</StyledCard>
18
+ </Flex>
19
+ );