@workday/canvas-kit-docs 17.0.0-alpha.0645-next.0 → 17.0.0-alpha.0655-next.0

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.
@@ -1,4 +1,116 @@
1
1
  module.exports = {specifications: [
2
+ {
3
+ "type": "file",
4
+ "name": "Accessory",
5
+ "children": [
6
+ {
7
+ "type": "describe",
8
+ "name": "Accessory",
9
+ "children": [
10
+ {
11
+ "type": "describe",
12
+ "name": "given the story is rendered",
13
+ "children": [
14
+ {
15
+ "type": "it",
16
+ "name": "should not have any axe errors"
17
+ }
18
+ ]
19
+ },
20
+ {
21
+ "type": "describe",
22
+ "name": "given the story is rendered",
23
+ "children": [
24
+ {
25
+ "type": "it",
26
+ "name": "should not have any axe errors"
27
+ }
28
+ ]
29
+ },
30
+ {
31
+ "type": "describe",
32
+ "name": "given the story is rendered",
33
+ "children": [
34
+ {
35
+ "type": "it",
36
+ "name": "should not have any axe errors"
37
+ }
38
+ ]
39
+ },
40
+ {
41
+ "type": "describe",
42
+ "name": "given the story is rendered",
43
+ "children": [
44
+ {
45
+ "type": "it",
46
+ "name": "should not have any axe errors"
47
+ }
48
+ ]
49
+ },
50
+ {
51
+ "type": "describe",
52
+ "name": "given the story is rendered",
53
+ "children": [
54
+ {
55
+ "type": "it",
56
+ "name": "should not have any axe errors"
57
+ }
58
+ ]
59
+ },
60
+ {
61
+ "type": "describe",
62
+ "name": "given the story is rendered",
63
+ "children": [
64
+ {
65
+ "type": "it",
66
+ "name": "should not have any axe errors"
67
+ }
68
+ ]
69
+ },
70
+ {
71
+ "type": "describe",
72
+ "name": "given the story is rendered",
73
+ "children": [
74
+ {
75
+ "type": "it",
76
+ "name": "should not have any axe errors"
77
+ }
78
+ ]
79
+ },
80
+ {
81
+ "type": "describe",
82
+ "name": "given the story is rendered",
83
+ "children": [
84
+ {
85
+ "type": "it",
86
+ "name": "should not have any axe errors"
87
+ }
88
+ ]
89
+ },
90
+ {
91
+ "type": "describe",
92
+ "name": "given the story is rendered",
93
+ "children": [
94
+ {
95
+ "type": "it",
96
+ "name": "should not have any axe errors"
97
+ }
98
+ ]
99
+ },
100
+ {
101
+ "type": "describe",
102
+ "name": "given the Media story is rendered",
103
+ "children": [
104
+ {
105
+ "type": "it",
106
+ "name": "should render the image"
107
+ }
108
+ ]
109
+ }
110
+ ]
111
+ }
112
+ ]
113
+ },
2
114
  {
3
115
  "type": "file",
4
116
  "name": "ActionBar",
@@ -18,11 +18,11 @@ export const packageJSONFile = `{
18
18
  "@emotion/react": "11.11.4",
19
19
  "@types/react": "18.2.60",
20
20
  "@types/react-dom": "18.2.19",
21
- "@workday/canvas-kit-labs-react": "16.1.10",
22
- "@workday/canvas-kit-preview-react": "16.1.10",
23
- "@workday/canvas-kit-react": "16.1.10",
24
- "@workday/canvas-kit-react-fonts": "^16.1.10",
25
- "@workday/canvas-kit-styling": "16.1.10",
21
+ "@workday/canvas-kit-labs-react": "16.1.12",
22
+ "@workday/canvas-kit-preview-react": "16.1.12",
23
+ "@workday/canvas-kit-react": "16.1.12",
24
+ "@workday/canvas-kit-react-fonts": "^16.1.12",
25
+ "@workday/canvas-kit-styling": "16.1.12",
26
26
  "@workday/canvas-system-icons-web": "^5.0.3",
27
27
  "@workday/canvas-expressive-icons-web": "1.0.1",
28
28
  "@workday/canvas-tokens-web": "4.4.0-beta.11"
@@ -19,11 +19,11 @@ export const packageJSONFile = `{
19
19
  "@emotion/react": "11.11.4",
20
20
  "@types/react": "18.2.60",
21
21
  "@types/react-dom": "18.2.19",
22
- "@workday/canvas-kit-labs-react": "16.1.10",
23
- "@workday/canvas-kit-preview-react": "16.1.10",
24
- "@workday/canvas-kit-react": "16.1.10",
25
- "@workday/canvas-kit-react-fonts": "^16.1.10",
26
- "@workday/canvas-kit-styling": "16.1.10",
22
+ "@workday/canvas-kit-labs-react": "16.1.12",
23
+ "@workday/canvas-kit-preview-react": "16.1.12",
24
+ "@workday/canvas-kit-react": "16.1.12",
25
+ "@workday/canvas-kit-react-fonts": "^16.1.12",
26
+ "@workday/canvas-kit-styling": "16.1.12",
27
27
  "@workday/canvas-system-icons-web": "^5.0.3",
28
28
  "@workday/canvas-expressive-icons-web": "1.0.1",
29
29
  "@workday/canvas-tokens-web": "4.4.0-beta.11"
@@ -0,0 +1,138 @@
1
+ import {ExampleCodeBlock, Specifications, SymbolDoc} from '@workday/canvas-kit-docs';
2
+ import Basic from './examples/Basic';
3
+ import Calendar from './examples/Calendar';
4
+ import Custom from './examples/Custom';
5
+ import Favicon from './examples/Favicon';
6
+ import File from './examples/File';
7
+ import Icon from './examples/Icon';
8
+ import Media from './examples/Media';
9
+ import Sizes from './examples/Sizes';
10
+ import Variants from './examples/Variants';
11
+
12
+
13
+ # Canvas Kit Accessory
14
+
15
+ `Accessory` is the small rounded visual that sits beside text, most often the leading element in a
16
+ list item or other row. It keeps every thumbnail in one consistent shape and size, so a list of
17
+ mixed content still feels uniform.
18
+
19
+ It can show a system icon, a file type, an image, a site favicon, a calendar date, or fully custom
20
+ content — whichever suits the row. Prefer `AccessoryIcon`, `AccessoryFile`, `AccessoryMedia`,
21
+ `AccessoryFavicon`, or `AccessoryCalendar`, which each extend the shared `Accessory` props (`size`,
22
+ `color`, `background`)
23
+ and render that shell. Use `Accessory` itself for custom content, such as a gradient icon.
24
+ Accessories are decorative and always hidden from
25
+ assistive technology. They do not handle clicks or focus.
26
+
27
+ ## Installation
28
+
29
+ ```sh
30
+ yarn add @workday/canvas-kit-labs-react
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ ### Basic Example
36
+
37
+ `Accessory` is only the tile — size and corner radius. It does not render a visual by itself. Use a
38
+ targeted accessory instead: `AccessoryIcon` for a system icon, `AccessoryFile` for a file type,
39
+ `AccessoryMedia` for an image (optionally with an icon on a scrim), `AccessoryFavicon` for a site
40
+ favicon, or `AccessoryCalendar` for a month and day. Put custom content inside
41
+ `Accessory` when none of those fit the row.
42
+
43
+ <ExampleCodeBlock code={Basic} />
44
+
45
+ ### Icon
46
+
47
+ `AccessoryIcon` renders a system icon in the tile. `variant` sets the fill and icon color.
48
+
49
+ <ExampleCodeBlock code={Icon} />
50
+
51
+ ### Media
52
+
53
+ `AccessoryMedia` fills the tile with an image. The image stays hidden until it loads. Pass `icon`
54
+ to center a glyph on a contrast scrim.
55
+
56
+ <ExampleCodeBlock code={Media} />
57
+
58
+ ### Favicon
59
+
60
+ `AccessoryFavicon` resolves a brand mark from a site URL or domain. The browser requests that mark
61
+ from Google's favicon service, which receives the hostname and the user's IP. The image uses
62
+ `referrerPolicy="no-referrer"`, so the app origin is not sent. At `large` and `extraLarge` the mark
63
+ sits inset in an outlined tile. At `medium` and smaller it fills the tile.
64
+
65
+ <ExampleCodeBlock code={Favicon} />
66
+
67
+ ### File
68
+
69
+ `AccessoryFile` renders a file type through the shared icon graphic. `type` chooses the glyph and
70
+ is a stencil modifier for the fill and icon color. Colored types keep their accent fill at every
71
+ size. `file` and `txt` use `surface.alt` and a default border.
72
+
73
+ <ExampleCodeBlock code={File} />
74
+
75
+ ### Calendar
76
+
77
+ `AccessoryCalendar` stacks a month label over the day. Pass `month` and `date`. The month uses a
78
+ critical color. The day uses the default foreground color. Both scale with `size`.
79
+
80
+ <ExampleCodeBlock code={Calendar} />
81
+
82
+ ### Custom
83
+
84
+ Use `Accessory` when the row needs content that is not a system icon, file type, image, or favicon.
85
+ Set
86
+ `accessoryStencil.vars.iconColor` and `accessoryStencil.vars.tileBackground` to recolor the tile.
87
+ The icon `data-part` keeps the tile's corner radius.
88
+
89
+ <ExampleCodeBlock code={Custom} />
90
+
91
+ ### Sizes
92
+
93
+ `size` is a shared `Accessory` prop on each component. `extraLarge` (40px) is the default.
94
+
95
+ <ExampleCodeBlock code={Sizes} />
96
+
97
+ ### Variants
98
+
99
+ `variant` is set on `AccessoryIcon`. It pairs an icon color with a tile fill. The fill is painted
100
+ at `medium`, `large`, and `extraLarge`. `outline` adds a default border at those larger sizes.
101
+
102
+ <ExampleCodeBlock code={Variants} />
103
+
104
+ ### Accessibility
105
+
106
+ Accessory components are presentational and always `aria-hidden`. Images use an empty `alt` because
107
+ assistive technology does not see content inside that tile. Name the item in adjacent text instead
108
+ of on the accessory. They are not buttons and do not take click or keyboard handlers.
109
+
110
+ ## Component API
111
+
112
+ ### Accessory
113
+
114
+ <SymbolDoc name="Accessory" fileName="/labs-react/" />
115
+
116
+ ### AccessoryIcon
117
+
118
+ <SymbolDoc name="AccessoryIcon" fileName="/labs-react/" />
119
+
120
+ ### AccessoryFile
121
+
122
+ <SymbolDoc name="AccessoryFile" fileName="/labs-react/" />
123
+
124
+ ### AccessoryMedia
125
+
126
+ <SymbolDoc name="AccessoryMedia" fileName="/labs-react/" />
127
+
128
+ ### AccessoryFavicon
129
+
130
+ <SymbolDoc name="AccessoryFavicon" fileName="/labs-react/" />
131
+
132
+ ### AccessoryCalendar
133
+
134
+ <SymbolDoc name="AccessoryCalendar" fileName="/labs-react/" />
135
+
136
+ ## Specifications
137
+
138
+ <Specifications file="./cypress/component/Accessory.spec.tsx" name="Accessory" />
@@ -0,0 +1,23 @@
1
+ import {
2
+ AccessoryFile,
3
+ AccessoryIcon,
4
+ AccessoryMedia,
5
+ } from '@workday/canvas-kit-labs-react/accessory';
6
+ import {createStyles} from '@workday/canvas-kit-styling';
7
+ import {checkIcon, playCircleIcon} from '@workday/canvas-system-icons-web';
8
+ import {system} from '@workday/canvas-tokens-web';
9
+
10
+ const rowStyles = createStyles({
11
+ display: 'flex',
12
+ alignItems: 'center',
13
+ gap: system.gap.sm,
14
+ flexWrap: 'wrap',
15
+ });
16
+
17
+ export default () => (
18
+ <div className={rowStyles}>
19
+ <AccessoryIcon icon={checkIcon} variant="blue" />
20
+ <AccessoryFile type="pdf" />
21
+ <AccessoryMedia icon={playCircleIcon} src="https://picsum.photos/seed/accessory/200/200" />
22
+ </div>
23
+ );
@@ -0,0 +1,17 @@
1
+ import {AccessoryCalendar} from '@workday/canvas-kit-labs-react/accessory';
2
+ import {createStyles} from '@workday/canvas-kit-styling';
3
+ import {system} from '@workday/canvas-tokens-web';
4
+
5
+ const rowStyles = createStyles({
6
+ display: 'flex',
7
+ alignItems: 'center',
8
+ gap: system.gap.sm,
9
+ });
10
+
11
+ export default () => (
12
+ <div className={rowStyles}>
13
+ <AccessoryCalendar date={30} month="Apr" />
14
+ <AccessoryCalendar date={1} month="May" />
15
+ <AccessoryCalendar date={24} month="Dec" />
16
+ </div>
17
+ );
@@ -0,0 +1,69 @@
1
+ import {
2
+ AccessoryFile,
3
+ AccessoryMedia,
4
+ accessoryStencil,
5
+ } from '@workday/canvas-kit-labs-react/accessory';
6
+ import {createStencil, createStyles} from '@workday/canvas-kit-styling';
7
+ import {checkIcon} from '@workday/canvas-system-icons-web';
8
+ import {system} from '@workday/canvas-tokens-web';
9
+
10
+ const columnStyles = createStyles({
11
+ display: 'flex',
12
+ flexDirection: 'column',
13
+ gap: system.gap.md,
14
+ });
15
+
16
+ const rowStyles = createStyles({
17
+ display: 'flex',
18
+ alignItems: 'center',
19
+ gap: system.gap.sm,
20
+ });
21
+
22
+ const labelStyles = createStyles({
23
+ display: 'flex',
24
+ flexDirection: 'column',
25
+ alignItems: 'center',
26
+ gap: system.gap.xs,
27
+ });
28
+
29
+ const customFileStencil = createStencil({
30
+ base: {
31
+ [accessoryStencil.vars.iconColor]: system.color.fg.inverse,
32
+ [accessoryStencil.vars.tileBackground]: system.color.accent.info,
33
+ },
34
+ });
35
+
36
+ const photo =
37
+ 'data:image/svg+xml,' +
38
+ encodeURIComponent(
39
+ `<svg xmlns="http://www.w3.org/2000/svg" width="160" height="80" viewBox="0 0 160 80">
40
+ <rect width="160" height="80" fill="#1c2833"/>
41
+ <circle cx="40" cy="40" r="22" fill="#243140"/>
42
+ <circle cx="80" cy="28" r="18" fill="#0e1620"/>
43
+ <circle cx="118" cy="48" r="24" fill="#2c3a48"/>
44
+ </svg>`
45
+ );
46
+
47
+ export default () => (
48
+ <div className={columnStyles}>
49
+ <div className={rowStyles}>
50
+ <AccessoryMedia icon={checkIcon} src={photo} />
51
+ <AccessoryMedia icon={checkIcon} objectFit="contain" src={photo} />
52
+ </div>
53
+ <div className={rowStyles}>
54
+ <div className={labelStyles}>
55
+ <AccessoryFile type="pdf" />
56
+ </div>
57
+ <div className={labelStyles}>
58
+ <AccessoryFile
59
+ background={system.color.accent.warning}
60
+ color={system.color.fg.warning.strong}
61
+ type="pdf"
62
+ />
63
+ </div>
64
+ <div className={labelStyles}>
65
+ <AccessoryFile cs={customFileStencil()} type="pdf" />
66
+ </div>
67
+ </div>
68
+ </div>
69
+ );
@@ -0,0 +1,16 @@
1
+ import {AccessoryFavicon} from '@workday/canvas-kit-labs-react/accessory';
2
+ import {createStyles} from '@workday/canvas-kit-styling';
3
+ import {system} from '@workday/canvas-tokens-web';
4
+
5
+ const rowStyles = createStyles({
6
+ display: 'flex',
7
+ alignItems: 'center',
8
+ gap: system.gap.sm,
9
+ });
10
+
11
+ export default () => (
12
+ <div className={rowStyles}>
13
+ <AccessoryFavicon size="medium" url="workday.com" />
14
+ <AccessoryFavicon url="design.workday.com" />
15
+ </div>
16
+ );
@@ -0,0 +1,29 @@
1
+ import {AccessoryFile, AccessoryFileType} from '@workday/canvas-kit-labs-react/accessory';
2
+ import {createStyles} from '@workday/canvas-kit-styling';
3
+ import {system} from '@workday/canvas-tokens-web';
4
+
5
+ const rowStyles = createStyles({
6
+ display: 'flex',
7
+ alignItems: 'center',
8
+ gap: system.gap.sm,
9
+ flexWrap: 'wrap',
10
+ });
11
+
12
+ const types: AccessoryFileType[] = [
13
+ 'pdf',
14
+ 'spreadsheet',
15
+ 'document',
16
+ 'presentation',
17
+ 'video',
18
+ 'file',
19
+ 'txt',
20
+ ];
21
+
22
+ export default () => (
23
+ <div className={rowStyles}>
24
+ {types.map(type => (
25
+ <AccessoryFile key={type} type={type} />
26
+ ))}
27
+ <AccessoryFile size="large" type="pdf" />
28
+ </div>
29
+ );
@@ -0,0 +1,17 @@
1
+ import {AccessoryIcon} from '@workday/canvas-kit-labs-react/accessory';
2
+ import {createStyles} from '@workday/canvas-kit-styling';
3
+ import {checkIcon} from '@workday/canvas-system-icons-web';
4
+ import {system} from '@workday/canvas-tokens-web';
5
+
6
+ const rowStyles = createStyles({
7
+ display: 'flex',
8
+ alignItems: 'center',
9
+ gap: system.gap.sm,
10
+ });
11
+
12
+ export default () => (
13
+ <div className={rowStyles}>
14
+ <AccessoryIcon icon={checkIcon} />
15
+ <AccessoryIcon icon={checkIcon} variant="blue" />
16
+ </div>
17
+ );
@@ -0,0 +1,3 @@
1
+ import {AccessoryMedia} from '@workday/canvas-kit-labs-react/accessory';
2
+
3
+ export default () => <AccessoryMedia src="https://picsum.photos/seed/accessory/200/200" />;
@@ -0,0 +1,34 @@
1
+ import {AccessoryIcon} from '@workday/canvas-kit-labs-react/accessory';
2
+ import {Subtext} from '@workday/canvas-kit-react/text';
3
+ import {createStyles, px2rem} from '@workday/canvas-kit-styling';
4
+ import {checkIcon} from '@workday/canvas-system-icons-web';
5
+ import {system} from '@workday/canvas-tokens-web';
6
+
7
+ const containerStyles = createStyles({
8
+ display: 'flex',
9
+ flexDirection: 'column',
10
+ gap: system.gap.md,
11
+ });
12
+
13
+ const rowStyles = createStyles({
14
+ display: 'flex',
15
+ alignItems: 'center',
16
+ gap: system.gap.md,
17
+ p: {
18
+ minWidth: px2rem(104),
19
+ margin: 0,
20
+ },
21
+ });
22
+
23
+ const sizes = ['extraSmall', 'small', 'medium', 'large', 'extraLarge'] as const;
24
+
25
+ export default () => (
26
+ <div className={containerStyles}>
27
+ {sizes.map(size => (
28
+ <div className={rowStyles} key={size}>
29
+ <Subtext size="large">{size}</Subtext>
30
+ <AccessoryIcon icon={checkIcon} size={size} />
31
+ </div>
32
+ ))}
33
+ </div>
34
+ );
@@ -0,0 +1,31 @@
1
+ import {AccessoryIcon, AccessoryIconVariant} from '@workday/canvas-kit-labs-react/accessory';
2
+ import {createStyles} from '@workday/canvas-kit-styling';
3
+ import {checkIcon} from '@workday/canvas-system-icons-web';
4
+ import {system} from '@workday/canvas-tokens-web';
5
+
6
+ const rowStyles = createStyles({
7
+ display: 'flex',
8
+ alignItems: 'center',
9
+ gap: system.gap.sm,
10
+ flexWrap: 'wrap',
11
+ });
12
+
13
+ const variants: AccessoryIconVariant[] = [
14
+ 'grey',
15
+ 'green',
16
+ 'blue',
17
+ 'purple',
18
+ 'amber',
19
+ 'magenta',
20
+ 'red',
21
+ 'orange',
22
+ 'outline',
23
+ ];
24
+
25
+ export default () => (
26
+ <div className={rowStyles}>
27
+ {variants.map(variant => (
28
+ <AccessoryIcon key={variant} icon={checkIcon} variant={variant} />
29
+ ))}
30
+ </div>
31
+ );