@workday/canvas-kit-docs 9.0.0-alpha.382-next.2 → 9.0.0-alpha.384-next.3

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.
@@ -5,20 +5,26 @@ This guide contains an overview of the changes in Canvas Kit v9. Please
5
5
  any questions.
6
6
 
7
7
  - [Codemod](#codemod)
8
- - [Component Deprecations](#component-deprecations)
8
+ - [Removals](#Removals)
9
9
  - [Drawer](#drawer)
10
10
  - [Layout and Column](#layout-and-column)
11
- - [Stack](#stack-hstack-vstack)
12
- - [Component Updates](#component-updates)
13
- - [Buttons](#buttons) - [Toast](#toast)
14
- - [Utility Updates](#utility-updates)
11
+ - [Stack, HStack, and VStack](#stack-hstack-and-vstack)
15
12
  - [focusRing](#focusring)
16
- - [useTheme and getTheme](#useTheme-and-getTheme)
17
- - [useCanvasTheme and getCanvasTheme](#useCanvasTheme-and-getCanvasTheme)
18
- - [useThemedRing](#useThemedRing)
19
- - [useThemeRTL](#useThemeRTL)
13
+ - [useCanvasTheme and getCanvasTheme](#usecanvastheme-and-getcanvastheme)
14
+ - [Deprecations](#deprecations)
15
+ - [useThemeRTL](#usethemertl)
20
16
  - [Token Updates](#token-updates)
21
17
  - [Depth](#depth)
18
+ - [Component Updates](#component-updates)
19
+ - [Button](#button)
20
+ - [Toast](#toast)
21
+ - [Utility Updates](#utility-updates)
22
+ - [useTheme and getTheme](#usetheme-and-gettheme)
23
+ - [useThemedRing](#usethemedring)
24
+ - [Glossary](#glossary)
25
+ - [Main](#main)
26
+ - [Preview](#preview)
27
+ - [Labs](#labs)
22
28
 
23
29
  ## Codemod
24
30
 
@@ -51,157 +57,262 @@ handled by the codemod are marked with 🤖 in the Upgrade Guide.**
51
57
  the changes from the codemod as a single isolated commit (separate from other changes) so you can
52
58
  roll back more easily if necessary.
53
59
 
54
- ## Component Deprecations
60
+ ## Removals
61
+ Removals are deletions from our codebase and you can no longer consume this component.
62
+ We've either promoted or replaced a component or utility.
63
+
55
64
 
56
- ### Deprecation Types
57
65
 
58
- #### Soft Deprecation
59
66
 
60
- A soft-deprecated component is still available with its full functionality, but it will have been
61
- renamed with a prefix to indicate its soft-deprecated status. It will also include a console warning
62
- announcing its deprecation. This warning will only be triggered on the component's initial render.
67
+ ### Drawer
63
68
 
64
- Soft-deprecated types and utilities will also have been renamed but generally will not trigger a
65
- console warning.
69
+ **PR:** [#1970](https://github.com/Workday/canvas-kit/pull/1970)
66
70
 
67
- #### Hard Deprecation
71
+ We've removed the `Drawer` component (for reference, see the
72
+ [`Drawer`](https://d2krrudi3mmzzw.cloudfront.net/v8/?path=/docs/labs-drawer--basic) from v8). Please
73
+ use the [`SidePanel`](/components/containers/side-panel/) in [Preview](#preview) instead.
68
74
 
69
- A hard-deprecated component or package is no longer available. You will need to follow the method
70
- prescribed in our Upgrade Guide to update your application. Please
71
- [reach out](https://github.com/Workday/canvas-kit/issues/new?labels=bug&template=bug.md) to our team
72
- directly if you need additional help.
75
+ > **Note:** The `SidePanel` in Main will eventually be replaced with the `SidePanel` in Preview. We
76
+ > recommend you use the `SidePanel` in Preview until then.
73
77
 
74
78
  ---
75
79
 
76
- ### Drawer
80
+ ### Layout and Column
77
81
 
78
- <!---
79
- TODO: Please review this section with documenting SidePanel deprication
80
- -->
82
+ **PR:** [#2018](https://github.com/Workday/canvas-kit/pull/2018)
81
83
 
82
- We've [hard-deprecated](#hard-deprecation) `Drawer` and this component has been fully removed from
83
- Canvas Kit. Consider using the
84
- [Side Panel](https://workday.github.io/canvas-kit/?path=/story/preview-side-panel--basic). Be Aware
85
- that `SidePanel` from the Main package is planned to be replaced by the one from Preview. We suggest
86
- you use the Preview version of `SidePanel` until the one in Main is replaced with it.
84
+ We've removed the `Layout` and `Column` components (for reference, see
85
+ [`Column and Layout`](https://d2krrudi3mmzzw.cloudfront.net/v8/?path=/docs/components-containers-column-and-layout--12-column-layout)
86
+ from v8). Please use [`Grid`](/components/layout/grid/) instead. While `Grid` is not a 1:1
87
+ replacement for `Layout` and `Column`, it can be used to generate the same types of layouts and
88
+ offers a more robust and flexible layout solution.
89
+
90
+ Please refer to our [Layout examples](/examples/layout/) for examples of how to implement common
91
+ layouts using `Grid`.
87
92
 
88
93
  ---
89
94
 
90
- ### Layout and Column
95
+ ### Stack, HStack and VStack
96
+
97
+ **PR:** [#2012](https://github.com/Workday/canvas-kit/pull/2012)
98
+
99
+ We've removed the `Stack`, `HStack`, and `VStack` components (for reference, see
100
+ [`Stack`](https://d2krrudi3mmzzw.cloudfront.net/v8/?path=/docs/components-layout-stack--basic-stack)
101
+ from v8). Please use [`Flex`](/components/layout/flex/) instead. `Flex` supports the same consistent
102
+ spacing between its elements via the `gap` prop (analogous to the `spacing` prop from `Stack`).
103
+
104
+ ```tsx
105
+ // v8
106
+ <Stack spacing="s">
107
+ ...
108
+ </Stack>
109
+
110
+ // v9
111
+ <Flex gap="s">
112
+ ...
113
+ </Flex>
114
+ ```
115
+
116
+ The orientation of `VStack` elements can be replicated with `Flex` using `flexDirection`.
117
+
118
+ ```tsx
119
+ // v8
120
+ <VStack>
121
+ ...
122
+ </VStack>
123
+
124
+ // v9
125
+ <Flex flexDirection="column">
126
+ ...
127
+ </Flex>
128
+ ```
129
+
130
+ The `StackProps`, `HStackProps`, `VStackProps`, and `StackStyleProps` types have been removed as
131
+ well. All references to these types in your custom components will need to be replaced with
132
+ `FlexProps`.
133
+
134
+ 🤖 The codemod will handle all of the changes above for you automatically.
135
+
136
+ > **Note:** If you were consuming `StackProps` previously for a custom component, be sure to change
137
+ > all references to the old `spacing` prop from `StackProps` to the `gap` prop from `FlexProps`.
138
+
139
+ ---
140
+
141
+ ### focusRing
142
+
143
+ **PR:** [#2034](https://github.com/Workday/canvas-kit/pull/2034)
144
+
145
+ We've removed memoization from `focusRing`. The `memoize` argument passed to `focusRing` is no
146
+ longer valid, and we've removed `memoizedFocusRing`. We were unable to find any examples of
147
+ `memoize` or `memoizedFocusRing` in use by our consumers.
148
+
149
+ ---
150
+
151
+ ### useCanvasTheme and getCanvasTheme
152
+
153
+ **PR:** [#2120](https://github.com/Workday/canvas-kit/pull/2120)
154
+
155
+ We've removed `useCanvasTheme` and `getCanvasTheme`. Please use `useTheme` and `getTheme` instead.
91
156
 
92
- `Layout` and `Column` components have been [hard-deprecated](#hard-deprecation) and are no longer
93
- available in Canvas Kit. Please consider using
94
- [`Grid`](https://workday.github.io/canvas-kit/?path=/docs/components-containers-grid--basic)
95
- instead. While the `Grid` component is not a 1:1 replacement for `Layout`, it can be used in the
96
- same way and offers several benefits over the deprecated components as a more robust and flexible
97
- layout solution.
157
+ ## Deprecations
98
158
 
99
- Please refer to
100
- [the Examples section](https://workday.github.io/canvas-kit/?path=/docs/examples-layouts--custom-column-positioning)
101
- for ideas on how to replace the deprecated `Layout` component with the `Grid` component. This will
102
- provide you with a deeper understanding of how to set custom column width or positioning using the
103
- `Grid` component.
159
+ We add the [@deprecated](https://jsdoc.app/tags-deprecated.html) from JSDoc to code that we plan to deprecate in the near future.
160
+ Al though you can still consume this code, we want consumers to move to a utility or component that is more stable.
161
+
162
+ ### useThemeRTL
163
+
164
+ **PR:** [#2119](https://github.com/Workday/canvas-kit/pull/2119)
165
+
166
+ We've deprecated `useThemeRTL` from [Labs](#labs). Although you may still use this utility, we recommend
167
+ using
168
+ [CSS logical properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties)
169
+ instead.
104
170
 
105
171
  ---
106
172
 
107
- ### Stack, HStack and vstack
173
+ ## Token Updates
174
+
175
+ ### Depth
108
176
 
109
- We've hard deprecated the `Stack`, `HStack` and `VStack` components along with the props associated
110
- to those components (`StackProps`, `HStackProps`, `VStackProps`, `StackStyleProps`). We recommend
111
- using the `Flex` component and to replace the `spacing` prop with the `gap` prop. You can also run
112
- `npx @workday/canvas-kit-codemod v9 [path]`.
177
+ **PR:** [#2091](https://github.com/Workday/canvas-kit/pull/2091)
113
178
 
114
- > **Note**: If you are consuming `StackProps` for a custom component, please make sure to change the
115
- > `spacing` prop to the `gap` prop
179
+ In v7, we released an update to our depth tokens that was too bold and harsh for web applications.
180
+ We've modified the depth token styles to be more subtle and improve visual design. This change
181
+ affects all components which use depth tokens including `Card`, `Toast`, `Dialog`, `Popup`, `Modal`,
182
+ and `Menu`. We have not changed which depth values each component references (i.e., `Card` remains
183
+ at `depth[1]`).
116
184
 
117
185
  ## Component Updates
118
186
 
119
- ### Buttons
187
+ ### Button
188
+
189
+ **PR:** [#1978](https://github.com/Workday/canvas-kit/pull/1978)
190
+
191
+ We've changed the default `type` attribute for all buttons to `type="button"`. Previously, the
192
+ `type` attribute was not being set which resulted in the buttons
193
+ [defaulting to `type="submit"`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes).
120
194
 
121
- We've changed the default `type` attribute of all our `buttons` to be `type="button"` instead of the
122
- default `type="submit"`. This is a breaking change if you expected a button to submit by default.
195
+ This affects all buttons which extend `BaseButton`:
123
196
 
124
- We found an issue where the default action for `form` controls like `input` and `textarea` is to
125
- click the first `submit` `button` which in some cases is not a `submit` button.
197
+ - `PrimaryButton`
198
+ - `SecondaryButton`
199
+ - `TertiaryButton`
200
+ - `DeleteButton`
201
+ - `ToolbarDropdownButton` and `ToolbarIconButton`
202
+ - `Pill` and `Pill.IconButton`
203
+ - `SegmentedControl.Button` (Main)
204
+ - `SegmentedControl.Item` (Preview)
205
+ - `Pagination.PageButton`
126
206
 
127
- An example of this causing issues was our `Modal.CloseIcon` and `Modal.CloseButton`. When the
128
- `Modal` is wrapped in a `form` element, the close icon would submit the `form`.
207
+ Any buttons which extend any of the above are affected as well.
129
208
 
130
- This change affects all of our `buttons` including:
131
- `PrimaryButton, SecondaryButton, TertiaryButton, ToolbarButton`.
209
+ This resolves an [issue](https://github.com/Workday/canvas-kit/issues/1938) where clicking certain
210
+ buttons within a `form` element would unexpectedly submit the form. Additionally, the default action
211
+ of many form controls such as `input` and `textarea` is to click the first submit button; this led
212
+ to issues if the first submit button in the form was not intended to be a submit button (a common
213
+ mistake when buttons default to `type="submit"`).
132
214
 
133
- If you still wish for a specific `button` within a `form` to submit, just add the attribute
134
- `type="submit"`.
215
+ This is a breaking change if you expected a button to submit by default, though we do not anticipate
216
+ this to be the case for most developers. If you _do_ intend for a button to act as a submit button
217
+ within a form, add `type="submit"` to the button.
218
+
219
+ ---
135
220
 
136
221
  ### Toast
137
222
 
138
- We've promoted `Toast` from Labs (`@workday/canvas-kit-labs-react`) to the Main
139
- (`@workday/canvas-kit-react`) package.
223
+ **PR:** [#2044](https://github.com/Workday/canvas-kit/pull/2044)
140
224
 
141
- - This component is a
142
- [compound component](/getting-started/for-developers/resources/compound-components/).
143
- - It has a `mode` prop that allows for proper accessibility attributes to be defined.
144
- - Its sub components allow for more flexibility and access to lower level elements.
225
+ We've promoted `Toast` from [Labs](#labs) to [Main](#main). It replaces the `Toast` that was previously in [Main](#main) (for
226
+ reference, see
227
+ [`Toast`](https://d2krrudi3mmzzw.cloudfront.net/v8/?path=/docs/components-popups-toast--error) in
228
+ [Main](#main) from v8).
229
+
230
+ `Toast` is a [compound component](/getting-started/for-developers/resources/compound-components/)
231
+ which provides a flexible API and access to its internals via its subcomponents. It supports a new
232
+ `mode` prop which applies the proper accessibility features to the component based on the desired
233
+ mode: `status`, `alert`, or `dialog`.
145
234
 
146
235
  ```tsx
147
236
  // v8
148
- <Toast actionText="View more details" onClose={handleClose}>Your workbook was successfully processed.</Toast>
237
+ <Toast actionText="View more details" onActionClick={handleActionClick} onClose={handleClose}>
238
+ Your workbook was successfully processed.
239
+ </Toast>
149
240
 
150
241
  // v9
151
242
  <Toast mode="dialog">
152
243
  <Toast.Icon icon={checkIcon} color={colors.greenApple400} />
153
244
  <Toast.Body>
154
245
  <Toast.Message>Your workbook was successfully processed.</Toast.Message>
155
- <Toast.Link href="#hreflink">Custom Link</Toast.Link>
246
+ <Toast.Link onClick={handleActionClick}>View more details</Toast.Link>
156
247
  </Toast.Body>
157
248
  <Toast.CloseIcon aria-label="Close" onClick={handleClose} />
158
249
  </Toast>
159
250
  ```
160
251
 
161
- 🤖 The codemod will convert the `Toast` into a compound component with it's sub components having
162
- the correct props.
252
+ 🤖 The codemod will rewrite your usages of the previous `Toast` in [Main](#main) to use the compound
253
+ component API of the new `Toast` in [Main](#main). `mode` will be set to `dialog` if the `Toast` previously
254
+ used `actionText` or `onActionClick`. The codemod will also update imports from the [Labs](#labs) `Toast` to
255
+ instead import from [Main](#main).
163
256
 
164
- > **Note**: If your Toast is a warning of some kind, you'll have to manually set the `mode` to
165
- > `alert`.
257
+ > **Note:** You will manually need to set `mode` to `alert` if your `Toast` conveys urgent and
258
+ > important information such as an error.
166
259
 
167
260
  ## Utility Updates
168
261
 
169
- ### focusRing
170
-
171
- We're removing memoization from focus ring. The `memoize` argument passed to `focusRing` is no
172
- longer valid and we've removed the exported `memoizedFocusRing`. There is no codemod for this
173
- change. We couldn't find any example of `memoize` or `memoizedFocusRing` being used.
174
-
175
262
  ### useTheme and getTheme
176
263
 
177
- We've updated `useTheme` by adding error handling if this hook has been used outside a functional
178
- component. Also, `getTheme` method has been added to access a theme from `styled` or class
179
- components instead of `useTheme`.
264
+ **PR:** [#2120](https://github.com/Workday/canvas-kit/pull/2120)
180
265
 
181
- ### useCanvasTheme and getCanvasTheme
182
-
183
- `useCanvasTheme` and `getCanvasTheme` have been removed and can be safely replaced by `useTheme`
184
- and `getTheme`.
266
+ We've added error handling to `useTheme` if it's been used outside a functional component. We've
267
+ also added `getTheme` to provide access to a theme from `styled` or class components instead of
268
+ `useTheme`.
185
269
 
186
270
  ### useThemedRing
187
271
 
188
- We've promoted `useThemedRing` from our Labs package to our Main package. You can use this utility
189
- to theme focus rings.
272
+ **PR:** [#2119](https://github.com/Workday/canvas-kit/pull/2119)
273
+
274
+ We've promoted `useThemedRing` from [Labs](#labs) to [Main](#main). `useThemedRing` allows you to theme focus rings.
190
275
 
191
276
  🤖 The codemod will update the import for this utility.
192
277
 
193
- ### useThemeRTL
278
+ ## Glossary
194
279
 
195
- We've [soft-deprecated](#soft-deprecation) `useThemeRTL` from our Labs package. Although you may
196
- still use this utility, we encourage consumers to use
197
- [CSS logical properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties).
280
+ ### Main
198
281
 
199
- ## Token Updates
282
+ Our Main package of Canvas Kit tokens, components, and utilities at `@workday/canvas-kit-react` has
283
+ undergone a full design and a11y review and is approved for use in product.
200
284
 
201
- ### Depth
285
+ Breaking changes to code in Main will only occur during major version updates and will always be
286
+ communicated in advance and accompanied by migration strategies.
202
287
 
203
- In v7, we released an update to our depth tokens that was too bold and harsh for web applications.
204
- We've modified the depth token styles to be more subtle and improve visual design. This change
205
- affects all components which use depth tokens including `Card`, `Toast`, `Dialog`, `Popup`, `Modal`,
206
- and `Menu`. We have not changed which depth values each component references (i.e., `Card` remains
207
- at `depth[1]`).
288
+ ---
289
+
290
+ ### Preview
291
+
292
+ Our Preview package of Canvas Kit tokens, components, and utilities at
293
+ `@workday/canvas-kit-preview-react` has undergone a full design and a11y review and is approved for
294
+ use in product, but may not be up to the high code standards upheld in the [Main](#main) package. Preview is
295
+ analagous to code in beta.
296
+
297
+ Breaking changes are unlikely, but possible, and can be deployed to Preview at any time without
298
+ triggering a major version update, though such changes will be communicated in advance and
299
+ accompanied by migration strategies.
300
+
301
+ Generally speaking, our goal is to eventually promote code from Preview to [Main](#main). Occasionally, a
302
+ component with the same name will exist in both [Main](#main) and Preview (for example, see Segmented Control
303
+ in [Preview](/components/buttons/segmented-control/) and
304
+ [Main](https://d2krrudi3mmzzw.cloudfront.net/v8/?path=/docs/components-buttons-segmented-control--basic)).
305
+ In these cases, Preview serves as a staging ground for an improved version of the component with a
306
+ different API. The component in [Main](#main) will eventually be replaced with the one in Preview.
307
+
308
+ ---
309
+
310
+ ### Labs
311
+
312
+ Our Labs package of Canvas Kit tokens, components, and utilities at `@workday/canvas-kit-labs-react`
313
+ has **not** undergone a full design and a11y review. Labs serves as an incubator space for new and
314
+ experimental code and is analagous to code in alpha.
315
+
316
+ Breaking changes can be deployed to Labs at any time without triggering a major version update and
317
+ may not be subject to the same rigor in communcation and migration strategies reserved for breaking
318
+ changes in [Preview](#preview) and [Main](#main).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-docs",
3
- "version": "9.0.0-alpha.382-next.2+5edca312",
3
+ "version": "9.0.0-alpha.384-next.3+e5b26417",
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,9 +44,9 @@
44
44
  "dependencies": {
45
45
  "@emotion/styled": "^11.6.0",
46
46
  "@storybook/csf": "0.0.1",
47
- "@workday/canvas-kit-labs-react": "^9.0.0-alpha.382-next.2+5edca312",
48
- "@workday/canvas-kit-preview-react": "^9.0.0-alpha.382-next.2+5edca312",
49
- "@workday/canvas-kit-react": "^9.0.0-alpha.382-next.2+5edca312",
47
+ "@workday/canvas-kit-labs-react": "^9.0.0-alpha.384-next.3+e5b26417",
48
+ "@workday/canvas-kit-preview-react": "^9.0.0-alpha.384-next.3+e5b26417",
49
+ "@workday/canvas-kit-react": "^9.0.0-alpha.384-next.3+e5b26417",
50
50
  "@workday/canvas-system-icons-web": "^3.0.0",
51
51
  "markdown-to-jsx": "^6.10.3",
52
52
  "ts-node": "^10.9.1"
@@ -57,5 +57,5 @@
57
57
  "mkdirp": "^1.0.3",
58
58
  "typescript": "4.2"
59
59
  },
60
- "gitHead": "5edca312f27bb6df43083e778e7c7eb06f34e655"
60
+ "gitHead": "e5b264177aabd434723720e16048673c3916b156"
61
61
  }