@workday/canvas-kit-docs 12.0.0-alpha.834-next.0 → 12.0.0-alpha.846-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.
@@ -0,0 +1,172 @@
1
+ import {Table} from '@workday/canvas-kit-react/table';
2
+ import {base, brand, system} from '@workday/canvas-tokens-web';
3
+ import {StatusIndicator} from '@workday/canvas-kit-preview-react/status-indicator';
4
+ import {cssVar} from '@workday/canvas-kit-styling';
5
+ import {Box} from '@workday/canvas-kit-react/layout';
6
+
7
+
8
+ # Canvas Kit 12.0 Upgrade Guide
9
+
10
+ This guide contains an overview of the changes in Canvas Kit v12. Please
11
+ [reach out](https://github.com/Workday/canvas-kit/issues/new?labels=bug&template=bug.md) if you have
12
+ any questions.
13
+
14
+ ## Why You Should Upgrade
15
+
16
+ Canvas Kit v12 is transitioning into a
17
+ [new way of styling](https://github.com/Workday/canvas-kit/discussions/2265). Theming and building
18
+ an in sync Canvas Kit CSS has been at the top of our minds. We've started using our new
19
+ [Canvas Tokens Web](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs)
20
+ package to take advantage of
21
+ [CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) and
22
+ provide semantic tokens that can translate to theming components.
23
+
24
+ A note to the reader:
25
+
26
+ - While we still support our old tokens from `@workday/canvas-kit-react/tokens` in v12, you must
27
+ install our new tokens from `@workday/canvas-tokens-web`. You can find more info in our
28
+ [docs](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs).
29
+ - In this release, we've introduced a
30
+ [new styling API](https://workday.github.io/canvas-kit/?path=/docs/styling-basics--create-stencil).
31
+ This shouldn't effect the way you currently style your components. Because we're moving away from
32
+ Emotion, support for style props will eventually be removed, however, this API provide backwards
33
+ compatability. If you want to slowly move off of Emotion as well, you can start styling components
34
+ via the `cs` prop or our new styling utilities.
35
+
36
+ ## Table of contents
37
+
38
+ - [Canvas Tokens](#canvas-tokens)
39
+ - [Codemod](#codemod)
40
+ - [Deprecations](#deprecations)
41
+ - [Removals](#removals)
42
+ - [Select (Preview)](#select-preview)
43
+ - [Component Updates](#component-updates)
44
+ - [Popup, Dialog and Modal](#popup-dialog-and-modal)
45
+ - [Toast](#toast)
46
+ - [Style Utility Updates](#style-utility-updates)
47
+ - [createStencil](#createstencil)
48
+ - [Troubleshooting](#troubleshooting)
49
+ - [Glossary](#glossary)
50
+ - [Main](#main)
51
+ - [Preview](#preview)
52
+ - [Labs](#labs)
53
+
54
+ ## Canvas Tokens
55
+
56
+ In v12, all the components listed in this guide have started using our new
57
+ [Canvas Tokens Web](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs).
58
+
59
+ In v12 you must add `@workday/canvas-tokens-web` to ensure our components are properly styled and the
60
+ variables are defined. For more information on installing and using, please reference our tokens
61
+ [docs](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs).
62
+
63
+ ## Deprecations
64
+
65
+ We add the [@deprecated](https://jsdoc.app/tags-deprecated.html) JSDoc tag to code we plan to remove
66
+ in a future major release. This signals consumers to migrate to a more stable alternative before the
67
+ deprecated code is removed.
68
+
69
+ ## Removals
70
+ Removals are deletions from our codebase and you can no longer consume this component. We've either promoted or replaced a component or utility.
71
+
72
+ ### Select (Preview)
73
+
74
+ **PR:** [#2796](https://github.com/Workday/canvas-kit/pull/2796)
75
+
76
+ 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).
77
+
78
+ ---
79
+
80
+ ## Component Updates
81
+
82
+ ### Styling API and CSS Tokens
83
+
84
+ Several components have been refactored to use our new
85
+ [Canvas Tokens](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs) and
86
+ [styling API](https://workday.github.io/canvas-kit/?path=/docs/styling-basics--create-modifiers#createstyles-api).
87
+ The React interface **has not changed**, but CSS variables are now used for dynamic properties.
88
+
89
+ The following components are affected:
90
+
91
+ - `Popup`
92
+ - `Dialog`
93
+ - `Modal`
94
+ - `Toast`
95
+
96
+ > **Note:** These components also support our new `cs` prop for styling. Learn more about styling
97
+ > with `cs` in our
98
+ > [documentation](https://workday.github.io/canvas-kit/?path=/docs/styling-basics--cs-prop).
99
+
100
+ ### Popup, Dialog and Modal
101
+
102
+ **PR:** [#2795](https://github.com/Workday/canvas-kit/pull/2795)
103
+
104
+ ### Toast
105
+
106
+ **PR:** [#2795](https://github.com/Workday/canvas-kit/pull/2795)
107
+
108
+ ## Style Utility Updates
109
+
110
+ ## Troubleshooting
111
+
112
+ ### My Styles Seem Broken?
113
+
114
+ Our components are reliant on our new Canvas Tokens Web package. Be sure you install
115
+ `@workday/canvas-tokens-web`. For more information, reference our
116
+ [Getting Started docs](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs)
117
+ for this package.
118
+
119
+ ### Did You Upgrade All Canvas Kit Related Packages?
120
+
121
+ In order for all the packages to work in harmony, you must upgrade all Canvas Kit packages to the
122
+ same version that you're using, including:
123
+
124
+ - `@workday/canvas-kit-react`
125
+ - `@workday/canvas-kit-preview-react`
126
+ - `@workday/canvas-kit-labs-react`
127
+ - `@workday/canvas-kit-styling`
128
+ - `@workday/canvas-kit-react-fonts`
129
+ - `@workday/canvas-kit-docs`
130
+
131
+ ## Glossary
132
+
133
+ ### Main
134
+
135
+ Our Main package of Canvas Kit tokens, components, and utilities at `@workday/canvas-kit-react` has
136
+ undergone a full design and a11y review and is approved for use in product.
137
+
138
+ Breaking changes to code in Main will only occur during major version updates and will always be
139
+ communicated in advance and accompanied by migration strategies.
140
+
141
+ ---
142
+
143
+ ### Preview
144
+
145
+ Our Preview package of Canvas Kit tokens, components, and utilities at
146
+ `@workday/canvas-kit-preview-react` has undergone a full design and a11y review and is approved for
147
+ use in product, but may not be up to the high code standards upheld in the [Main](#main) package.
148
+ Preview is analagous to code in beta.
149
+
150
+ Breaking changes are unlikely, but possible, and can be deployed to Preview at any time without
151
+ triggering a major version update, though such changes will be communicated in advance and
152
+ accompanied by migration strategies.
153
+
154
+ Generally speaking, our goal is to eventually promote code from Preview to [Main](#main).
155
+ Occasionally, a component with the same name will exist in both [Main](#main) and Preview (for
156
+ example, see Segmented Control in [Preview](/components/buttons/segmented-control/) and
157
+ [Main](https://d2krrudi3mmzzw.cloudfront.net/v8/?path=/docs/components-buttons-segmented-control--basic)).
158
+ In these cases, Preview serves as a staging ground for an improved version of the component with a
159
+ different API. The component in [Main](#main) will eventually be replaced with the one in Preview.
160
+
161
+ ---
162
+
163
+ ### Labs
164
+
165
+ Our Labs package of Canvas Kit tokens, components, and utilities at `@workday/canvas-kit-labs-react`
166
+ has **not** undergone a full design and a11y review. Labs serves as an incubator space for new and
167
+ experimental code and is analagous to code in alpha.
168
+
169
+ Breaking changes can be deployed to Labs at any time without triggering a major version update and
170
+ may not be subject to the same rigor in communcation and migration strategies reserved for breaking
171
+ changes in [Preview](#preview) and [Main](#main). import { opacity } from
172
+ "@workday/canvas-tokens-web/dist/es6/system"
@@ -41,9 +41,24 @@ const myCustomStyles = createStyles({
41
41
  textTransform: 'uppercase',
42
42
  });
43
43
 
44
+ const customColors = {
45
+ default: {
46
+ background: system.color.static.green.soft,
47
+ icon: system.color.static.green.strong,
48
+ label: system.color.static.green.strong,
49
+ },
50
+ hover: {
51
+ background: system.color.static.green.default,
52
+ icon: system.color.static.green.strong,
53
+ },
54
+ };
55
+
44
56
  export default () => (
45
57
  <Grid cs={{gap: px2rem(4), gridTemplateColumns: 'repeat(3, 1fr)', alignItems: 'center'}}>
46
58
  <MyCustomButton icon={plusIcon}>Styling Override Via Stencil Variables</MyCustomButton>
47
59
  <PrimaryButton cs={myCustomStyles}>Style Override Via Create Styles</PrimaryButton>
60
+ <PrimaryButton icon={plusIcon} colors={customColors}>
61
+ Styling Override Via Colors Prop
62
+ </PrimaryButton>
48
63
  </Grid>
49
64
  );
@@ -3,10 +3,10 @@ import {Modal, useModalModel} from '@workday/canvas-kit-react/modal';
3
3
  import {DeleteButton} from '@workday/canvas-kit-react/button';
4
4
  import {FormField} from '@workday/canvas-kit-preview-react/form-field';
5
5
  import {Flex, Box} from '@workday/canvas-kit-react/layout';
6
- import {Select} from '@workday/canvas-kit-preview-react/select';
6
+ import {Select} from '@workday/canvas-kit-react/select';
7
7
 
8
8
  export default () => {
9
- const ref = React.useRef<HTMLInputElement>(null);
9
+ const ref = React.useRef(null);
10
10
  const [value, setValue] = React.useState('');
11
11
  const model = useModalModel({
12
12
  returnFocusRef: ref,
@@ -18,24 +18,29 @@ export default () => {
18
18
 
19
19
  return (
20
20
  <Modal model={model}>
21
- <FormField>
22
- <FormField.Label>Choose an option</FormField.Label>
23
- <FormField.Input
24
- as={Select}
25
- ref={ref}
26
- options={['', 'Delete', 'Two']}
27
- value={value}
28
- onChange={e => {
29
- const option = e.currentTarget.value;
30
- if (option === 'Delete') {
31
- model.events.show();
32
- setValue('');
33
- } else {
34
- setValue(e.currentTarget.value);
35
- }
36
- }}
37
- />
38
- </FormField>
21
+ <Select items={['', 'Delete', 'Two']}>
22
+ <FormField>
23
+ <FormField.Label>Choose an option</FormField.Label>
24
+ <FormField.Input
25
+ as={Select.Input}
26
+ ref={ref}
27
+ onChange={e => {
28
+ const option = e.currentTarget.value;
29
+ if (option === 'Delete') {
30
+ model.events.show();
31
+ setValue('');
32
+ } else {
33
+ setValue(e.currentTarget.value);
34
+ }
35
+ }}
36
+ />
37
+ <Select.Popper>
38
+ <Select.Card>
39
+ <Select.List>{item => <Select.Item>{item}</Select.Item>}</Select.List>
40
+ </Select.Card>
41
+ </Select.Popper>
42
+ </FormField>
43
+ </Select>
39
44
  <Modal.Overlay>
40
45
  <Modal.Card>
41
46
  <Modal.CloseIcon aria-label="Close" />
@@ -26,7 +26,7 @@ export default () => {
26
26
  return (
27
27
  <Popup model={model}>
28
28
  <Popup.Target as={DeleteButton}>Delete Item</Popup.Target>
29
- <Popup.Popper placement="bottom">
29
+ <Popup.Popper placement="top">
30
30
  <Popup.Card width={400}>
31
31
  <Popup.CloseIcon aria-label="Close" />
32
32
  <Popup.Heading>Delete Item</Popup.Heading>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-docs",
3
- "version": "12.0.0-alpha.834-next.0",
3
+ "version": "12.0.0-alpha.846-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.834-next.0",
48
- "@workday/canvas-kit-preview-react": "^12.0.0-alpha.834-next.0",
49
- "@workday/canvas-kit-react": "^12.0.0-alpha.834-next.0",
50
- "@workday/canvas-kit-styling": "^12.0.0-alpha.834-next.0",
47
+ "@workday/canvas-kit-labs-react": "^12.0.0-alpha.846-next.0",
48
+ "@workday/canvas-kit-preview-react": "^12.0.0-alpha.846-next.0",
49
+ "@workday/canvas-kit-react": "^12.0.0-alpha.846-next.0",
50
+ "@workday/canvas-kit-styling": "^12.0.0-alpha.846-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": "^6.10.3",
@@ -59,5 +59,5 @@
59
59
  "mkdirp": "^1.0.3",
60
60
  "typescript": "4.2"
61
61
  },
62
- "gitHead": "d810cce07772db36ba395b874bd25d90e6072b09"
62
+ "gitHead": "92573a5cb42a250072618c814c0bc78edaf0480a"
63
63
  }