@workday/canvas-kit-mcp 15.0.0-alpha.0056-next.0 → 15.0.0-alpha.0064-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.
- package/README.md +6 -0
- package/dist/cli.js +272 -7
- package/dist/cli.js.map +2 -2
- package/dist/index.js +272 -7
- package/dist/index.js.map +2 -2
- package/dist/lib/{llm-txt/llm-style-props-migration.txt → llm-style-props-migration.txt} +1 -1
- package/dist/lib/theming.md +649 -0
- package/dist/lib/tokens/color-contrast.md +116 -0
- package/dist/lib/tokens/color-palette.md +141 -0
- package/dist/lib/tokens/color-roles.md +520 -0
- package/dist/lib/tokens/color-scale.md +277 -0
- package/dist/lib/tokens/color-tokens.md +130 -0
- package/dist/lib/tokens/token-migration.md +234 -0
- package/dist/lib/upgrade-guides/10.0-UPGRADE-GUIDE.md +346 -0
- package/dist/lib/upgrade-guides/11.0-UPGRADE-GUIDE.md +960 -0
- package/dist/lib/upgrade-guides/14.0-UPGRADE-GUIDE.md +1 -1
- package/dist/lib/upgrade-guides/9.0-UPGRADE-GUIDE.md +498 -0
- package/dist/types/lib/index.d.ts.map +1 -1
- package/package.json +2 -2
- /package/dist/lib/{llm-txt/llm-token-migration-14.txt → llm-token-migration-14.txt} +0 -0
|
@@ -80,7 +80,7 @@ input for LLMs to automate and assist with your migration process.
|
|
|
80
80
|
migration
|
|
81
81
|
|
|
82
82
|
<DownloadLLMFile
|
|
83
|
-
rawFileLink="https://raw.githubusercontent.com/Workday/canvas-kit/master/modules/docs/llm
|
|
83
|
+
rawFileLink="https://raw.githubusercontent.com/Workday/canvas-kit/master/modules/docs/llm/llm-canvas-kit-upgrade-guide-v14.txt"
|
|
84
84
|
filename="llm-canvas-kit-upgrade-guide-v14.txt"
|
|
85
85
|
/>
|
|
86
86
|
|
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
---
|
|
2
|
+
source_file: docs/mdx/9.0-UPGRADE-GUIDE.mdx
|
|
3
|
+
live_url: https://workday.github.io/canvas-kit/docs/mdx/9.0-UPGRADE-GUIDE
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<Meta title="Guides/Upgrade Guides/v9.0" />
|
|
7
|
+
|
|
8
|
+
# Canvas Kit 9.0 Upgrade Guide
|
|
9
|
+
|
|
10
|
+
This guide contains an overview of the changes in Canvas Kit v9. 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
|
+
- [Codemod](#codemod)
|
|
15
|
+
- [New Components](#new-components)
|
|
16
|
+
- [Table](#table)
|
|
17
|
+
- [Updated Terms](#updated-terms)
|
|
18
|
+
- [Removals](#removals)
|
|
19
|
+
- [Drawer](#drawer)
|
|
20
|
+
- [Layout and Column](#layout-and-column)
|
|
21
|
+
- [composeModelHooks](#composemodelhook)
|
|
22
|
+
- [Stack, HStack, and VStack](#stack-hstack-and-vstack)
|
|
23
|
+
- [focusRing](#focusring)
|
|
24
|
+
- [useCanvasTheme and getCanvasTheme](#usecanvastheme-and-getcanvastheme)
|
|
25
|
+
- [Deprecations](#deprecations)
|
|
26
|
+
- [useThemeRTL](#usethemertl)
|
|
27
|
+
- [Token Updates](#token-updates)
|
|
28
|
+
- [Depth](#depth)
|
|
29
|
+
- [Component Updates](#component-updates)
|
|
30
|
+
- [Button](#button)
|
|
31
|
+
- [Toast](#toast)
|
|
32
|
+
- [Collection](#collection)
|
|
33
|
+
- [Utility Updates](#utility-updates)
|
|
34
|
+
- [useTheme and getTheme](#usetheme-and-gettheme)
|
|
35
|
+
- [useThemedRing](#usethemedring)
|
|
36
|
+
- [composeHooks](#composehooks)
|
|
37
|
+
- [Glossary](#glossary)
|
|
38
|
+
- [Main](#main)
|
|
39
|
+
- [Preview](#preview)
|
|
40
|
+
- [Labs](#labs)
|
|
41
|
+
|
|
42
|
+
## Codemod
|
|
43
|
+
|
|
44
|
+
We've provided a [codemod](https://github.com/Workday/canvas-kit/tree/master/modules/codemod) to
|
|
45
|
+
automatically update your code to work with most of the breaking changes in v9. **Breaking changes
|
|
46
|
+
handled by the codemod are marked with 🤖 in the Upgrade Guide.**
|
|
47
|
+
|
|
48
|
+
A codemod is a script that makes programmatic transformations on your codebase by traversing the
|
|
49
|
+
[AST](https://www.hypermod.io/docs/guides/understanding-asts), identifying patterns, and making
|
|
50
|
+
prescribed changes. This greatly decreases opportunities for error and reduces the number of manual
|
|
51
|
+
updates, which allows you to focus on changes that need your attention. **We highly recommend you
|
|
52
|
+
use the codemod for these reasons.**
|
|
53
|
+
|
|
54
|
+
If you're new to running codemods or if it's been a minute since you've used one, there are a few
|
|
55
|
+
things you'll want to keep in mind.
|
|
56
|
+
|
|
57
|
+
- Our codemods are meant to be run sequentially. For example, if you're using v7 of Canvas Kit,
|
|
58
|
+
you'll need to run the v8 codemod before you run v9.
|
|
59
|
+
- The codemod will update your code to be compatible with the specified version, but it will **not**
|
|
60
|
+
remove outdated dependencies or upgrade dependencies to the latest version. You'll need to upgrade
|
|
61
|
+
dependencies on your own.
|
|
62
|
+
- We recommend upgrading dependencies before running the codemod.
|
|
63
|
+
- Always review your `package.json` files to make sure your dependency versions look correct.
|
|
64
|
+
- The codemod will not handle every breaking change in v9. You will likely need to make some manual
|
|
65
|
+
changes to be compatible. Use our Upgrade Guide as a checklist.
|
|
66
|
+
- Codemods are not bulletproof.
|
|
67
|
+
- Conduct a thorough PR and QA review of all changes to ensure no regressions were introduced.
|
|
68
|
+
- As a safety precaution, we recommend committing the changes from the codemod as a single
|
|
69
|
+
isolated commit (separate from other changes) so you can roll back more easily if necessary.
|
|
70
|
+
|
|
71
|
+
We're here to help! Automatic changes to your codebase can feel scary. You can always reach out to
|
|
72
|
+
our team. We'd be very happy to walk you through the process to set you up for success.
|
|
73
|
+
|
|
74
|
+
### Instructions
|
|
75
|
+
|
|
76
|
+
The easiest way to run our codemod is to use `npx`.
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
> npx @workday/canvas-kit-codemod v9 [path]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Be sure to provide specific directories that need to be updated via the `[path]` argument. This
|
|
83
|
+
decreases the amount of AST the codemod needs to traverse and reduces the chances of the script
|
|
84
|
+
having an error. For example, if your source code lives in `src/`, use `src/` as your `[path]`. Or,
|
|
85
|
+
if you have a monorepo with three packages using Canvas Kit, provide those specific packages as your
|
|
86
|
+
`[path]`.
|
|
87
|
+
|
|
88
|
+
Alternatively, if you're unable to run the codemod successfully using `npx`, you can install the
|
|
89
|
+
codemod package as a dev dependency, run it with `yarn`, and then remove the package after you're
|
|
90
|
+
finished.
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
> yarn add @workday/canvas-kit-codemod --dev
|
|
94
|
+
> yarn canvas-kit-codemod v9 [path]
|
|
95
|
+
> yarn remove @workday/canvas-kit-codemod
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
> The codemod only works on `.js`, `.jsx`, `.ts`, and `.tsx` files. You'll need to manually edit
|
|
99
|
+
> other file types (`.json`, `.mdx`, `.md`, etc.). You may need to run your linter after executing
|
|
100
|
+
> the codemod, as its resulting formatting (spacing, quotes, etc.) may not match your project
|
|
101
|
+
> conventions.
|
|
102
|
+
|
|
103
|
+
## New Components
|
|
104
|
+
|
|
105
|
+
### Table
|
|
106
|
+
|
|
107
|
+
We've introduced a new `Table`
|
|
108
|
+
[compound component](/getting-started/for-developers/resources/compound-components/) to the Preview
|
|
109
|
+
package. `Table` is a compound component that is used to present information in a two-dimensional
|
|
110
|
+
[table](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table) comprised of rows and
|
|
111
|
+
columns of cells containing data.
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
export default function App() {
|
|
115
|
+
return (
|
|
116
|
+
<Table>
|
|
117
|
+
<Table.Caption>Table Caption</Table.Caption>
|
|
118
|
+
<Table.Head>
|
|
119
|
+
<Table.Row>
|
|
120
|
+
<Table.Header>Table Header</Table.Header>
|
|
121
|
+
<Table.Header>Table Header</Table.Header>
|
|
122
|
+
</Table.Row>
|
|
123
|
+
</Table.Head>
|
|
124
|
+
<Table.Body>
|
|
125
|
+
<Table.Row>
|
|
126
|
+
<Table.Header>Table Header</Table.Header>
|
|
127
|
+
<Table.Header>Table Header</Table.Header>
|
|
128
|
+
</Table.Row>
|
|
129
|
+
<Table.Row>
|
|
130
|
+
<Table.Header>Table Header</Table.Header>
|
|
131
|
+
<Table.Cell>Table Data Cell</Table.Cell>
|
|
132
|
+
</Table.Row>
|
|
133
|
+
<Table.Row>
|
|
134
|
+
<Table.Header>Table Header</Table.Header>
|
|
135
|
+
<Table.Cell>Table Data Cell</Table.Cell>
|
|
136
|
+
</Table.Row>
|
|
137
|
+
</Table.Body>
|
|
138
|
+
<Table.Footer>
|
|
139
|
+
<Table.Row>
|
|
140
|
+
<Table.Header>Table Header</Table.Header>
|
|
141
|
+
<Table.Cell>Table Data Cell</Table.Cell>
|
|
142
|
+
</Table.Row>
|
|
143
|
+
</Table.Footer>
|
|
144
|
+
</Table>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Updated Terms
|
|
150
|
+
|
|
151
|
+
We have updated two terms that were used in previous versions of Canvas Kit to better reflect their
|
|
152
|
+
meaning and intentions.
|
|
153
|
+
|
|
154
|
+
- **"Soft-Deprecation"** is now **"Deprecate/Deprecation"**
|
|
155
|
+
|
|
156
|
+
- _Deprecate/Deprecation: We add the [@deprecated tag](https://jsdoc.app/tags-deprecated.html)
|
|
157
|
+
from JSDoc to code that we plan to deprecate in the near future. Although you can still consume
|
|
158
|
+
this code, we want consumers to move to a utility or component that is more stable._
|
|
159
|
+
- _Previously, we also added "Deprecated" to a component name. For example, from `ComponentName`
|
|
160
|
+
to `DeprecatedComponenntName`. As of 9.0, we longer do this._
|
|
161
|
+
|
|
162
|
+
- **"Hard-Deprecation"** is now **"Remove/Removal"**
|
|
163
|
+
|
|
164
|
+
- _Remove/Removals: Removals are deletions from our codebase and you can no longer consume this
|
|
165
|
+
component. We've either promoted or replaced a component or utility. You will need to follow the
|
|
166
|
+
method prescribed in our upgrade guide to update your application. Please reach out to our team
|
|
167
|
+
directly if you need additional help._
|
|
168
|
+
|
|
169
|
+
## Removals
|
|
170
|
+
|
|
171
|
+
Removals are deletions from our codebase and you can no longer consume this component. We've either
|
|
172
|
+
promoted or replaced a component or utility.
|
|
173
|
+
|
|
174
|
+
### Drawer
|
|
175
|
+
|
|
176
|
+
**PR:** [#1970](https://github.com/Workday/canvas-kit/pull/1970)
|
|
177
|
+
|
|
178
|
+
We've removed the `Drawer` component (for reference, see the
|
|
179
|
+
[`Drawer`](https://d2krrudi3mmzzw.cloudfront.net/v8/?path=/docs/labs-drawer--basic) from v8). Please
|
|
180
|
+
use the [`SidePanel`](/components/containers/side-panel/) in [Preview](#preview) instead.
|
|
181
|
+
|
|
182
|
+
> **Note:** The `SidePanel` in Main will eventually be replaced with the `SidePanel` in Preview. We
|
|
183
|
+
> recommend you use the `SidePanel` in Preview until then.
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
### Layout and Column
|
|
188
|
+
|
|
189
|
+
**PR:** [#2018](https://github.com/Workday/canvas-kit/pull/2018)
|
|
190
|
+
|
|
191
|
+
We've removed the `Layout` and `Column` components (for reference, see
|
|
192
|
+
[`Column and Layout`](https://d2krrudi3mmzzw.cloudfront.net/v8/?path=/docs/components-containers-column-and-layout--12-column-layout)
|
|
193
|
+
from v8). Please use [`Grid`](/components/layout/grid/) instead. While `Grid` is not a 1:1
|
|
194
|
+
replacement for `Layout` and `Column`, it can be used to generate the same types of layouts and
|
|
195
|
+
offers a more robust and flexible layout solution.
|
|
196
|
+
|
|
197
|
+
Please refer to our [Layout examples](/examples/layout/) for examples of how to implement common
|
|
198
|
+
layouts using `Grid`.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
### composeModelHooks
|
|
203
|
+
|
|
204
|
+
**PR:** [#2180](https://github.com/Workday/canvas-kit/pull/2180)
|
|
205
|
+
|
|
206
|
+
We're removing this hook. It is a duplicate of `componseHooks` that was never used by anything. This
|
|
207
|
+
should have no impact on your code. We couldn't find any references to this function in any code
|
|
208
|
+
bases we have access to.
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
### Stack, HStack and VStack
|
|
213
|
+
|
|
214
|
+
**PR:** [#2012](https://github.com/Workday/canvas-kit/pull/2012)
|
|
215
|
+
|
|
216
|
+
We've removed the `Stack`, `HStack`, and `VStack` components (for reference, see
|
|
217
|
+
[`Stack`](https://d2krrudi3mmzzw.cloudfront.net/v8/?path=/docs/components-layout-stack--basic-stack)
|
|
218
|
+
from v8). Please use [`Flex`](/components/layout/flex/) instead. `Flex` supports the same consistent
|
|
219
|
+
spacing between its elements via the `gap` prop (analogous to the `spacing` prop from `Stack`).
|
|
220
|
+
|
|
221
|
+
```tsx
|
|
222
|
+
// v8
|
|
223
|
+
<Stack spacing="s">
|
|
224
|
+
...
|
|
225
|
+
</Stack>
|
|
226
|
+
|
|
227
|
+
// v9
|
|
228
|
+
<Flex gap="s">
|
|
229
|
+
...
|
|
230
|
+
</Flex>
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
The orientation of `VStack` elements can be replicated with `Flex` using `flexDirection`.
|
|
234
|
+
|
|
235
|
+
```tsx
|
|
236
|
+
// v8
|
|
237
|
+
<VStack>
|
|
238
|
+
...
|
|
239
|
+
</VStack>
|
|
240
|
+
|
|
241
|
+
// v9
|
|
242
|
+
<Flex flexDirection="column">
|
|
243
|
+
...
|
|
244
|
+
</Flex>
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
The `StackProps`, `HStackProps`, `VStackProps`, and `StackStyleProps` types have been removed as
|
|
248
|
+
well. All references to these types in your custom components will need to be replaced with
|
|
249
|
+
`FlexProps`.
|
|
250
|
+
|
|
251
|
+
🤖 The codemod will handle all of the changes above for you automatically.
|
|
252
|
+
|
|
253
|
+
> **Note:** If you were consuming `StackProps` previously for a custom component, be sure to change
|
|
254
|
+
> all references to the old `spacing` prop from `StackProps` to the `gap` prop from `FlexProps`.
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
### focusRing
|
|
259
|
+
|
|
260
|
+
**PR:** [#2034](https://github.com/Workday/canvas-kit/pull/2034)
|
|
261
|
+
|
|
262
|
+
We've removed memoization from `focusRing`. The `memoize` argument passed to `focusRing` is no
|
|
263
|
+
longer valid, and we've removed `memoizedFocusRing`. We were unable to find any examples of
|
|
264
|
+
`memoize` or `memoizedFocusRing` in use by our consumers.
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
### useCanvasTheme and getCanvasTheme
|
|
269
|
+
|
|
270
|
+
**PR:** [#2120](https://github.com/Workday/canvas-kit/pull/2120)
|
|
271
|
+
|
|
272
|
+
We've removed `useCanvasTheme` and `getCanvasTheme`. Please use `useTheme` and `getTheme` instead.
|
|
273
|
+
|
|
274
|
+
## Deprecations
|
|
275
|
+
|
|
276
|
+
We add the [@deprecated](https://jsdoc.app/tags-deprecated.html) from JSDoc to code that we plan to
|
|
277
|
+
deprecate in the near future. Al though you can still consume this code, we want consumers to move
|
|
278
|
+
to a utility or component that is more stable.
|
|
279
|
+
|
|
280
|
+
### useThemeRTL
|
|
281
|
+
|
|
282
|
+
**PR:** [#2119](https://github.com/Workday/canvas-kit/pull/2119)
|
|
283
|
+
|
|
284
|
+
We've deprecated `useThemeRTL` from [Labs](#labs). Although you may still use this utility, we
|
|
285
|
+
recommend using
|
|
286
|
+
[CSS logical properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties)
|
|
287
|
+
instead.
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
### composeHooks
|
|
292
|
+
|
|
293
|
+
The `composeHooks` types are now accurate. Before the types were incorrectly merged to equal `{}`.
|
|
294
|
+
This also affects components created using `createContainer` or `createSubcomponent`. The
|
|
295
|
+
`elemProps` type interface will now reflect all the incoming props from the hook properly. If you
|
|
296
|
+
get an error when passing `elemProps` from a hook using `composeHooks`, you may get a Typescript
|
|
297
|
+
error. Sometimes returning a generic object widens types and style or JSX attributes are more
|
|
298
|
+
strict. This can cause problems with JSX attributes like `position` which expects values like
|
|
299
|
+
`'relative' | 'absolute'` and doesn't accept a string.
|
|
300
|
+
|
|
301
|
+
For example:
|
|
302
|
+
|
|
303
|
+
```ts
|
|
304
|
+
return {
|
|
305
|
+
position: 'relative',
|
|
306
|
+
}; // { 'position': string }
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
TypeScript doesn't know that this object interface cannot be mutated, so it will widen the
|
|
310
|
+
`position` type to a `string` which is now allowed when you pass the prop list to a JSX element.
|
|
311
|
+
You'll have to add an `as const` to either the property or the whole object to force Typescript to
|
|
312
|
+
narrow the type.
|
|
313
|
+
|
|
314
|
+
```ts
|
|
315
|
+
return {
|
|
316
|
+
position: 'relative' as const, // forces the type to be `'relative'` instead of `string`
|
|
317
|
+
} as const; // OR add `as const` here to narrow the whole object.
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
`as const` instructs Typescript the type is `readonly`. Typescript knows readonly values or objects
|
|
321
|
+
cannot be changed and will therefore narrow the type for you.
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Token Updates
|
|
326
|
+
|
|
327
|
+
### Depth
|
|
328
|
+
|
|
329
|
+
**PR:** [#2091](https://github.com/Workday/canvas-kit/pull/2091)
|
|
330
|
+
|
|
331
|
+
In v7, we released an update to our depth tokens that was too bold and harsh for web applications.
|
|
332
|
+
We've modified the depth token styles to be more subtle and improve visual design. This change
|
|
333
|
+
affects all components which use depth tokens including `Card`, `Toast`, `Dialog`, `Popup`, `Modal`,
|
|
334
|
+
and `Menu`. We have not changed which depth values each component references (i.e., `Card` remains
|
|
335
|
+
at `depth[1]`).
|
|
336
|
+
|
|
337
|
+
## Component Updates
|
|
338
|
+
|
|
339
|
+
### Button
|
|
340
|
+
|
|
341
|
+
**PR:** [#1978](https://github.com/Workday/canvas-kit/pull/1978)
|
|
342
|
+
|
|
343
|
+
We've changed the default `type` attribute for all buttons to `type="button"`. Previously, the
|
|
344
|
+
`type` attribute was not being set which resulted in the buttons
|
|
345
|
+
[defaulting to `type="submit"`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes).
|
|
346
|
+
|
|
347
|
+
This affects all buttons which extend `BaseButton`:
|
|
348
|
+
|
|
349
|
+
- `PrimaryButton`
|
|
350
|
+
- `SecondaryButton`
|
|
351
|
+
- `TertiaryButton`
|
|
352
|
+
- `DeleteButton`
|
|
353
|
+
- `ToolbarDropdownButton` and `ToolbarIconButton`
|
|
354
|
+
- `Pill` and `Pill.IconButton`
|
|
355
|
+
- `SegmentedControl.Button` (Main)
|
|
356
|
+
- `SegmentedControl.Item` (Preview)
|
|
357
|
+
- `Pagination.PageButton`
|
|
358
|
+
|
|
359
|
+
Any buttons which extend any of the above are affected as well.
|
|
360
|
+
|
|
361
|
+
This resolves an [issue](https://github.com/Workday/canvas-kit/issues/1938) where clicking certain
|
|
362
|
+
buttons within a `form` element would unexpectedly submit the form. Additionally, the default action
|
|
363
|
+
of many form controls such as `input` and `textarea` is to click the first submit button; this led
|
|
364
|
+
to issues if the first submit button in the form was not intended to be a submit button (a common
|
|
365
|
+
mistake when buttons default to `type="submit"`).
|
|
366
|
+
|
|
367
|
+
This is a breaking change if you expected a button to submit by default, though we do not anticipate
|
|
368
|
+
this to be the case for most developers. If you _do_ intend for a button to act as a submit button
|
|
369
|
+
within a form, add `type="submit"` to the button.
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
### Toast
|
|
374
|
+
|
|
375
|
+
**PR:** [#2044](https://github.com/Workday/canvas-kit/pull/2044)
|
|
376
|
+
|
|
377
|
+
We've promoted `Toast` from [Labs](#labs) to [Main](#main). It replaces the `Toast` that was
|
|
378
|
+
previously in [Main](#main) (for reference, see
|
|
379
|
+
[`Toast`](https://d2krrudi3mmzzw.cloudfront.net/v8/?path=/docs/components-popups-toast--error) in
|
|
380
|
+
[Main](#main) from v8).
|
|
381
|
+
|
|
382
|
+
`Toast` is a [compound component](/getting-started/for-developers/resources/compound-components/)
|
|
383
|
+
which provides a flexible API and access to its internals via its subcomponents. It supports a new
|
|
384
|
+
`mode` prop which applies the proper accessibility features to the component based on the desired
|
|
385
|
+
mode: `status`, `alert`, or `dialog`.
|
|
386
|
+
|
|
387
|
+
```tsx
|
|
388
|
+
// v8
|
|
389
|
+
<Toast actionText="View more details" onActionClick={handleActionClick} onClose={handleClose}>
|
|
390
|
+
Your workbook was successfully processed.
|
|
391
|
+
</Toast>
|
|
392
|
+
|
|
393
|
+
// v9
|
|
394
|
+
<Toast mode="dialog">
|
|
395
|
+
<Toast.Icon icon={checkIcon} color={colors.greenApple400} />
|
|
396
|
+
<Toast.Body>
|
|
397
|
+
<Toast.Message>Your workbook was successfully processed.</Toast.Message>
|
|
398
|
+
<Toast.Link onClick={handleActionClick}>View more details</Toast.Link>
|
|
399
|
+
</Toast.Body>
|
|
400
|
+
<Toast.CloseIcon aria-label="Close" onClick={handleClose} />
|
|
401
|
+
</Toast>
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
🤖 The codemod will rewrite your usages of the previous `Toast` in [Main](#main) to use the compound
|
|
405
|
+
component API of the new `Toast` in [Main](#main). `mode` will be set to `dialog` if the `Toast`
|
|
406
|
+
previously used `actionText` or `onActionClick`. The codemod will also update imports from the
|
|
407
|
+
[Labs](#labs) `Toast` to instead import from [Main](#main).
|
|
408
|
+
|
|
409
|
+
> **Note:** You will manually need to set `mode` to `alert` if your `Toast` conveys urgent and
|
|
410
|
+
> important information such as an error.
|
|
411
|
+
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
### Collection
|
|
415
|
+
|
|
416
|
+
Navigation was updated to use numerical indexes instead of string identifiers. The
|
|
417
|
+
`model.state.cursorId` is left unchanged. The change is to support virtual lists where navigation
|
|
418
|
+
knows where it needs to go, but the identifier may not be loaded yet. The mechanism for navigating
|
|
419
|
+
is private and should not breaking anything. If you created a custom navigation manager, the
|
|
420
|
+
signature has been changed.
|
|
421
|
+
|
|
422
|
+
The `useListModel` modelHook no longers sets the initial `cursorId` to the first item if no
|
|
423
|
+
`initialCursorId` config option is set. This functionality has been moved to the
|
|
424
|
+
`useListItemRovingFocus` elemProps hook. If you use `useListItemRovingFocus`, the behavior is
|
|
425
|
+
unchanged. If you need the first item to be set as the `cursorId` and you do not use
|
|
426
|
+
`useListItemRovingFocus`, you will have to add this functionality back to your collection logic.
|
|
427
|
+
|
|
428
|
+
The logic to set the `cursorId` to the first item should go into an item elemProps hook that
|
|
429
|
+
contains the following:
|
|
430
|
+
|
|
431
|
+
```ts
|
|
432
|
+
React.useEffect(() => {
|
|
433
|
+
if (!model.state.cursorId && model.state.items.length) {
|
|
434
|
+
model.events.goTo({id: model.state.items[0].id});
|
|
435
|
+
}
|
|
436
|
+
}, [model.state.cursorId, model.state.items, model.events]);
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
## Utility Updates
|
|
440
|
+
|
|
441
|
+
### useTheme and getTheme
|
|
442
|
+
|
|
443
|
+
**PR:** [#2120](https://github.com/Workday/canvas-kit/pull/2120)
|
|
444
|
+
|
|
445
|
+
We've added error handling to `useTheme` if it's been used outside a functional component. We've
|
|
446
|
+
also added `getTheme` to provide access to a theme from `styled` or class components instead of
|
|
447
|
+
`useTheme`.
|
|
448
|
+
|
|
449
|
+
### useThemedRing
|
|
450
|
+
|
|
451
|
+
**PR:** [#2119](https://github.com/Workday/canvas-kit/pull/2119)
|
|
452
|
+
|
|
453
|
+
We've promoted `useThemedRing` from [Labs](#labs) to [Main](#main). `useThemedRing` allows you to
|
|
454
|
+
theme focus rings.
|
|
455
|
+
|
|
456
|
+
🤖 The codemod will update the import for this utility.
|
|
457
|
+
|
|
458
|
+
## Glossary
|
|
459
|
+
|
|
460
|
+
### Main
|
|
461
|
+
|
|
462
|
+
Our Main package of Canvas Kit tokens, components, and utilities at `@workday/canvas-kit-react` has
|
|
463
|
+
undergone a full design and a11y review and is approved for use in product.
|
|
464
|
+
|
|
465
|
+
Breaking changes to code in Main will only occur during major version updates and will always be
|
|
466
|
+
communicated in advance and accompanied by migration strategies.
|
|
467
|
+
|
|
468
|
+
---
|
|
469
|
+
|
|
470
|
+
### Preview
|
|
471
|
+
|
|
472
|
+
Our Preview package of Canvas Kit tokens, components, and utilities at
|
|
473
|
+
`@workday/canvas-kit-preview-react` has undergone a full design and a11y review and is approved for
|
|
474
|
+
use in product, but may not be up to the high code standards upheld in the [Main](#main) package.
|
|
475
|
+
Preview is analagous to code in beta.
|
|
476
|
+
|
|
477
|
+
Breaking changes are unlikely, but possible, and can be deployed to Preview at any time without
|
|
478
|
+
triggering a major version update, though such changes will be communicated in advance and
|
|
479
|
+
accompanied by migration strategies.
|
|
480
|
+
|
|
481
|
+
Generally speaking, our goal is to eventually promote code from Preview to [Main](#main).
|
|
482
|
+
Occasionally, a component with the same name will exist in both [Main](#main) and Preview (for
|
|
483
|
+
example, see Segmented Control in [Preview](/components/buttons/segmented-control/) and
|
|
484
|
+
[Main](https://d2krrudi3mmzzw.cloudfront.net/v8/?path=/docs/components-buttons-segmented-control--basic)).
|
|
485
|
+
In these cases, Preview serves as a staging ground for an improved version of the component with a
|
|
486
|
+
different API. The component in [Main](#main) will eventually be replaced with the one in Preview.
|
|
487
|
+
|
|
488
|
+
---
|
|
489
|
+
|
|
490
|
+
### Labs
|
|
491
|
+
|
|
492
|
+
Our Labs package of Canvas Kit tokens, components, and utilities at `@workday/canvas-kit-labs-react`
|
|
493
|
+
has **not** undergone a full design and a11y review. Labs serves as an incubator space for new and
|
|
494
|
+
experimental code and is analagous to code in alpha.
|
|
495
|
+
|
|
496
|
+
Breaking changes can be deployed to Labs at any time without triggering a major version update and
|
|
497
|
+
may not be subject to the same rigor in communcation and migration strategies reserved for breaking
|
|
498
|
+
changes in [Preview](#preview) and [Main](#main).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,SAAS,EAAC,MAAM,yCAAyC,CAAC;AAKlE,wBAAgB,SAAS,cA+
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,SAAS,EAAC,MAAM,yCAAyC,CAAC;AAKlE,wBAAgB,SAAS,cA+ZxB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-mcp",
|
|
3
|
-
"version": "15.0.0-alpha.
|
|
3
|
+
"version": "15.0.0-alpha.0064-next.0",
|
|
4
4
|
"description": "MCP package for Canvas Kit",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"tsx": "^4.7.0",
|
|
54
54
|
"typescript": "5.0"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "74d356998c8a3fe27e6a54ef1db7128320b4b2ed"
|
|
57
57
|
}
|
|
File without changes
|