@workday/canvas-kit-mcp 13.2.41 → 14.1.4
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/dist/cli.js +39 -2
- package/dist/cli.js.map +2 -2
- package/dist/index.js +39 -2
- package/dist/index.js.map +2 -2
- package/dist/lib/llm-txt/llm-style-props-migration.txt +2346 -0
- package/dist/lib/llm-txt/llm-token-migration-14.txt +826 -0
- package/dist/lib/upgrade-guides/14.0-UPGRADE-GUIDE.md +1095 -0
- package/dist/types/lib/index.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,1095 @@
|
|
|
1
|
+
# Canvas Kit 14.0 Upgrade Guide
|
|
2
|
+
|
|
3
|
+
This guide contains an overview of the changes in Canvas Kit v14. Please
|
|
4
|
+
[reach out](https://github.com/Workday/canvas-kit/issues/new?labels=bug&template=bug.md) if you have
|
|
5
|
+
any questions.
|
|
6
|
+
|
|
7
|
+
## Why You Should Upgrade
|
|
8
|
+
|
|
9
|
+
v14.0 Introduces Workday's new brand direction which includes a new color palette and with it, some
|
|
10
|
+
styling updates to our components.
|
|
11
|
+
|
|
12
|
+
**Please consult our
|
|
13
|
+
[v14 Visual Changes](/help/upgrade-guides/canvas-v14-upgrade-guide/#tab=visual-changes) page for a
|
|
14
|
+
visual reference of what's changed.**
|
|
15
|
+
|
|
16
|
+
> **Note:** While v14 does not require an upgrade to our v3 tokens, we strongly advise to upgrade to
|
|
17
|
+
> the latest to ensure proper branding.
|
|
18
|
+
|
|
19
|
+
## Table of Contents
|
|
20
|
+
|
|
21
|
+
- [LLM Assisted Migration](#llm-assisted-migration)
|
|
22
|
+
- [Codemod](#codemod)
|
|
23
|
+
- [Instructions](#instructions)
|
|
24
|
+
- [Tokens](#tokens)
|
|
25
|
+
- [Caution Naming](#caution-naming)
|
|
26
|
+
- [Theming](#theming)
|
|
27
|
+
- [New Documentation](#new-documentation)
|
|
28
|
+
- [Canvas Provider](#canvas-provider-)
|
|
29
|
+
- [Component Updates](#component-updates)
|
|
30
|
+
- [Avatar (Preview)](#avatar-preview)
|
|
31
|
+
- [Branding Changes](#branding-changes-)
|
|
32
|
+
- [Buttons](#buttons)
|
|
33
|
+
- [Card](#card-)
|
|
34
|
+
- [Count Badge](#count-badge)
|
|
35
|
+
- [Expandable](#expandable)
|
|
36
|
+
- [Hyperlink and External Hyperlink](#hyperlink-and-external-hyperlink)
|
|
37
|
+
- [Loading Dots](#loading-dots)
|
|
38
|
+
- [Pill (Preview)](#pill-preview)
|
|
39
|
+
- [Search Form (Labs)](#search-form-labs-)
|
|
40
|
+
- [Status Indicator (Preview)](#status-indicator-preview-)
|
|
41
|
+
- [Icons](#icons)
|
|
42
|
+
- [Deprecations](#deprecations)
|
|
43
|
+
- [Avatar (Main)](#avatar-in-main)
|
|
44
|
+
- [Combobox (Labs)](#combobox-labs)
|
|
45
|
+
- [Radio (Main)](#radio-main)
|
|
46
|
+
- [Search Form (Labs)](#searchform-labs)
|
|
47
|
+
- [Segmented Control (Main)](#segmented-control-main)
|
|
48
|
+
- [Side Panel (Main)](#side-panel-main)
|
|
49
|
+
- [Tokens](#tokens)
|
|
50
|
+
- [useIsRTL](#useisrtl)
|
|
51
|
+
- [Removals](#removals)
|
|
52
|
+
- [Deprecated Buttons](#deprecated-buttons)
|
|
53
|
+
- [Input Provider](#input-provider)
|
|
54
|
+
- [Menu (Preview)](#menu-preview)
|
|
55
|
+
- [readOnlyPillStencil and removeablePillStencil](#readonlypillstencil-and-removeablepillstencil)
|
|
56
|
+
- [Text Area (Preview)](#text-area)
|
|
57
|
+
- [Text Input (Preview)](#text-input)
|
|
58
|
+
- [Troubleshooting](#troubleshooting)
|
|
59
|
+
- [Glossary](#glossary)
|
|
60
|
+
- [Main](#main)
|
|
61
|
+
- [Preview](#preview)
|
|
62
|
+
- [Labs](#labs)
|
|
63
|
+
|
|
64
|
+
## LLM Assisted Migration <StorybookStatusIndicator type="ai" />
|
|
65
|
+
|
|
66
|
+
We've provided an **LLM migration mapping file** (`llm-canvas-kit-upgrade-guide-v14.txt`)
|
|
67
|
+
specifically designed for use with LLM-based code assistants such as
|
|
68
|
+
[Cursor](https://www.cursor.so/). It contains a compiled LLM consumption version of this v14 Upgrade
|
|
69
|
+
Guide. It is not intended for direct human reference or team documentation, but rather as structured
|
|
70
|
+
input for LLMs to automate and assist with your migration process.
|
|
71
|
+
|
|
72
|
+
> **Important:** LLMs can make mistakes. Please verify changes using this Upgrade Guide.
|
|
73
|
+
|
|
74
|
+
**How to use:**
|
|
75
|
+
|
|
76
|
+
- **View raw file**: Open the file in a new tab to see the complete migration mapping
|
|
77
|
+
- **Download LLM File**: Save the file locally to upload or paste into your LLM/code assistant
|
|
78
|
+
- **Use with LLM**: Provide the raw content to your LLM/code assistant as context for automated
|
|
79
|
+
migration
|
|
80
|
+
|
|
81
|
+
<DownloadLLMFile
|
|
82
|
+
rawFileLink="https://raw.githubusercontent.com/Workday/canvas-kit/master/modules/docs/llm-txt/llm-canvas-kit-upgrade-guide-v14.txt"
|
|
83
|
+
filename="llm-canvas-kit-upgrade-guide-v14.txt"
|
|
84
|
+
/>
|
|
85
|
+
|
|
86
|
+
## Codemod
|
|
87
|
+
|
|
88
|
+
We've provided a [codemod](https://github.com/Workday/canvas-kit/tree/master/modules/codemod) to
|
|
89
|
+
automatically update your code to work with most of the breaking changes in v14. **Breaking changes
|
|
90
|
+
handled by the codemod are marked with 🤖 in the Upgrade Guide.**
|
|
91
|
+
|
|
92
|
+
A codemod is a script that makes programmatic transformations on your codebase by traversing the
|
|
93
|
+
AST, identifying patterns, and making prescribed changes. This greatly decreases opportunities for
|
|
94
|
+
error and reduces the number of manual updates, which allows you to focus on changes that need your
|
|
95
|
+
attention. **We highly recommend you use the codemod for these reasons.**
|
|
96
|
+
|
|
97
|
+
If you're new to running codemods or if it's been a minute since you've used one, there are a few
|
|
98
|
+
things you'll want to keep in mind.
|
|
99
|
+
|
|
100
|
+
- Our codemods are meant to be run sequentially. For example, if you're using v12 of Canvas Kit,
|
|
101
|
+
you'll need to run the v13 codemod before you run v14.
|
|
102
|
+
- The codemod will update your code to be compatible with the specified version, but it will **not**
|
|
103
|
+
remove outdated dependencies or upgrade dependencies to the latest version. You'll need to upgrade
|
|
104
|
+
dependencies on your own.
|
|
105
|
+
- We recommend upgrading dependencies before running the codemod.
|
|
106
|
+
- Always review your `package.json` files to make sure your dependency versions look correct.
|
|
107
|
+
- The codemod will not handle every breaking change in v14. You will likely need to make some manual
|
|
108
|
+
changes to be compatible. Use our Upgrade Guide as a checklist.
|
|
109
|
+
- Codemods are not bulletproof.
|
|
110
|
+
- Conduct a thorough PR and QA review of all changes to ensure no regressions were introduced.
|
|
111
|
+
- As a safety precaution, we recommend committing the changes from the codemod as a single
|
|
112
|
+
isolated commit (separate from other changes) so you can roll back more easily if necessary.
|
|
113
|
+
|
|
114
|
+
We're here to help! Automatic changes to your codebase can feel scary. You can always reach out to
|
|
115
|
+
our team. We'd be very happy to walk you through the process to set you up for success.
|
|
116
|
+
|
|
117
|
+
### Instructions
|
|
118
|
+
|
|
119
|
+
The easiest way to run our codemod is to use `npx` in your terminal.```sh npx
|
|
120
|
+
@workday/canvas-kit-codemod v14 [path]
|
|
121
|
+
|
|
122
|
+
````
|
|
123
|
+
|
|
124
|
+
Be sure to provide specific directories that need to be updated via the `[path]` argument. This
|
|
125
|
+
decreases the amount of AST the codemod needs to traverse and reduces the chances of the script
|
|
126
|
+
having an error. For example, if your source code lives in `src/`, use `src/` as your `[path]`. Or,
|
|
127
|
+
if you have a monorepo with three packages using Canvas Kit, provide those specific packages as your
|
|
128
|
+
`[path]`.
|
|
129
|
+
|
|
130
|
+
Alternatively, if you're unable to run the codemod successfully using `npx`, you can install the
|
|
131
|
+
codemod package as a dev dependency, run it with `yarn`, and then remove the package after you're
|
|
132
|
+
finished.
|
|
133
|
+
|
|
134
|
+
```sh
|
|
135
|
+
yarn add @workday/canvas-kit-codemod --dev
|
|
136
|
+
yarn canvas-kit-codemod v14 [path]
|
|
137
|
+
yarn remove @workday/canvas-kit-codemod
|
|
138
|
+
````
|
|
139
|
+
|
|
140
|
+
> **Note:** The codemod only works on `.js`, `.jsx`, `.ts`, and `.tsx` files. You'll need to
|
|
141
|
+
> manually edit other file types (`.json`, `.mdx`, `.md`, etc.). You may need to run your linter
|
|
142
|
+
> after executing the codemod, as its resulting formatting (spacing, quotes, etc.) may not match
|
|
143
|
+
> your project conventions.
|
|
144
|
+
|
|
145
|
+
## Tokens
|
|
146
|
+
|
|
147
|
+
Canvas Kit v14 uses `@workday/canvas-tokens-web` v3, which introduces new color palettes and
|
|
148
|
+
deprecates the old "fruity" color names. For example, `red` replaces `cinnamon`, `blue` replaces
|
|
149
|
+
`blueberry`, and `green` replaces `greenApple`. We strongly recommend upgrading to
|
|
150
|
+
`@workday/canvas-tokens-web` v3, as using older versions will not match the new brand guidelines or
|
|
151
|
+
color system. Although this dependency upgrade is not required, we've offered migration guides and
|
|
152
|
+
codemods separately from the v14 upgrade so teams can upgrade when they can.
|
|
153
|
+
|
|
154
|
+
For more information and changes, please view our
|
|
155
|
+
[Tokens v3 Upgrade Guide](https://workday.github.io/canvas-tokens/?path=/guides-upgrade-guides-v3-overview--docs).
|
|
156
|
+
|
|
157
|
+
> **Note:** v3 Tokens are backwards compatible with older versions of Canvas Kit.
|
|
158
|
+
|
|
159
|
+
Follow these guides to migrate:
|
|
160
|
+
|
|
161
|
+
- If you're still using our old tokens from `@workday/canvas-kit-react/tokens`, migrate to
|
|
162
|
+
`@workday/canvas-tokens-web` v3 using our
|
|
163
|
+
[Canvas Kit Token Migration Guide](https://workday.github.io/canvas-kit/?path=/docs/guides-tokens-migration-overview--docs).
|
|
164
|
+
- Otherwise, use our
|
|
165
|
+
[v2 to v3 Migration Guide](https://workday.github.io/canvas-tokens/?path=/docs/guides-upgrade-guides-v3-overview--docs).
|
|
166
|
+
|
|
167
|
+
> 🤖 The `v14-tokens` codemod will automatically migrate your tokens, whether you're upgrading from
|
|
168
|
+
> old tokens or from v2 to v3. Read
|
|
169
|
+
> [the codemod instructions](https://workday.github.io/canvas-kit/?path=/docs/guides-tokens-migration-codemod--docs)
|
|
170
|
+
|
|
171
|
+
## Caution Naming
|
|
172
|
+
|
|
173
|
+
**PR:** [#3462](https://github.com/Workday/canvas-kit/pull/3462)
|
|
174
|
+
|
|
175
|
+
To better align with the brand refresh, Alert and Warning states are being renamed to Caution for
|
|
176
|
+
better semantics.
|
|
177
|
+
|
|
178
|
+
This change mostly affects how you pass an error state to our input components. In most cases, our
|
|
179
|
+
input components should be used with our `FormField` component to ensure correct accessibility.
|
|
180
|
+
|
|
181
|
+
**Before in v13**
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
<FormField error="alert">
|
|
185
|
+
<FormField.Label>First Name</FormField.Label>
|
|
186
|
+
<FormField.Field>
|
|
187
|
+
<FormField.Input as={TextInput} value={value} onChange={handleChange} />
|
|
188
|
+
<FormField.Hint>Cannot contain numbers</FormField.Hint>
|
|
189
|
+
</FormField.Field>
|
|
190
|
+
</FormField>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**After in v14**
|
|
194
|
+
|
|
195
|
+
```tsx
|
|
196
|
+
<FormField error="caution">
|
|
197
|
+
<FormField.Label>First Name</FormField.Label>
|
|
198
|
+
<FormField.Field>
|
|
199
|
+
<FormField.Input as={TextInput} value={value} onChange={handleChange} />
|
|
200
|
+
<FormField.Hint>Cannot contain numbers</FormField.Hint>
|
|
201
|
+
</FormField.Field>
|
|
202
|
+
</FormField>
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
If you're using the error type from `@workday/canvas-kit-react/common` or an error type exposed from
|
|
206
|
+
a component, the naming has also changed.
|
|
207
|
+
|
|
208
|
+
**Before in v13**
|
|
209
|
+
|
|
210
|
+
```tsx
|
|
211
|
+
import {ErrorType} from '@workday/canvas-kit-react/common';
|
|
212
|
+
import {TextInput} from '@workday/canvas-kit-react/text-input';
|
|
213
|
+
import {Switch} from '@workday/canvas-kit-react/switch';
|
|
214
|
+
import {TextArea} from '@workday/canvas-kit-react/text-area';
|
|
215
|
+
|
|
216
|
+
someFunction(ErrorType.Alert);
|
|
217
|
+
|
|
218
|
+
<TextInput error={TextInput.ErrorType.Alert} />
|
|
219
|
+
<Switch error={Switch.ErrorType.Alert} />
|
|
220
|
+
<TextArea error={TextArea.ErrorType.Alert} />
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
**After in v14**
|
|
224
|
+
|
|
225
|
+
```tsx
|
|
226
|
+
import {ErrorType} from '@workday/canvas-kit-react/common';
|
|
227
|
+
import {TextInput} from '@workday/canvas-kit-react/text-input';
|
|
228
|
+
import {Switch} from '@workday/canvas-kit-react/switch';
|
|
229
|
+
import {TextArea} from '@workday/canvas-kit-react/text-area';
|
|
230
|
+
|
|
231
|
+
someFunction(ErrorType.Caution);
|
|
232
|
+
|
|
233
|
+
<TextInput error={TextInput.ErrorType.Caution} />
|
|
234
|
+
<Switch error={Switch.ErrorType.Caution} />
|
|
235
|
+
<TextArea error={TextArea.ErrorType.Caution} />
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
> 🤖 The codemod will handle the change of `ErrorType.Alert` to `ErrorType.Caution` and
|
|
239
|
+
> `error="alert"` to `error="caution"`.
|
|
240
|
+
|
|
241
|
+
## Theming
|
|
242
|
+
|
|
243
|
+
### New Documentation
|
|
244
|
+
|
|
245
|
+
We've **significantly** improved our theming documentation. Please consult our new
|
|
246
|
+
[Canvas Kit Theming Guide](/get-started/for-developers/theming/overview/).
|
|
247
|
+
|
|
248
|
+
### Canvas Provider 🚨
|
|
249
|
+
|
|
250
|
+
**PRs:** [#3407](https://github.com/Workday/canvas-kit/pull/3407),
|
|
251
|
+
[#3429](https://github.com/Workday/canvas-kit/pull/3429)
|
|
252
|
+
|
|
253
|
+
- `CanvasThemePalette` and `CanvasTheme` type have been updated to include a `lighter` property.
|
|
254
|
+
- `CanvasProvider` `theme` prop has been updated to include a `lighter` color for each palette.
|
|
255
|
+
|
|
256
|
+
#### Breaking Changes
|
|
257
|
+
|
|
258
|
+
Canvas Provider has been updated to **remove** default branding colors to ensure proper cascading of
|
|
259
|
+
our CSS variables. Instead of generating a palette and shifting the brightness and darkness with
|
|
260
|
+
`chroma.js`, we use `oklch` to generate the palette colors.
|
|
261
|
+
|
|
262
|
+
Prior to v14, `CanvasProvider` created a
|
|
263
|
+
[cascade barrier](/get-started/for-developers/theming/overview/#what-is-a-cascade-barrier), which
|
|
264
|
+
redefined brand CSS variables under a class and created a higher specificity. This made it difficult
|
|
265
|
+
to override brand tokens in certain scenarios. v14 removes that barrier.
|
|
266
|
+
|
|
267
|
+
**Before in v13**
|
|
268
|
+
|
|
269
|
+
In v13, the `useTheme` hook would call `createCanvasTheme` which generated a palette given a `main`
|
|
270
|
+
color via `chroma.js`.
|
|
271
|
+
|
|
272
|
+
```tsx
|
|
273
|
+
<CanvasProvider theme={{canvas: {palette: {primary: {main: 'purple'}}}}}>
|
|
274
|
+
<App />
|
|
275
|
+
</CanvasProvider>
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
**After in v14**
|
|
279
|
+
|
|
280
|
+
We use `oklch` to generate the palette colors. The color shifting will be different. If you want
|
|
281
|
+
more control over the colors, we suggest providing the full palette object.
|
|
282
|
+
|
|
283
|
+
```tsx
|
|
284
|
+
<CanvasProvider
|
|
285
|
+
theme={{
|
|
286
|
+
canvas: {
|
|
287
|
+
palette: {
|
|
288
|
+
primary: {
|
|
289
|
+
lightest: base.blue25,
|
|
290
|
+
light: base.blue200,
|
|
291
|
+
main: base.blue600,
|
|
292
|
+
dark: base.blue700,
|
|
293
|
+
darkest: base.blue800,
|
|
294
|
+
contrast: base.neutral0,
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
}}
|
|
299
|
+
>
|
|
300
|
+
<App />
|
|
301
|
+
</CanvasProvider>
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
**Or**
|
|
305
|
+
|
|
306
|
+
```tsx
|
|
307
|
+
<CanvasProvider theme={{canvas: {palette: {primary: {main: base.blue600}}}}}>
|
|
308
|
+
<App />
|
|
309
|
+
</CanvasProvider>
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
> **Note:** The way `chroma.js` and `oklch` generate colors **is different**. While we work on a
|
|
313
|
+
> better algorithm to determine hue, chroma and lightness and color shifting that best represents an
|
|
314
|
+
> accessible palette, **you may see color discrepancies**. If you want to continue using the old way
|
|
315
|
+
> of generating a color palette with `chroma.js`, you can use `createCanvasTheme`.
|
|
316
|
+
|
|
317
|
+
```tsx
|
|
318
|
+
<CanvasProvider
|
|
319
|
+
theme={{canvas: createCanvasTheme({palette: {primary: {main: cssVar(base.blue600)}}})}}
|
|
320
|
+
>
|
|
321
|
+
<App />
|
|
322
|
+
</CanvasProvider>
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
The reason for this change is to ensure that the CSS variables properly cascade to all components.
|
|
326
|
+
Before in v13, the `CanvasProvider` would add the brand tokens under a class name, creating a higher
|
|
327
|
+
specificity.
|
|
328
|
+
|
|
329
|
+
### useIsRTL
|
|
330
|
+
|
|
331
|
+
**PR:** [#3477](https://github.com/Workday/canvas-kit/pull/3477)
|
|
332
|
+
|
|
333
|
+
The `useIsRTL` hook has been deprecated. Please use
|
|
334
|
+
[CSS logical properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties)
|
|
335
|
+
for styling, `isElementRTL` for event handlers, and `shouldMirrorInRTL` for icons. If you need
|
|
336
|
+
`useIsRTL` for any other reason, please file a issue. See the [Icons](#icons) section for more
|
|
337
|
+
details on the new `shouldMirrorInRTL` prop.
|
|
338
|
+
|
|
339
|
+
## Component Updates
|
|
340
|
+
|
|
341
|
+
### Avatar (Preview)
|
|
342
|
+
|
|
343
|
+
**PR:** [#3430](https://github.com/Workday/canvas-kit/pull/3430)
|
|
344
|
+
|
|
345
|
+
A new `Avatar` component has been added to the `@workday/canvas-kit-preview-react` package that
|
|
346
|
+
matches our brand refresh.
|
|
347
|
+
|
|
348
|
+
#### API Changes from Avatar (Main)
|
|
349
|
+
|
|
350
|
+
- `Avatar` has a `name` prop. This is required to ensure a fallback if a `url` is not provided. The
|
|
351
|
+
`name` prop also determines the initials and the `alt` text for the image if a `url` is provided.
|
|
352
|
+
- `url` is unchanged. This prop is optional and will be used to display an image `Avatar`.
|
|
353
|
+
- `variant` defines the color of the `Avatar`. It accepts the following values:
|
|
354
|
+
- `blue` (default)
|
|
355
|
+
- `amber`
|
|
356
|
+
- `teal`
|
|
357
|
+
- `purple`
|
|
358
|
+
- By default, the `Avatar` will render a `div` element. If you need to render a `button` element use
|
|
359
|
+
the `BaseAvatar` component.
|
|
360
|
+
- `size` accepts the following values:
|
|
361
|
+
- `extraExtraLarge`
|
|
362
|
+
- `extraLarge`
|
|
363
|
+
- `large`
|
|
364
|
+
- `medium` (default)
|
|
365
|
+
- `small`
|
|
366
|
+
- `extraSmall`
|
|
367
|
+
- `extraExtraSmall`
|
|
368
|
+
|
|
369
|
+
**Avatar (Main)**
|
|
370
|
+
|
|
371
|
+
```tsx
|
|
372
|
+
import { Avatar } from '@workday/canvas-kit-react/avatar';
|
|
373
|
+
|
|
374
|
+
<Avatar altText="John Doe" size="extraExtraLarge" variant="light" as="div" url={yourImageUrl} />
|
|
375
|
+
|
|
376
|
+
// For Avatars that were buttons
|
|
377
|
+
<Avatar altText="John Doe" size="extraExtraLarge" variant="dark" url={yourImageUrl} />
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
**Avatar (Preview)**
|
|
381
|
+
|
|
382
|
+
```tsx
|
|
383
|
+
import { Avatar } from '@workday/canvas-kit-preview-react/avatar';
|
|
384
|
+
|
|
385
|
+
<Avatar name="John Doe" size="extraExtraLarge" variant="blue" />
|
|
386
|
+
|
|
387
|
+
// Preferred Initials
|
|
388
|
+
<Avatar name="Julian Doe Smith" size="extraExtraLarge" variant="blue" preferredInitials="JS" />
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### Branding Changes 💅
|
|
392
|
+
|
|
393
|
+
Several components have been refactored to reflect our new brand direction. Most of these changes
|
|
394
|
+
revolve around the use of our new brand colors. For a better guide on what has changed in our v3.0.0
|
|
395
|
+
tokens, please view the Tokens v3.0.0
|
|
396
|
+
[Upgrade Guide](https://workday.github.io/canvas-tokens/?path=/docs/guides-upgrade-guides-v3-overview--docs).
|
|
397
|
+
|
|
398
|
+
The following components have been updated (**see
|
|
399
|
+
[v14 Visual Changes](/help/upgrade-guides/canvas-v14-upgrade-guide/#tab=visual-changes) for a visual
|
|
400
|
+
reference of the updates**):
|
|
401
|
+
|
|
402
|
+
- `Breadcrumbs` [#3270](https://github.com/Workday/canvas-kit/pull/3270),
|
|
403
|
+
[#3447](https://github.com/Workday/canvas-kit/pull/3447)
|
|
404
|
+
- `Buttons` [#3394](https://github.com/Workday/canvas-kit/pull/3394)
|
|
405
|
+
- `ColorPicker` (Main) [#3307](https://github.com/Workday/canvas-kit/pull/3307)
|
|
406
|
+
- `ColorPicker` (preview) [#3307](https://github.com/Workday/canvas-kit/pull/3307)
|
|
407
|
+
- `InformationHighlight` [#3443](https://github.com/Workday/canvas-kit/pull/3443)
|
|
408
|
+
- `LoadingDots` (Main) [#3393](https://github.com/Workday/canvas-kit/pull/3393)
|
|
409
|
+
- `Pagination` (Preview) [#3300](https://github.com/Workday/canvas-kit/pull/3300)
|
|
410
|
+
- `Pill` [#3446](https://github.com/Workday/canvas-kit/pull/3446)
|
|
411
|
+
- `SearchForm` (Labs) [#3303](https://github.com/Workday/canvas-kit/pull/3303)
|
|
412
|
+
- `SegmentedControl` (Main) [#3278](https://github.com/Workday/canvas-kit/pull/3278)
|
|
413
|
+
- `SegmentedControl` (Preview) [#3278](https://github.com/Workday/canvas-kit/pull/3278)
|
|
414
|
+
- `ToolbarDropdownButton` [#3293](https://github.com/Workday/canvas-kit/pull/3293)
|
|
415
|
+
- `ToolbarIconButton` [#3293](https://github.com/Workday/canvas-kit/pull/3293)
|
|
416
|
+
|
|
417
|
+
### Buttons
|
|
418
|
+
|
|
419
|
+
#### Tertiary Button 🚨
|
|
420
|
+
|
|
421
|
+
**PR:** [3394](https://github.com/Workday/canvas-kit/pull/3394)
|
|
422
|
+
|
|
423
|
+
**Breaking Changes**
|
|
424
|
+
|
|
425
|
+
- The `TertiaryButton` component no longer supports the `isThemable` prop. To customize the
|
|
426
|
+
appearance of `TertiaryButton`, use the `cs` prop for custom styles or the `colors` prop for
|
|
427
|
+
palette-based color overrides.
|
|
428
|
+
- The shape of `TertiaryButton` has changed to have rounded corners, aligning with other buttons and
|
|
429
|
+
our new brand direction.
|
|
430
|
+
|
|
431
|
+
**Before in v13**
|
|
432
|
+
|
|
433
|
+
```tsx
|
|
434
|
+
<TertiaryButton isThemable>Themable Button</TertiaryButton>
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
**After in v14**
|
|
438
|
+
|
|
439
|
+
```tsx
|
|
440
|
+
<TertiaryButton cs={{/* custom styles */}}>Custom Button</TertiaryButton>
|
|
441
|
+
// OR
|
|
442
|
+
<TertiaryButton colors={{/* palette colors */}}>Custom Button</TertiaryButton>
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
If you need to override default styles, refer to this
|
|
446
|
+
[example](/components/buttons/button/#custom-styles).
|
|
447
|
+
|
|
448
|
+
### Card 🚨
|
|
449
|
+
|
|
450
|
+
**PR:** [#3350](https://github.com/Workday/canvas-kit/pull/3350)
|
|
451
|
+
|
|
452
|
+
We've rebranded the `Card` component to align with our new brand direction and provide better visual
|
|
453
|
+
hierarchy and more flexible styling options.
|
|
454
|
+
|
|
455
|
+
#### Removed Box Shadow
|
|
456
|
+
|
|
457
|
+
The default `Card` variant no longer includes a box shadow, creating a cleaner, flatter appearance
|
|
458
|
+
that aligns with our new brand's emphasis on simplicity and clarity. This is a **visual breaking
|
|
459
|
+
change** that may affect your application's visual hierarchy. If your design requires shadow you can
|
|
460
|
+
add it through the `cs` prop.
|
|
461
|
+
|
|
462
|
+
**Before in v13**
|
|
463
|
+
|
|
464
|
+
```tsx
|
|
465
|
+
<Card>
|
|
466
|
+
<Card.Heading>Card Title</Card.Heading>
|
|
467
|
+
<Card.Body>Card content with shadow</Card.Body>
|
|
468
|
+
</Card>
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
**After in v14**
|
|
472
|
+
|
|
473
|
+
Only do this if you need a shadow. Otherwise, adhere to the default styling.
|
|
474
|
+
|
|
475
|
+
```tsx
|
|
476
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
477
|
+
|
|
478
|
+
<Card cs={{boxShadow: system.depth[1]}}>
|
|
479
|
+
<Card.Heading>Card Title</Card.Heading>
|
|
480
|
+
<Card.Body>Card content with shadow</Card.Body>
|
|
481
|
+
</Card>;
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
#### New Card Variants
|
|
485
|
+
|
|
486
|
+
We've added two new variants to provide more styling flexibility:
|
|
487
|
+
|
|
488
|
+
- **`borderless`**: Use this variant when placing cards on colored backgrounds where it needs to
|
|
489
|
+
blend seamlessly without borders or shadows.
|
|
490
|
+
- **`filled`**: Use this variant when you need a card with a grayish background to create visual
|
|
491
|
+
separation from the page background.
|
|
492
|
+
|
|
493
|
+
The `variant` prop is optional. If no variant is specified, the card will use the default styling.
|
|
494
|
+
|
|
495
|
+
```tsx
|
|
496
|
+
// Default card (no variant prop needed) with a border and no box shadow
|
|
497
|
+
<Card>
|
|
498
|
+
<Card.Heading>Default Card</Card.Heading>
|
|
499
|
+
<Card.Body>Default styling with borders, no shadow</Card.Body>
|
|
500
|
+
</Card>
|
|
501
|
+
|
|
502
|
+
// Borderless variant for colored backgrounds
|
|
503
|
+
<Card variant="borderless">
|
|
504
|
+
<Card.Heading>Card on Colored Background</Card.Heading>
|
|
505
|
+
<Card.Body>Content blends with background</Card.Body>
|
|
506
|
+
</Card>
|
|
507
|
+
|
|
508
|
+
// Filled variant with grayish background
|
|
509
|
+
<Card variant="filled">
|
|
510
|
+
<Card.Heading>Card with grayish Background</Card.Heading>
|
|
511
|
+
<Card.Body>Content with visual separation</Card.Body>
|
|
512
|
+
</Card>
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
#### Replaced Margins with Gap
|
|
516
|
+
|
|
517
|
+
We've replaced the individual margins on `Card.Heading` and `Card.Body` with `gap`. The card now
|
|
518
|
+
uses `display: flex` with `flex-direction: column` by default, and the `gap` prop provides
|
|
519
|
+
consistent spacing between all direct children. This provides more consistent spacing and better
|
|
520
|
+
control over the layout. This is a **visual breaking change** that may affect the spacing between
|
|
521
|
+
card elements.
|
|
522
|
+
|
|
523
|
+
**Before in v13**
|
|
524
|
+
|
|
525
|
+
```tsx
|
|
526
|
+
<Card>
|
|
527
|
+
<Card.Heading marginBlock="zero">Title</Card.Heading>
|
|
528
|
+
<Card.Body marginBlock="zero">Card without any spacing</Card.Body>
|
|
529
|
+
</Card>
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
**After in v14**
|
|
533
|
+
|
|
534
|
+
```tsx
|
|
535
|
+
<Card cs={{gap: system.space.zero}}>
|
|
536
|
+
<Card.Heading>Title</Card.Heading>
|
|
537
|
+
<Card.Body>Card without any spacing</Card.Body>
|
|
538
|
+
</Card>
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
### Count Badge
|
|
542
|
+
|
|
543
|
+
**PR:** [#3411](https://github.com/Workday/canvas-kit/pull/3411)
|
|
544
|
+
|
|
545
|
+
The `CountBadge` component has been updated to reflect our new brand direction.
|
|
546
|
+
|
|
547
|
+
Additionally, a new `emphasis` prop has been added, allowing you to choose between `high` and `low`
|
|
548
|
+
emphasis for the badge.
|
|
549
|
+
|
|
550
|
+
**Count Badge variants in v14**
|
|
551
|
+
|
|
552
|
+
```tsx
|
|
553
|
+
<CountBadge /> // Default count badge with high emphasis
|
|
554
|
+
<CountBadge variant="inverse" /> // Inverse default count badge
|
|
555
|
+
|
|
556
|
+
// New emphasis prop
|
|
557
|
+
<CountBadge emphasis="low" /> // Default count badge with low emphasis
|
|
558
|
+
<CountBadge variant="inverse" emphasis="low" /> // Inverse count badge with low emphasis
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
### Expandable
|
|
562
|
+
|
|
563
|
+
**PRs:** [#3389](https://github.com/Workday/canvas-kit/pull/3389),
|
|
564
|
+
[#3430](https://github.com/Workday/canvas-kit/pull/3430)
|
|
565
|
+
|
|
566
|
+
The hover state of `Expandable.Target` has been updated to use `system.color.bg.alt.soft` instead of
|
|
567
|
+
`system.color.bg.alt.default` to match our new brand direction.
|
|
568
|
+
|
|
569
|
+
The `focus` state has been updated to use `system.color.border.primary.default` to ensure the same
|
|
570
|
+
focus state color across all components.
|
|
571
|
+
|
|
572
|
+
`Expandable.Avatar` has been updated to use the `Avatar` component from Preview. This change
|
|
573
|
+
requires that you update the `altText` prop to `name`.
|
|
574
|
+
|
|
575
|
+
> 🤖 The codemod will handle the change of `altText` to `name` on `Expandable.Avatar`.
|
|
576
|
+
|
|
577
|
+
These changes are only **visual** and should not affect the functionality of the component.
|
|
578
|
+
|
|
579
|
+
### Hyperlink and External Hyperlink
|
|
580
|
+
|
|
581
|
+
**PR:** [#3390](https://github.com/Workday/canvas-kit/pull/3390)
|
|
582
|
+
|
|
583
|
+
`Hyperlink` and `ExternalHyperlink` now have `standalone` and `standaloneInverse` variants. This
|
|
584
|
+
removes the underline text decoration for use outside the context of body text.
|
|
585
|
+
|
|
586
|
+
**Hyperlink and ExternalHyperlink in v14**
|
|
587
|
+
|
|
588
|
+
```tsx
|
|
589
|
+
<Hyperlink variant="standalone" href="#hyperlink">Hyperlink</Hyperlink>
|
|
590
|
+
<ExternalHyperlink variant="standalone" href="#external-hyperlink">External Hyperlink</ExternalHyperlink>
|
|
591
|
+
<Hyperlink variant="standaloneInverse" href="#hyperlink">Hyperlink</Hyperlink>
|
|
592
|
+
<ExternalHyperlink variant="standaloneInverse" href="#external-hyperlink">External Hyperlink</ExternalHyperlink>
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
> **Note:** Only use the `standalone` or `standaloneInverse` variant in cases where `HyperLink` and
|
|
596
|
+
> `ExternalHyperlink` are used outside the context of body text.
|
|
597
|
+
|
|
598
|
+
### Loading Dots
|
|
599
|
+
|
|
600
|
+
**PR:** [#3393](https://github.com/Workday/canvas-kit/pull/3393)
|
|
601
|
+
|
|
602
|
+
We've updated the colors to match our brand refresh. We've changed the default color from
|
|
603
|
+
`system.color.bg.alt.strong` to `system.color.bg.muted.strong`.
|
|
604
|
+
|
|
605
|
+
`LoadingDots` now has an `inverse` variant. Use this variant when the Loading Dots are on a dark
|
|
606
|
+
background or image.
|
|
607
|
+
|
|
608
|
+
**After in v14**
|
|
609
|
+
|
|
610
|
+
```tsx
|
|
611
|
+
// Use inverse variant when the Loading Dots are on a dark background or image
|
|
612
|
+
<LoadingDots variant="inverse" />
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
### Pill (Preview)
|
|
616
|
+
|
|
617
|
+
**PRs:** [#3430](https://github.com/Workday/canvas-kit/pull/3430),
|
|
618
|
+
[#3446](https://github.com/Workday/canvas-kit/pull/3446)
|
|
619
|
+
|
|
620
|
+
`Pill` has been updated to use the `Avatar` component from Preview. This change requires that you
|
|
621
|
+
provide a value for the `name` prop.
|
|
622
|
+
|
|
623
|
+
> 🤖 The codemod will handle the change of `altText` to `name` on `Pill.Avatar`.
|
|
624
|
+
|
|
625
|
+
The `Pill` component no longer supports `default` as a value for the `variant` prop. If the
|
|
626
|
+
`variant` prop is not provided, the component will use its default styling.
|
|
627
|
+
|
|
628
|
+
`readOnlyPillStencil` and `removeablePillStencil` have been removed. Please use `pillStencil`
|
|
629
|
+
instead.
|
|
630
|
+
|
|
631
|
+
**Before in v13**
|
|
632
|
+
|
|
633
|
+
```tsx
|
|
634
|
+
<Pill variant="default">
|
|
635
|
+
<Pill.Avatar altText="John Doe" />
|
|
636
|
+
<Pill.Label>John Doe</Pill.Label>
|
|
637
|
+
</Pill>
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
**After in v14**
|
|
641
|
+
|
|
642
|
+
```tsx
|
|
643
|
+
<Pill>
|
|
644
|
+
<Pill.Avatar name="John Doe" />
|
|
645
|
+
<Pill.Label>John Doe</Pill.Label>
|
|
646
|
+
</Pill>
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
### Search Form (Labs) 🚨
|
|
650
|
+
|
|
651
|
+
**PR:** [#3303](https://github.com/Workday/canvas-kit/pull/3303)
|
|
652
|
+
|
|
653
|
+
`SearchThemeAttributes` type has been updated. Both `boxShadow` and `boxShadowFocus` now only accept
|
|
654
|
+
a `string` instead of `string | string[]`.
|
|
655
|
+
|
|
656
|
+
**Before in v13**
|
|
657
|
+
|
|
658
|
+
```tsx
|
|
659
|
+
const customTheme = {
|
|
660
|
+
background: colors.cinnamon600,
|
|
661
|
+
backgroundFocus: colors.frenchVanilla100,
|
|
662
|
+
placeholderColor: colors.frenchVanilla100,
|
|
663
|
+
placeholderColorFocus: colors.blackPepper400,
|
|
664
|
+
boxShadow: ['10px 5px 5px red', '60px -16px teal'],
|
|
665
|
+
boxShadowFocus: ['10px 5px 5px red', '60px -16px teal'],
|
|
666
|
+
} as SearchThemeAttributes;
|
|
667
|
+
|
|
668
|
+
<SearchForm
|
|
669
|
+
searchTheme={customTheme}
|
|
670
|
+
autocompleteItems={menuItems}
|
|
671
|
+
onInputChange={filterMenuItems}
|
|
672
|
+
onSubmit={handleSubmit}
|
|
673
|
+
/>;
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
**After in v14**
|
|
677
|
+
|
|
678
|
+
```tsx
|
|
679
|
+
const customTheme = {
|
|
680
|
+
background: colors.cinnamon600,
|
|
681
|
+
backgroundFocus: colors.frenchVanilla100,
|
|
682
|
+
placeholderColor: colors.frenchVanilla100,
|
|
683
|
+
placeholderColorFocus: colors.blackPepper400,
|
|
684
|
+
boxShadow: '10px 5px 5px red',
|
|
685
|
+
boxShadowFocus: '10px 5px 5px red',
|
|
686
|
+
} as SearchThemeAttributes;
|
|
687
|
+
|
|
688
|
+
<SearchForm
|
|
689
|
+
searchTheme={customTheme}
|
|
690
|
+
autocompleteItems={menuItems}
|
|
691
|
+
onInputChange={filterMenuItems}
|
|
692
|
+
onSubmit={handleSubmit}
|
|
693
|
+
/>;
|
|
694
|
+
```
|
|
695
|
+
|
|
696
|
+
`SearchTheme` enum type has been updated to have string values `light`, `dark` and `transparent`.
|
|
697
|
+
This **should not** affect the way you use the type unless you're passing a `number` of `0`, `1` or
|
|
698
|
+
`2` to the `searchTheme` prop.
|
|
699
|
+
|
|
700
|
+
### Status Indicator (Preview) 🚨
|
|
701
|
+
|
|
702
|
+
**PR:** [#3354](https://github.com/Workday/canvas-kit/pull/3354)
|
|
703
|
+
|
|
704
|
+
Preview `StatusIndicator` is rounder and more vibrant with base emphasis (`low`).
|
|
705
|
+
|
|
706
|
+
Variant names of the preview `StatusIndicator` have been updated:
|
|
707
|
+
|
|
708
|
+
- `blue` → `primary`
|
|
709
|
+
- `green` → `success`
|
|
710
|
+
- `orange` → `caution`
|
|
711
|
+
- `red` → `critical`
|
|
712
|
+
- `gray` → `neutral`
|
|
713
|
+
|
|
714
|
+
The `StatusIndicatorVariant` type has been updated to contain the new variant names listed above. If
|
|
715
|
+
you use the old variant values, update to use the new ones mapped above. Use
|
|
716
|
+
`StatusIndicatorProps['variant']` instead.
|
|
717
|
+
|
|
718
|
+
**Before in v13**
|
|
719
|
+
|
|
720
|
+
```tsx
|
|
721
|
+
<StatusIndicator variant="blue" />
|
|
722
|
+
<StatusIndicator variant="green" />
|
|
723
|
+
<StatusIndicator variant="orange" />
|
|
724
|
+
<StatusIndicator variant="red" />
|
|
725
|
+
<StatusIndicator variant="gray" />
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
**After in v14**
|
|
729
|
+
|
|
730
|
+
```tsx
|
|
731
|
+
<StatusIndicator variant="primary" />
|
|
732
|
+
<StatusIndicator variant="success" />
|
|
733
|
+
<StatusIndicator variant="caution" />
|
|
734
|
+
<StatusIndicator variant="critical" />
|
|
735
|
+
<StatusIndicator variant="neutral" />
|
|
736
|
+
```
|
|
737
|
+
|
|
738
|
+
### Icons
|
|
739
|
+
|
|
740
|
+
**PR:** [#3477](https://github.com/Workday/canvas-kit/pull/3477)
|
|
741
|
+
|
|
742
|
+
`shouldMirrorInRTL` has been added to `Icon` components (`SVG`, `SystemIcon`, `AccentIcon`,
|
|
743
|
+
`AppletIcon`, `SystemIconCircle`, `AIIngressButton`, `BaseButton.Icon`, `Button`,
|
|
744
|
+
`ToolbarDropdownButton`, `ToolbarIconButton`, `ButtonLabelIcon`, `PrimaryButton`, `SecondaryButton`,
|
|
745
|
+
and `TertiaryButton`). This is used to mirror the icon when the content direction is `rtl`. This is
|
|
746
|
+
meant to replace `useIsRTL` combined with the `shouldMirror` prop. Instead of getting the content
|
|
747
|
+
direction from JavaScript and passing it to components, you can now pass `shouldMirrorInRTL={true}`
|
|
748
|
+
to the component which will mirror the icon only when the content direction is `rtl`.
|
|
749
|
+
|
|
750
|
+
**Before in v13**
|
|
751
|
+
|
|
752
|
+
```tsx
|
|
753
|
+
<IconComponent shouldMirror={useIsRTL()} />
|
|
754
|
+
```
|
|
755
|
+
|
|
756
|
+
**After in v14**
|
|
757
|
+
|
|
758
|
+
```tsx
|
|
759
|
+
<IconComponent shouldMirrorInRTL />
|
|
760
|
+
```
|
|
761
|
+
|
|
762
|
+
You can still use `shouldMirror` if you intend to always mirror an icon. This is less ideal because
|
|
763
|
+
you cannot use `shouldMirror` and `shouldMirrorInRTL` together. The icon will be mirrored regardless
|
|
764
|
+
of content direction if both props are used.
|
|
765
|
+
|
|
766
|
+
## Deprecations
|
|
767
|
+
|
|
768
|
+
We add the [@deprecated](https://jsdoc.app/tags-deprecated.html) JSDoc tag to code we plan to remove
|
|
769
|
+
in a future major release. This signals consumers to migrate to a more stable alternative before the
|
|
770
|
+
deprecated code is removed.
|
|
771
|
+
|
|
772
|
+
### Avatar in Main
|
|
773
|
+
|
|
774
|
+
**PR:** [#3430](https://github.com/Workday/canvas-kit/pull/3430)
|
|
775
|
+
|
|
776
|
+
We've deprecated the `Avatar` component in `@workday/canvas-kit-react` Main package. Please use the
|
|
777
|
+
`Avatar` component in our Preview package.
|
|
778
|
+
|
|
779
|
+
**Before in v13**
|
|
780
|
+
|
|
781
|
+
```tsx
|
|
782
|
+
import { Avatar } from '@workday/canvas-kit-react/avatar';
|
|
783
|
+
|
|
784
|
+
// For Avatars that were divs
|
|
785
|
+
<Avatar altText="John Doe" size="extraExtraLarge" as="div" url={yourImageUrl} />
|
|
786
|
+
|
|
787
|
+
// For Avatars that were buttons
|
|
788
|
+
<Avatar altText="John Doe" onClick={() => console.log('Avatar clicked')} />
|
|
789
|
+
```
|
|
790
|
+
|
|
791
|
+
**After in v14**
|
|
792
|
+
|
|
793
|
+
```tsx
|
|
794
|
+
import {Avatar} from '@workday/canvas-kit-preview-react/avatar';
|
|
795
|
+
// name is used as a fallback if the image url is broken or still loading
|
|
796
|
+
// variant defines the color of the Avatar
|
|
797
|
+
<Avatar name="John Doe" size="extraExtraLarge" variant="teal" url={yourImageUrl} />;
|
|
798
|
+
```
|
|
799
|
+
|
|
800
|
+
If you need to render a `button` element use the `BaseAvatar` component.
|
|
801
|
+
|
|
802
|
+
```tsx
|
|
803
|
+
import {BaseAvatar} from '@workday/canvas-kit-preview-react/avatar';
|
|
804
|
+
|
|
805
|
+
<BaseAvatar
|
|
806
|
+
name="John Doe"
|
|
807
|
+
size="extraExtraLarge"
|
|
808
|
+
variant="teal"
|
|
809
|
+
as="button"
|
|
810
|
+
onClick={() => console.log('Avatar clicked')}
|
|
811
|
+
>
|
|
812
|
+
<BaseAvatar.Name name="John Doe" />
|
|
813
|
+
</BaseAvatar>;
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
### Combobox (Labs)
|
|
817
|
+
|
|
818
|
+
The Combobox component in `@workday/canvas-kit-labs-react/combobox` has been deprecated. Please
|
|
819
|
+
migrate to the [Combobox](/get-started/for-developers/resources/combobox/) in
|
|
820
|
+
`@workday/canvas-kit-react`.
|
|
821
|
+
|
|
822
|
+
### Radio (Main)
|
|
823
|
+
|
|
824
|
+
The Radio component in `@workday/canvas-kit-react/radio` has been deprecated. Please migrate to the
|
|
825
|
+
[Radio](/components/inputs/radio/) in `@workday/canvas-kit-preview-react` for improved accessibility
|
|
826
|
+
and API consistency.
|
|
827
|
+
|
|
828
|
+
### SearchForm (Labs)
|
|
829
|
+
|
|
830
|
+
**PR:** [#3469](https://github.com/Workday/canvas-kit/pull/3469)
|
|
831
|
+
|
|
832
|
+
The `SearchForm` in `@workday/canvas-kit-labs-react/search-form` has been deprecated. Please migrate
|
|
833
|
+
to the [Combobox](/get-started/for-developers/resources/combobox/) in `@workday/canvas-kit-react`.
|
|
834
|
+
|
|
835
|
+
### Segmented Control (Main)
|
|
836
|
+
|
|
837
|
+
The Segmented Control component in `@workday/canvas-kit-react/segmented-control` has been
|
|
838
|
+
deprecated. Please migrate to the [Segmented Control](/components/buttons/segmented-control/) in
|
|
839
|
+
`@workday/canvas-kit-preview-react` for improved features and support.
|
|
840
|
+
|
|
841
|
+
### Side Panel (Main)
|
|
842
|
+
|
|
843
|
+
The Side Panel component in `@workday/canvas-kit-react/side-panel` has been deprecated. Please
|
|
844
|
+
migrate to the [Side Panel](/components/containers/side-panel/) in
|
|
845
|
+
`@workday/canvas-kit-preview-react/side-panel` for enhanced functionality.
|
|
846
|
+
|
|
847
|
+
### Tokens
|
|
848
|
+
|
|
849
|
+
The legacy tokens from `@workday/canvas-kit-react/tokens` have been deprecated. Please use the new
|
|
850
|
+
[Canvas Tokens Web](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs)
|
|
851
|
+
package (`@workday/canvas-tokens-web`) for all token usage. Follow the
|
|
852
|
+
[migration guide](https://workday.github.io/canvas-kit?path=/docs/guides-tokens-migration-overview--docs)
|
|
853
|
+
for a smoother upgrade.
|
|
854
|
+
|
|
855
|
+
## Removals
|
|
856
|
+
|
|
857
|
+
Removals have been deleted from our codebase and may no longer be consumed. We've either promoted or
|
|
858
|
+
replaced the removed component or utility.
|
|
859
|
+
|
|
860
|
+
### Deprecated Buttons
|
|
861
|
+
|
|
862
|
+
**PR:** [#3439](https://github.com/Workday/canvas-kit/pull/3439)
|
|
863
|
+
|
|
864
|
+
Long overdue, but a sign of moving forward, we've removed our `DeprecatedButton`. Our design system
|
|
865
|
+
supported this for quite some time, but with the advancement in theming, our components API and our
|
|
866
|
+
flexibility, it is time for us to finally remove this component. This component has served as a
|
|
867
|
+
reminder of how far we've come and we're thankful for this change.
|
|
868
|
+
|
|
869
|
+
Although unlikely, if you were using `DeprecatedButton` please use our flexible and themable buttons
|
|
870
|
+
like `PrimaryButton`, `SecondaryButton` or `TertiaryButton`.
|
|
871
|
+
|
|
872
|
+
### Input Provider
|
|
873
|
+
|
|
874
|
+
We've removed `InputProvider` from our codebase and the `CanvasProvider`. The intent of the provider
|
|
875
|
+
was to check the users input and apply focus styles accordingly to our components. This was needed
|
|
876
|
+
when we still supported IE11 to ensure we could be consistent on styling based on user input events.
|
|
877
|
+
Since dropping support and moving to `:focus-visible`, we no longer need this provider. We now allow
|
|
878
|
+
browser heuristics to determine when an element should receive visual focus styles. For more
|
|
879
|
+
information, please view the
|
|
880
|
+
[MDN docs on `:focus-visible`](https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible).
|
|
881
|
+
|
|
882
|
+
If you are trying to apply focus styles to our components, we strongly advise using the
|
|
883
|
+
`:focus-visible` pseudo selector.
|
|
884
|
+
|
|
885
|
+
```tsx
|
|
886
|
+
import {createStyles} from '@workday/canvas-kit-styling'
|
|
887
|
+
import {PrimaryButton} from '@workday/canvas-kit-react/button'
|
|
888
|
+
|
|
889
|
+
const buttonStyles = createStyles({
|
|
890
|
+
'&:focus-visible': {
|
|
891
|
+
outline: '2px solid red'
|
|
892
|
+
}
|
|
893
|
+
})
|
|
894
|
+
|
|
895
|
+
<PrimaryButton cs={buttonStyles}>
|
|
896
|
+
Click Me
|
|
897
|
+
</PrimaryButton>
|
|
898
|
+
```
|
|
899
|
+
|
|
900
|
+
### Menu (Preview)
|
|
901
|
+
|
|
902
|
+
**PR:** [#3353](https://github.com/Workday/canvas-kit/pull/3353)
|
|
903
|
+
|
|
904
|
+
We've removed `Menu` from `@workday/canvas-kit-preview-react`. Please use
|
|
905
|
+
[Menu](/components/popups/menu/) from `@workday/canvas-kit-react` instead.
|
|
906
|
+
|
|
907
|
+
### readOnlyPillStencil and removeablePillStencil
|
|
908
|
+
|
|
909
|
+
The `readOnlyPillStencil` and `removeablePillStencil` utilities have been removed from the Pill
|
|
910
|
+
package. Please use `pillStencil` instead.
|
|
911
|
+
|
|
912
|
+
### Text Area (Preview)
|
|
913
|
+
|
|
914
|
+
**PR:** [#3471](https://github.com/Workday/canvas-kit/pull/3471)
|
|
915
|
+
|
|
916
|
+
We've removed `TextArea` from `@workday/canvas-kit-preview-react`. Please use
|
|
917
|
+
[TextArea](/components/inputs/text-area/) from `@workday/canvas-kit-react` instead.
|
|
918
|
+
|
|
919
|
+
**Before in v13**
|
|
920
|
+
|
|
921
|
+
```tsx
|
|
922
|
+
import {TextArea} from '@workday/canvas-kit-preview-react/text-area';
|
|
923
|
+
|
|
924
|
+
<TextArea orientation="vertical">
|
|
925
|
+
<TextArea.Label>Leave a review</TextArea.Label>
|
|
926
|
+
<TextArea.Field onChange={handleChange} value={value} />
|
|
927
|
+
</TextArea>;
|
|
928
|
+
```
|
|
929
|
+
|
|
930
|
+
**After in v14**
|
|
931
|
+
|
|
932
|
+
```tsx
|
|
933
|
+
import {TextArea} from '@workday/canvas-kit-react/text-area';
|
|
934
|
+
import {FormField} from '@workday/canvas-kit-react/form-field';
|
|
935
|
+
|
|
936
|
+
<FormField>
|
|
937
|
+
<FormField.Label>Leave a Review</FormField.Label>
|
|
938
|
+
<FormField.Field>
|
|
939
|
+
<FormField.Input as={TextArea} onChange={handleChange} value={value} />
|
|
940
|
+
</FormField.Field>
|
|
941
|
+
</FormField>;
|
|
942
|
+
```
|
|
943
|
+
|
|
944
|
+
### Text Input (Preview)
|
|
945
|
+
|
|
946
|
+
**PR:** [#3471](https://github.com/Workday/canvas-kit/pull/3471)
|
|
947
|
+
|
|
948
|
+
We've removed `TextInput` from `@workday/canvas-kit-preview-react`. Please use
|
|
949
|
+
[TextInput](/components/inputs/text-input/) from `@workday/canvas-kit-react` instead.
|
|
950
|
+
|
|
951
|
+
**Before in v13**
|
|
952
|
+
|
|
953
|
+
```tsx
|
|
954
|
+
import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
|
|
955
|
+
|
|
956
|
+
<TextInput orientation="vertical">
|
|
957
|
+
<TextInput.Label>Email</TextInput.Label>
|
|
958
|
+
<TextInput.Field onChange={handleChange} value={value} />
|
|
959
|
+
</TextInput>;
|
|
960
|
+
```
|
|
961
|
+
|
|
962
|
+
**After in v14**
|
|
963
|
+
|
|
964
|
+
```tsx
|
|
965
|
+
import {TextArea} from '@workday/canvas-kit-react/text-area';
|
|
966
|
+
import {FormField} from '@workday/canvas-kit-react/form-field';
|
|
967
|
+
|
|
968
|
+
<FormField>
|
|
969
|
+
<FormField.Label>Leave a Review</FormField.Label>
|
|
970
|
+
<FormField.Field>
|
|
971
|
+
<FormField.Input as={TextInput} onChange={handleChange} value={value} />
|
|
972
|
+
</FormField.Field>
|
|
973
|
+
</FormField>;
|
|
974
|
+
```
|
|
975
|
+
|
|
976
|
+
---
|
|
977
|
+
|
|
978
|
+
## Troubleshooting
|
|
979
|
+
|
|
980
|
+
### Common Issues
|
|
981
|
+
|
|
982
|
+
- **Dependency Conflicts**: When upgrading to the latest major version of Canvas Kit, all related
|
|
983
|
+
Canvas Kit packages should be updated at the same time:
|
|
984
|
+
|
|
985
|
+
- `"@workday/canvas-kit-react": "^13.5.6"` → `"@workday/canvas-kit-react": "^14.0.0"`
|
|
986
|
+
- `"@workday/canvas-kit-styling": "^13.5.6"` → `"@workday/canvas-kit-styling": "^14.0.0"`
|
|
987
|
+
- `"@workday/canvas-kit-preview-react": "^13.5.6"` →
|
|
988
|
+
`"@workday/canvas-kit-preview-react": "^14.0.0"`
|
|
989
|
+
- `"@workday/canvas-kit-labs-react": "^13.5.6"` → `"@workday/canvas-kit-labs-react": "^14.0.0"`
|
|
990
|
+
|
|
991
|
+
- **Token Issues**: Our components rely on the `@workday/canvas-tokens-web` package which provides
|
|
992
|
+
our CSS variables and ensures the correct styling of our components. Make sure to upgrade to the
|
|
993
|
+
latest version of Canvas Tokens Web and install it correctly. For more information,
|
|
994
|
+
[view our docs](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs).
|
|
995
|
+
|
|
996
|
+
- **Color Discrepancies**: If you notice visual differences after upgrading, this may be due to the
|
|
997
|
+
change from `chroma.js` to `oklch` color generation. Consider providing explicit color values in
|
|
998
|
+
your theme configuration.
|
|
999
|
+
|
|
1000
|
+
- **Build Errors**: If you encounter build errors after running the codemod, ensure your linter is
|
|
1001
|
+
run as the codemod's formatting may not match your project conventions.
|
|
1002
|
+
|
|
1003
|
+
## Glossary
|
|
1004
|
+
|
|
1005
|
+
For an overview of the different packages we provide, please view our docs
|
|
1006
|
+
[here](https://workday.github.io/canvas-kit/?path=/docs/guides-packages--docs).
|
|
1007
|
+
|
|
1008
|
+
### Main
|
|
1009
|
+
|
|
1010
|
+
Components in the Main package are stable and ready for production use.
|
|
1011
|
+
|
|
1012
|
+
### Preview
|
|
1013
|
+
|
|
1014
|
+
Components in the Preview package are mostly stable but may still receive breaking changes before
|
|
1015
|
+
being promoted to Main.
|
|
1016
|
+
|
|
1017
|
+
### Labs
|
|
1018
|
+
|
|
1019
|
+
Components in the Labs package are experimental and may receive significant changes or be removed
|
|
1020
|
+
entirely.
|
|
1021
|
+
|
|
1022
|
+
---
|
|
1023
|
+
|
|
1024
|
+
## Codemod Reference
|
|
1025
|
+
|
|
1026
|
+
# What is a Codemod?
|
|
1027
|
+
|
|
1028
|
+
A codemod is a script that makes programmatic transformations on your codebase by traversing the
|
|
1029
|
+
[AST](https://www.codeshiftcommunity.com/docs/understanding-asts), identifying patterns, and making
|
|
1030
|
+
prescribed changes. This greatly decreases opportunities for error and reduces the number of manual
|
|
1031
|
+
updates, which allows you to focus on changes that need your attention. **We highly recommend you
|
|
1032
|
+
use the codemod for these reasons.**
|
|
1033
|
+
|
|
1034
|
+
If you're new to running codemods or if it's been a minute since you've used one, there are a few
|
|
1035
|
+
things you'll want to keep in mind.
|
|
1036
|
+
|
|
1037
|
+
- Our codemods are meant to be run sequentially. For example, if you're using v8 of Canvas Kit,
|
|
1038
|
+
you'll need to run the v9 codemod before you run v10 and so on.
|
|
1039
|
+
- The codemod will update your code to be compatible with the specified version, but it will **not**
|
|
1040
|
+
remove outdated dependencies or upgrade dependencies to the latest version. You'll need to upgrade
|
|
1041
|
+
dependencies on your own.
|
|
1042
|
+
- We recommend upgrading dependencies before running the codemod.
|
|
1043
|
+
- Always review your `package.json` files to make sure your dependency versions look correct.
|
|
1044
|
+
- The codemod will not handle every breaking change in v14. You will likely need to make some manual
|
|
1045
|
+
changes to be compatible. Use our Upgrade Guide as a checklist.
|
|
1046
|
+
- Codemods are not bulletproof.
|
|
1047
|
+
- Conduct a thorough PR and QA review of all changes to ensure no regressions were introduced.
|
|
1048
|
+
- As a safety precaution, we recommend committing the changes from the codemod as a single
|
|
1049
|
+
isolated commit (separate from other changes) so you can roll back more easily if necessary.
|
|
1050
|
+
|
|
1051
|
+
We're here to help! Automatic changes to your codebase can feel scary. You can always reach out to
|
|
1052
|
+
our team. We'd be very happy to walk you through the process to set you up for success.
|
|
1053
|
+
|
|
1054
|
+
## Running a Codemod
|
|
1055
|
+
|
|
1056
|
+
### Instructions
|
|
1057
|
+
|
|
1058
|
+
The easiest way to run our codemod is to use `npx` in your terminal.```sh npx
|
|
1059
|
+
@workday/canvas-kit-codemod v${canvasKitMajorVersionNumber} [path]
|
|
1060
|
+
|
|
1061
|
+
````
|
|
1062
|
+
|
|
1063
|
+
Be sure to provide specific directories that need to be updated via the `[path]` argument. This
|
|
1064
|
+
decreases the amount of AST the codemod needs to traverse and reduces the chances of the script
|
|
1065
|
+
having an error. For example, if your source code lives in `src/`, use `src/` as your `[path]`. Or,
|
|
1066
|
+
if you have a monorepo with three packages using Canvas Kit, provide those specific packages as your
|
|
1067
|
+
`[path]`.
|
|
1068
|
+
|
|
1069
|
+
Alternatively, if you're unable to run the codemod successfully using `npx`, you can install the
|
|
1070
|
+
codemod package as a dev dependency, run it with `yarn`, and then remove the package after you're
|
|
1071
|
+
finished.
|
|
1072
|
+
|
|
1073
|
+
```sh
|
|
1074
|
+
yarn add @workday/canvas-kit-codemod --dev
|
|
1075
|
+
yarn canvas-kit-codemod v${canvasKitMajorVersion} [path]
|
|
1076
|
+
yarn remove @workday/canvas-kit-codemod
|
|
1077
|
+
````
|
|
1078
|
+
|
|
1079
|
+
> **Note**: The codemod only works on `.js`, `.jsx`, `.ts`, and `.tsx` files. You'll need to
|
|
1080
|
+
> manually edit other file types (`.json`, `.mdx`, `.md`, etc.). You may need to run your linter
|
|
1081
|
+
> after executing the codemod, as its resulting formatting (spacing, quotes, etc.) may not match
|
|
1082
|
+
> your project conventions.
|
|
1083
|
+
|
|
1084
|
+
## Codemod Transformations for v14
|
|
1085
|
+
|
|
1086
|
+
The following automated transformations are available for upgrading to v14:
|
|
1087
|
+
|
|
1088
|
+
- **Rename Error Type Alert**: renameErrorTypeAlert
|
|
1089
|
+
- **Rename Error Type Alert On Inputs**: renameErrorTypeAlertOnInputs
|
|
1090
|
+
- **Update Expandable Avatar Prop**: updateExpandableAvatarProp
|
|
1091
|
+
- **Update Form Field Alert**: updateFormFieldAlert
|
|
1092
|
+
- **Update Pill Avatar Prop**: updatePillAvatarProp
|
|
1093
|
+
- **Update Status Indicator Preview**: updateStatusIndicatorPreview
|
|
1094
|
+
|
|
1095
|
+
Run the codemod with: `npx @workday/canvas-kit-codemod v14 [path]`
|