@workday/canvas-kit-docs 12.0.0-alpha.852-next.0 → 12.0.0-alpha.862-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.
@@ -538,7 +538,7 @@ module.exports = {specifications: [
538
538
  "children": [
539
539
  {
540
540
  "type": "describe",
541
- "name": "given default avatar light is rendered",
541
+ "name": "given default avatar is rendered",
542
542
  "children": [
543
543
  {
544
544
  "type": "it",
@@ -42,10 +42,9 @@ A note to the reader:
42
42
  - [InputIconContainer](#inputiconcontainer)
43
43
  - [Select (Preview)](#select-preview)
44
44
  - [Component Updates](#component-updates)
45
- - [Popup, Dialog and Modal](#popup-dialog-and-modal)
46
- - [Toast](#toast)
47
- - [Style Utility Updates](#style-utility-updates)
48
- - [createStencil](#createstencil)
45
+ - [Styling API and CSS Tokens](#styling-api-and-css-tokens)
46
+ - [Avatar](#avatar)
47
+ - [Text Area](#text-area)
49
48
  - [Troubleshooting](#troubleshooting)
50
49
  - [Glossary](#glossary)
51
50
  - [Main](#main)
@@ -57,8 +56,8 @@ A note to the reader:
57
56
  In v12, all the components listed in this guide have started using our new
58
57
  [Canvas Tokens Web](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs).
59
58
 
60
- In v12 you must add `@workday/canvas-tokens-web` to ensure our components are properly styled and the
61
- variables are defined. For more information on installing and using, please reference our tokens
59
+ In v12 you must add `@workday/canvas-tokens-web` to ensure our components are properly styled and
60
+ the variables are defined. For more information on installing and using, please reference our tokens
62
61
  [docs](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs).
63
62
 
64
63
  ## Deprecations
@@ -68,19 +67,24 @@ in a future major release. This signals consumers to migrate to a more stable al
68
67
  deprecated code is removed.
69
68
 
70
69
  ## Removals
71
- Removals are deletions from our codebase and you can no longer consume this component. We've either promoted or replaced a component or utility.
70
+
71
+ Removals are deletions from our codebase and you can no longer consume this component. We've either
72
+ promoted or replaced a component or utility.
72
73
 
73
74
  ### Select (Preview)
74
75
 
75
76
  **PR:** [#2796](https://github.com/Workday/canvas-kit/pull/2796)
76
77
 
77
- We've removed the `Select` component that was in Preview. Please use the compound [Select component from Main](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-select--basic).
78
+ We've removed the `Select` component that was in Preview. Please use the compound
79
+ [Select component from Main](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-select--basic).
78
80
 
79
81
  ### InputIconContainer
80
82
 
81
83
  **PR:** [#2838](https://github.com/Workday/canvas-kit/pull/2838)
82
84
 
83
- We've removed `InputIconContainer` from Main. Please use [InputGroup](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-text-input--icons) from Main instead.
85
+ We've removed `InputIconContainer` from Main. Please use
86
+ [InputGroup](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-text-input--icons)
87
+ from Main instead.
84
88
 
85
89
  ---
86
90
 
@@ -88,6 +92,10 @@ We've removed `InputIconContainer` from Main. Please use [InputGroup](https://wo
88
92
 
89
93
  ### Styling API and CSS Tokens
90
94
 
95
+ **PRs:** [#2825](https://github.com/Workday/canvas-kit/pull/2825),
96
+ [#2795](https://github.com/Workday/canvas-kit/pull/2795),
97
+ [#2793](https://github.com/Workday/canvas-kit/pull/2793)
98
+
91
99
  Several components have been refactored to use our new
92
100
  [Canvas Tokens](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs) and
93
101
  [styling API](https://workday.github.io/canvas-kit/?path=/docs/styling-basics--create-modifiers#createstyles-api).
@@ -95,24 +103,42 @@ The React interface **has not changed**, but CSS variables are now used for dyna
95
103
 
96
104
  The following components are affected:
97
105
 
98
- - `Popup`
106
+ - `Avatar`
99
107
  - `Dialog`
100
108
  - `Modal`
109
+ - `Popup`
110
+ - `TextArea`
111
+ - `TextInput`
101
112
  - `Toast`
102
113
 
103
114
  > **Note:** These components also support our new `cs` prop for styling. Learn more about styling
104
115
  > with `cs` in our
105
116
  > [documentation](https://workday.github.io/canvas-kit/?path=/docs/styling-basics--cs-prop).
106
117
 
107
- ### Popup, Dialog and Modal
118
+ ### Avatar
119
+
120
+ - Avatar no longer uses `SystemIconCircle` for sizing.
121
+ - `Avatar.Size` is no longer supported. The `size` prop type has change to accept the following:
122
+ `"extraExtraLarge" | "extraLarge" | "large" | "medium" | "small" | "extraSmall" | (string{})`
123
+ - `Avatar.Variant` is no longer supported. Enum `AvatarVariant` has been removed. The `variant` type
124
+ prop now accepts `"dark" | "light"`
125
+ - The `as` prop now accepts any element, not just `div`.
126
+
127
+ ### Text Area
108
128
 
109
- **PR:** [#2795](https://github.com/Workday/canvas-kit/pull/2795)
129
+ **PR:** [#2825](https://github.com/Workday/canvas-kit/pull/2825)
110
130
 
111
- ### Toast
131
+ `TextAreaResizeDirection` is no longer a TypeScript enum, but a JavaScript object. This change does
132
+ not effect runtime at all, but may cause TypeScript errors if you use `TextAreaResizeDirection` as a
133
+ type.
112
134
 
113
- **PR:** [#2795](https://github.com/Workday/canvas-kit/pull/2795)
135
+ ```tsx
136
+ // v11
137
+ interface MyProps { resize?: TextAreaResizeDirection }
114
138
 
115
- ## Style Utility Updates
139
+ // 12 type ValueOf<T> = T[keyof T]; interface MyProps { resize?:
140
+ ValueOf<typeof TextAreaResizeDirection> }
141
+ ```
116
142
 
117
143
  ## Troubleshooting
118
144
 
@@ -31,7 +31,7 @@ export default () => (
31
31
  <TertiaryButton aria-label="messages" icon={assistantIcon} />
32
32
  <TertiaryButton aria-label="notifications" icon={notificationsIcon} />
33
33
  <TertiaryButton aria-label="inbox" icon={inboxIcon} />
34
- <Avatar size={Avatar.Size.m} variant={Avatar.Variant.Light} />
34
+ <Avatar size="medium" variant="light" />
35
35
  </GlobalHeader.Item>
36
36
  </GlobalHeader>
37
37
  );
@@ -0,0 +1,93 @@
1
+ import {Specifications, SymbolDoc, SymbolDescription} from '@workday/canvas-kit-docs';
2
+
3
+ import {Basic} from '../avatar/examples/Basic';
4
+ import {Button} from '../avatar/examples/Button';
5
+ import {Image} from '../avatar/examples/Image';
6
+ import {LazyLoad} from '../avatar/examples/LazyLoad';
7
+ import {ObjectFit} from '../avatar/examples/ObjectFit';
8
+ import {Size} from '../avatar/examples/Size';
9
+ import {Variant} from '../avatar/examples/Variant';
10
+ import {CustomStyles} from '../avatar/examples/CustomStyles';
11
+
12
+
13
+ # Canvas Kit Avatar
14
+
15
+ Represents a person's profile.
16
+
17
+ [> Workday Design Reference](https://canvas.workdaydesign.com/components/indicators/avatar)
18
+
19
+ ## Installation
20
+
21
+ ```sh
22
+ yarn add @workday/canvas-kit-react
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ <SymbolDescription name="Avatar" fileName="/react/" />
28
+
29
+ The example below shows multiple instances of a `Avatar` with various configurations.
30
+
31
+ ### Basic
32
+
33
+ By default, the Avatar renders a `button` element. If yo'd like to change the default element, use
34
+ the `as` prop.
35
+
36
+ <ExampleCodeBlock code={Basic} />
37
+
38
+ ### Button
39
+
40
+ Like many of our components, Avatar accepts an `as` prop, which lets you change the underlying
41
+ semantic element to a `div`. This should be done with caution to ensure the best accessibility.
42
+ Generally, `<button>` elements should be used for actions.
43
+
44
+ <ExampleCodeBlock code={Button} />
45
+
46
+ ### Variant
47
+
48
+ Avatar defaults to using a `"light"` `variant` property. You can change the `variant` prop to "dark"
49
+ by including `variant="dark"`.
50
+
51
+ <ExampleCodeBlock code={Variant} />
52
+
53
+ ### Size
54
+
55
+ Avatar defaults to using a `"medium"` `size` property. You can change the `size` prop to various
56
+ sizing options. See Component API for more details.
57
+
58
+ Additionally, you can explicitly specify the size you want for the Avatar in pixels or rems.
59
+
60
+ <ExampleCodeBlock code={Size} />
61
+
62
+ ### Image
63
+
64
+ Avatar renders an image when the `url` prop is defined.
65
+
66
+ <ExampleCodeBlock code={Image} />
67
+
68
+ ### Object Fit
69
+
70
+ Avatar defaults to using `contain` for object-fit. You can change this property to any other
71
+ acceptable `object-fit` properties. For best fit, try to use square images.
72
+
73
+ <ExampleCodeBlock code={ObjectFit} />
74
+
75
+ ### Lazy Load
76
+
77
+ Example of implementing lazy load behavior with Avatar.
78
+
79
+ <ExampleCodeBlock code={LazyLoad} />
80
+
81
+ ### Custom Styling
82
+
83
+ To change the background color of the Avatar, you can use our `createStencil` functionality.
84
+
85
+ <ExampleCodeBlock code={CustomStyles} />
86
+
87
+ ## Component API
88
+
89
+ <SymbolDoc name="Avatar" fileName="/react/" />
90
+
91
+ ## Specifications
92
+
93
+ <Specifications file="Avatar.spec.ts" name="Avatar" />
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import {Avatar} from '@workday/canvas-kit-react/avatar';
3
+ import {createStyles} from '@workday/canvas-kit-styling';
4
+ import {system} from '@workday/canvas-tokens-web';
5
+
6
+ const handleAvatarButtonClick = () => console.log('AvatarButton clicked');
7
+
8
+ const containerStyles = createStyles({
9
+ display: 'inline-flex',
10
+ gap: system.space.x2,
11
+ });
12
+
13
+ export default () => (
14
+ <div className={containerStyles}>
15
+ <Avatar onClick={handleAvatarButtonClick} />
16
+ <Avatar as="div" />
17
+ </div>
18
+ );
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import {Avatar} from '@workday/canvas-kit-react/avatar';
3
+ import {createStyles} from '@workday/canvas-kit-styling';
4
+ import {system} from '@workday/canvas-tokens-web';
5
+ // @ts-ignore: Cannot find module error
6
+ import testAvatar from '../../test-avatar.png';
7
+
8
+ const handleAvatarButtonClick = () => console.log('AvatarButton clicked');
9
+
10
+ const containerStyles = createStyles({
11
+ display: 'inline-flex',
12
+ gap: system.space.x2,
13
+ });
14
+
15
+ export default () => (
16
+ <div className={containerStyles}>
17
+ <Avatar variant="dark" onClick={handleAvatarButtonClick} />
18
+ <Avatar onClick={handleAvatarButtonClick} />
19
+ <Avatar url={testAvatar} onClick={handleAvatarButtonClick} />
20
+ </div>
21
+ );
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import {Avatar} from '@workday/canvas-kit-react/avatar';
3
+ import {createStencil, createStyles} from '@workday/canvas-kit-styling';
4
+ import {base, system} from '@workday/canvas-tokens-web';
5
+ import {systemIconStencil} from '../../../../icon';
6
+
7
+ const customBlueAvatarStencil = createStencil({
8
+ base: {
9
+ backgroundColor: base.berrySmoothie400,
10
+ ['[data-slot="avatar-icon"]']: {
11
+ [systemIconStencil.vars.color]: base.berrySmoothie100,
12
+ },
13
+ },
14
+ });
15
+
16
+ const customGreenAvatarStencil = createStencil({
17
+ base: {
18
+ backgroundColor: base.watermelon400,
19
+ ['[data-slot="avatar-icon"]']: {
20
+ [systemIconStencil.vars.color]: base.watermelon100,
21
+ },
22
+ },
23
+ });
24
+
25
+ const containerStyles = createStyles({
26
+ display: 'inline-flex',
27
+ gap: system.space.x2,
28
+ });
29
+
30
+ export default () => (
31
+ <div className={containerStyles}>
32
+ <Avatar as="div" {...customBlueAvatarStencil()} />
33
+ <Avatar as="div" {...customGreenAvatarStencil()} />
34
+ </div>
35
+ );
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import {Avatar} from '@workday/canvas-kit-react/avatar';
3
+ // @ts-ignore: Cannot find module error
4
+ import testAvatar from '../../test-avatar.png';
5
+ import {createStyles} from '@workday/canvas-kit-styling';
6
+ import {system} from '@workday/canvas-tokens-web';
7
+
8
+ const containerStyles = createStyles({
9
+ display: 'flex',
10
+ flexDirection: 'column',
11
+ gap: system.space.x2,
12
+ });
13
+
14
+ export default () => (
15
+ <div className={containerStyles}>
16
+ <h3>Working Images</h3>
17
+ <Avatar size="extraExtraLarge" as="div" url={testAvatar} />
18
+ <Avatar size="extraLarge" as="div" url={testAvatar} />
19
+ <Avatar size="large" as="div" url={testAvatar} />
20
+ <Avatar size="medium" as="div" url={testAvatar} />
21
+ <Avatar size="small" as="div" url={testAvatar} />
22
+ <Avatar size="extraSmall" as="div" url={testAvatar} />
23
+ <h3>Broken Image</h3>
24
+ <Avatar url="/fake/path/to/image.png" as="div" />
25
+ </div>
26
+ );
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import {Avatar} from '@workday/canvas-kit-react/avatar';
3
+ // @ts-ignore: Cannot find module error
4
+ import testAvatar from '../../test-avatar.png';
5
+
6
+ export default () => (
7
+ <div className="story">
8
+ {Array.from({length: 5}, (v, index) => (
9
+ <>
10
+ <Avatar key={index} as="div" size="medium" url={testAvatar + '?v=' + index} />
11
+ <br />
12
+ </>
13
+ ))}
14
+ </div>
15
+ );
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import {Avatar} from '@workday/canvas-kit-react/avatar';
3
+ import {px2rem} from '@workday/canvas-kit-styling';
4
+
5
+ export default () => (
6
+ <div className="story">
7
+ <h3>Original Rectangle Image</h3>
8
+ <img alt="" src="https://picsum.photos/id/237/300/200" />
9
+ <h3>Object fit on a Rectangle Image</h3>
10
+ <Avatar as="div" url="https://picsum.photos/id/237/300/200" />
11
+ <h3>Object fit on a Rectangle Image using Dynamic Size</h3>
12
+ <Avatar
13
+ as="div"
14
+ size={px2rem(200)}
15
+ url="https://picsum.photos/id/237/300/200"
16
+ objectFit="contain"
17
+ />
18
+ <h3>Original Square Image</h3>
19
+ <img alt="" src="https://picsum.photos/id/237/300/300" />
20
+ <h3>Object fit on a Square Image</h3>
21
+ <Avatar as="div" url="https://picsum.photos/id/237/300/300" />
22
+ <h3>Object fit on a Square Image using Dynamic Size</h3>
23
+ <Avatar as="div" size={px2rem(200)} url="https://picsum.photos/id/237/300/300" />
24
+ </div>
25
+ );
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import {Avatar} from '@workday/canvas-kit-react/avatar';
3
+ import {px2rem} from '@workday/canvas-kit-styling';
4
+
5
+ export default () => (
6
+ <div className="story">
7
+ <h3>Extra-Extra Large</h3>
8
+ <Avatar as="div" size="extraExtraLarge" />
9
+ <h3>Extra Large</h3>
10
+ <Avatar as="div" size="extraLarge" />
11
+ <h3>Large</h3>
12
+ <Avatar as="div" size="large" />
13
+ <h3>Medium</h3>
14
+ <Avatar as="div" size="medium" />
15
+ <h3>Small</h3>
16
+ <Avatar as="div" size="small" />
17
+ <h3>Extra Small</h3>
18
+ <Avatar as="div" size="extraSmall" />
19
+ <h3>30px</h3>
20
+ <Avatar as="div" size={px2rem(30)} />
21
+ <h3>40px</h3>
22
+ <Avatar as="div" size={px2rem(40)} />
23
+ <h3>3rem</h3>
24
+ <Avatar as="div" size="3rem" />
25
+ <h3>4rem</h3>
26
+ <Avatar as="div" size="4rem" />
27
+ </div>
28
+ );
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import {Avatar} from '@workday/canvas-kit-react/avatar';
3
+
4
+ export default () => (
5
+ <div className="story">
6
+ <h3>Light</h3>
7
+ <Avatar as="div" size="medium" />
8
+ <h3>Dark</h3>
9
+ <Avatar as="div" size="medium" variant="dark" />
10
+ </div>
11
+ );
@@ -160,7 +160,7 @@ the popup's stack context when entering/exiting fullscreen.
160
160
 
161
161
  <ExampleCodeBlock code={FullScreen} />
162
162
 
163
- ### Opening an external window
163
+ ### Opening an External Window
164
164
 
165
165
  A popup can open an external window. This isn't supported directly. The `Popup.Popper` subcomponent
166
166
  is replaced with a custom subcomponent that connects to the Popup model and controls the lifecycle
@@ -16,7 +16,7 @@ import {
16
16
  import {Tooltip} from '@workday/canvas-kit-react/tooltip';
17
17
  import {Popup, usePopupModel} from '@workday/canvas-kit-react/popup';
18
18
  import {SecondaryButton} from '@workday/canvas-kit-react/button';
19
- import {Flex} from '../../../layout';
19
+ import {Flex} from '@workday/canvas-kit-react/layout';
20
20
 
21
21
  const mainContentStyles = createStyles({
22
22
  padding: system.space.x4,
@@ -106,7 +106,6 @@ const ExternalWindowPortal = ({
106
106
  onWindowClose();
107
107
  };
108
108
 
109
-
110
109
  window.addEventListener('unload', closeWindow);
111
110
  newWindow?.addEventListener('unload', closeWindow);
112
111
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-docs",
3
- "version": "12.0.0-alpha.852-next.0",
3
+ "version": "12.0.0-alpha.862-next.0",
4
4
  "description": "Documentation components of Canvas Kit components",
5
5
  "author": "Workday, Inc. (https://www.workday.com)",
6
6
  "license": "Apache-2.0",
@@ -44,10 +44,10 @@
44
44
  "dependencies": {
45
45
  "@emotion/styled": "^11.6.0",
46
46
  "@storybook/csf": "0.0.1",
47
- "@workday/canvas-kit-labs-react": "^12.0.0-alpha.852-next.0",
48
- "@workday/canvas-kit-preview-react": "^12.0.0-alpha.852-next.0",
49
- "@workday/canvas-kit-react": "^12.0.0-alpha.852-next.0",
50
- "@workday/canvas-kit-styling": "^12.0.0-alpha.852-next.0",
47
+ "@workday/canvas-kit-labs-react": "^12.0.0-alpha.862-next.0",
48
+ "@workday/canvas-kit-preview-react": "^12.0.0-alpha.862-next.0",
49
+ "@workday/canvas-kit-react": "^12.0.0-alpha.862-next.0",
50
+ "@workday/canvas-kit-styling": "^12.0.0-alpha.862-next.0",
51
51
  "@workday/canvas-system-icons-web": "^3.0.0",
52
52
  "@workday/canvas-tokens-web": "^2.0.0",
53
53
  "markdown-to-jsx": "^7.2.0",
@@ -59,5 +59,5 @@
59
59
  "mkdirp": "^1.0.3",
60
60
  "typescript": "4.2"
61
61
  },
62
- "gitHead": "bbd7343aec2a6657b8eff4981a7aa4a6e47af161"
62
+ "gitHead": "3b7726adda5b24aff4229e4ee8ca9f4f83522be3"
63
63
  }