@workday/canvas-kit-mcp 15.0.0-alpha.0056-next.0 → 15.0.0-alpha.0060-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
|
@@ -0,0 +1,960 @@
|
|
|
1
|
+
---
|
|
2
|
+
source_file: docs/mdx/11.0-UPGRADE-GUIDE.mdx
|
|
3
|
+
live_url: https://workday.github.io/canvas-kit/docs/mdx/11.0-UPGRADE-GUIDE
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<Meta title="Guides/Upgrade Guides/v11.0" />
|
|
7
|
+
|
|
8
|
+
# Canvas Kit 11.0 Upgrade Guide
|
|
9
|
+
|
|
10
|
+
This guide contains an overview of the changes in Canvas Kit v11. Please
|
|
11
|
+
[reach out](https://github.com/Workday/canvas-kit/issues/new?labels=bug&template=bug.md) if you have
|
|
12
|
+
any questions.
|
|
13
|
+
|
|
14
|
+
## Why You Should Upgrade
|
|
15
|
+
|
|
16
|
+
Canvas Kit v11 is transitioning into a
|
|
17
|
+
[new way of styling](https://github.com/Workday/canvas-kit/discussions/2265). Theming and building
|
|
18
|
+
an in sync Canvas Kit CSS has been at the top of our minds. We've started using our new
|
|
19
|
+
[Canvas Tokens Web](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs)
|
|
20
|
+
package to take advantage of
|
|
21
|
+
[CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) and
|
|
22
|
+
provide semantic tokens that can translate to theming components.
|
|
23
|
+
|
|
24
|
+
A note to the reader:
|
|
25
|
+
|
|
26
|
+
- While we still support our old tokens from `@workday/canvas-kit-react/tokens` in v11, you must
|
|
27
|
+
install our new tokens from `@workday/canvas-tokens-web`. You can find more info in our
|
|
28
|
+
[docs](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs).
|
|
29
|
+
- In this release, we've introduced a
|
|
30
|
+
[new styling API](https://workday.github.io/canvas-kit/?path=/docs/styling-basics--create-stencil).
|
|
31
|
+
This shouldn't effect the way you currently style your components. Because we're moving away from
|
|
32
|
+
Emotion, support for style props will eventually be removed, however, this API provide backwards
|
|
33
|
+
compatability. If you want to slowly move off of Emotion as well, you can start styling components
|
|
34
|
+
via the `cs` prop or our new styling utilities.
|
|
35
|
+
|
|
36
|
+
## Table of contents
|
|
37
|
+
|
|
38
|
+
- [Canvas Tokens](#canvas-tokens)
|
|
39
|
+
- [Codemod](#codemod)
|
|
40
|
+
- [Deprecations](#deprecations)
|
|
41
|
+
- [Form Field (Main)](#form-field-main)
|
|
42
|
+
- [Label Text](#label-text)
|
|
43
|
+
- [Text Area (Preview)](#text-area-preview)
|
|
44
|
+
- [Text Input (Preview)](#text-input-preview)
|
|
45
|
+
- [Removals](#removals)
|
|
46
|
+
- [Status Indicator (Preview) Utilities](#status-indicator-preview-utilities)
|
|
47
|
+
- [Component Style Updates](#component-style-updates)
|
|
48
|
+
- [Component Updates](#component-updates)
|
|
49
|
+
- [Styling API and CSS Tokens](#styling-api-and-css-tokens)
|
|
50
|
+
- [CountBadge](#count-badge)
|
|
51
|
+
- [Form Field Preview](#form-field-preview)
|
|
52
|
+
- [Icons](#icons)
|
|
53
|
+
- [Status Indicator (Preview)](#status-indicator-preview)
|
|
54
|
+
- [Table](#table)
|
|
55
|
+
- [Text](#text)
|
|
56
|
+
- [Style Utility Updates](#style-utility-updates)
|
|
57
|
+
- [createStencil](#createstencil)
|
|
58
|
+
- [Troubleshooting](#troubleshooting)
|
|
59
|
+
- [Glossary](#glossary)
|
|
60
|
+
- [Main](#main)
|
|
61
|
+
- [Preview](#preview)
|
|
62
|
+
- [Labs](#labs)
|
|
63
|
+
|
|
64
|
+
## Canvas Tokens
|
|
65
|
+
|
|
66
|
+
In v11, all the components listed in this guide have started using our new
|
|
67
|
+
[Canvas Tokens Web](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs).
|
|
68
|
+
In v10, we provided token fallbacks so that a component would not be missing a token/value if the
|
|
69
|
+
tokens were not defined. In v11 you must add `@workday/canvas-tokens-web` to ensure our components
|
|
70
|
+
are properly styled and the variables are defined. For more information on installing and using,
|
|
71
|
+
please reference our tokens
|
|
72
|
+
[docs](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs).
|
|
73
|
+
|
|
74
|
+
## Codemod
|
|
75
|
+
|
|
76
|
+
We've provided a [codemod](https://github.com/Workday/canvas-kit/tree/master/modules/codemod) to
|
|
77
|
+
automatically update your code to work with most of the breaking changes in v11. **Breaking changes
|
|
78
|
+
handled by the codemod are marked with 🤖 in the Upgrade Guide.**
|
|
79
|
+
|
|
80
|
+
A codemod is a script that makes programmatic transformations on your codebase by traversing the
|
|
81
|
+
[AST](https://www.hypermod.io/docs/guides/understanding-asts), identifying patterns, and making
|
|
82
|
+
prescribed changes. This greatly decreases opportunities for error and reduces the number of manual
|
|
83
|
+
updates, which allows you to focus on changes that need your attention. **We highly recommend you
|
|
84
|
+
use the codemod for these reasons.**
|
|
85
|
+
|
|
86
|
+
If you're new to running codemods or if it's been a minute since you've used one, there are a few
|
|
87
|
+
things you'll want to keep in mind.
|
|
88
|
+
|
|
89
|
+
- Our codemods are meant to be run sequentially. For example, if you're using v8 of Canvas Kit,
|
|
90
|
+
you'll need to run the v9 codemod before you run v11.
|
|
91
|
+
- The codemod will update your code to be compatible with the specified version, but it will **not**
|
|
92
|
+
remove outdated dependencies or upgrade dependencies to the latest version. You'll need to upgrade
|
|
93
|
+
dependencies on your own.
|
|
94
|
+
- We recommend upgrading dependencies before running the codemod.
|
|
95
|
+
- Always review your `package.json` files to make sure your dependency versions look correct.
|
|
96
|
+
- The codemod will not handle every breaking change in v11. You will likely need to make some manual
|
|
97
|
+
changes to be compatible. Use our Upgrade Guide as a checklist.
|
|
98
|
+
- Codemods are not bulletproof.
|
|
99
|
+
- Conduct a thorough PR and QA review of all changes to ensure no regressions were introduced.
|
|
100
|
+
- As a safety precaution, we recommend committing the changes from the codemod as a single
|
|
101
|
+
isolated commit (separate from other changes) so you can roll back more easily if necessary.
|
|
102
|
+
|
|
103
|
+
We're here to help! Automatic changes to your codebase can feel scary. You can always reach out to
|
|
104
|
+
our team. We'd be very happy to walk you through the process to set you up for success.
|
|
105
|
+
|
|
106
|
+
### Instructions
|
|
107
|
+
|
|
108
|
+
The easiest way to run our codemod is to use `npx` in your terminal.
|
|
109
|
+
|
|
110
|
+
```sh
|
|
111
|
+
npx @workday/canvas-kit-codemod v11 [path]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Be sure to provide specific directories that need to be updated via the `[path]` argument. This
|
|
115
|
+
decreases the amount of AST the codemod needs to traverse and reduces the chances of the script
|
|
116
|
+
having an error. For example, if your source code lives in `src/`, use `src/` as your `[path]`. Or,
|
|
117
|
+
if you have a monorepo with three packages using Canvas Kit, provide those specific packages as your
|
|
118
|
+
`[path]`.
|
|
119
|
+
|
|
120
|
+
Alternatively, if you're unable to run the codemod successfully using `npx`, you can install the
|
|
121
|
+
codemod package as a dev dependency, run it with `yarn`, and then remove the package after you're
|
|
122
|
+
finished.
|
|
123
|
+
|
|
124
|
+
```sh
|
|
125
|
+
yarn add @workday/canvas-kit-codemod --dev
|
|
126
|
+
yarn canvas-kit-codemod v11 [path]
|
|
127
|
+
yarn remove @workday/canvas-kit-codemod
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
> **Note**: The codemod only works on `.js`, `.jsx`, `.ts`, and `.tsx` files. You'll need to
|
|
131
|
+
> manually edit other file types (`.json`, `.mdx`, `.md`, etc.). You may need to run your linter
|
|
132
|
+
> after executing the codemod, as its resulting formatting (spacing, quotes, etc.) may not match
|
|
133
|
+
> your project conventions.
|
|
134
|
+
|
|
135
|
+
## Deprecations
|
|
136
|
+
|
|
137
|
+
We add the [@deprecated](https://jsdoc.app/tags-deprecated.html) JSDoc tag to code we plan to remove
|
|
138
|
+
in a future major release. This signals consumers to migrate to a more stable alternative before the
|
|
139
|
+
deprecated code is removed.
|
|
140
|
+
|
|
141
|
+
### Form Field Main
|
|
142
|
+
|
|
143
|
+
**PR:** [#2472](https://github.com/Workday/canvas-kit/pull/2472)
|
|
144
|
+
|
|
145
|
+
We've deprecated `FormField` in [Main](#main). Please use
|
|
146
|
+
[`FormField`](https://workday.github.io/canvas-kit/?path=//docs/preview-inputs-form-field--basic) in
|
|
147
|
+
[Preivew](#preview) instead.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
### Label Text
|
|
152
|
+
|
|
153
|
+
**PR:** [#2455](https://github.com/Workday/canvas-kit/pull/2455)
|
|
154
|
+
|
|
155
|
+
We've deprecated `LabelText` in [Main](#main). Please use
|
|
156
|
+
[`FormField.Label`](https://workday.github.io/canvas-kit/?path=//docs/preview-inputs-form-field--basic)
|
|
157
|
+
in [Preview](#preview) in context of a `FormField` instead.
|
|
158
|
+
|
|
159
|
+
```tsx
|
|
160
|
+
//v10
|
|
161
|
+
|
|
162
|
+
<form>
|
|
163
|
+
<LabelText>Pizza</LabelText>
|
|
164
|
+
<input type="text" />
|
|
165
|
+
</form>;
|
|
166
|
+
|
|
167
|
+
//v11
|
|
168
|
+
|
|
169
|
+
<FormField>
|
|
170
|
+
<FormField.Label>First Name</FormField.Label>
|
|
171
|
+
<FormField.Input as={TextInput} value={value} onChange={e => console.log(e)} />
|
|
172
|
+
</FormField>;
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
If you still want to use a `label` element outside of the context of a form, you can use our `Text`
|
|
176
|
+
component instead.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
### Text Area Preview
|
|
181
|
+
|
|
182
|
+
**PR:** [#2472](https://github.com/Workday/canvas-kit/pull/2472)
|
|
183
|
+
|
|
184
|
+
We've deprecated `TextArea` from [Preview](#preview). Please use
|
|
185
|
+
[`FormField`](https://workday.github.io/canvas-kit/?path=//docs/preview-inputs-form-field--basic) in
|
|
186
|
+
[Preview](#preview) with `TextArea` in [Main](#main) instead.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
### Text Input Preview
|
|
191
|
+
|
|
192
|
+
**PR:** [#2472](https://github.com/Workday/canvas-kit/pull/2472)
|
|
193
|
+
|
|
194
|
+
We've deprecated `TextInput` from [Preview](#preview). Please use
|
|
195
|
+
[`FormField`](https://workday.github.io/canvas-kit/?path=//docs/preview-inputs-form-field--basic) in
|
|
196
|
+
[Preview](#preview) with `TextInput` in [Main](#main) instead.
|
|
197
|
+
|
|
198
|
+
The following model hooks have also been deprecated:
|
|
199
|
+
|
|
200
|
+
- `useTextInputModel`
|
|
201
|
+
- `useTextInputField`
|
|
202
|
+
|
|
203
|
+
## Removals
|
|
204
|
+
|
|
205
|
+
### Status Indicator (Preview) Utilities
|
|
206
|
+
|
|
207
|
+
**PR:** [#2472](https://github.com/Workday/canvas-kit/pull/2700)
|
|
208
|
+
|
|
209
|
+
As part of the styling refactor, we've removed the following exports that were primarily used to
|
|
210
|
+
style the component:
|
|
211
|
+
|
|
212
|
+
- `useStatusIndicatorModel`
|
|
213
|
+
- `useStatusIndicator`
|
|
214
|
+
- `statusIndicatorColors`
|
|
215
|
+
- `useStatusIndicatorIcon`.
|
|
216
|
+
|
|
217
|
+
**There should be no developer impact.**
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Component Style Updates
|
|
222
|
+
|
|
223
|
+
<StatusIndicator variant="red" emphasis="low">
|
|
224
|
+
<StatusIndicator.Label>Visual Breaking Change</StatusIndicator.Label>
|
|
225
|
+
</StatusIndicator>
|
|
226
|
+
|
|
227
|
+
**PR:** [#2485](https://github.com/Workday/canvas-kit/pull/2485)
|
|
228
|
+
|
|
229
|
+
The following changes address visual discrepancies between our design spec files and code. These
|
|
230
|
+
changes **should not** impact the layout or behavior of a component.
|
|
231
|
+
|
|
232
|
+
Components affected:
|
|
233
|
+
|
|
234
|
+
- `Checkbox`
|
|
235
|
+
- `DeleteButton`
|
|
236
|
+
- `Radio`
|
|
237
|
+
- `SecondaryButton`
|
|
238
|
+
- `StatusIndicator`
|
|
239
|
+
- `Switch`
|
|
240
|
+
- `Table`
|
|
241
|
+
- `TertiaryButton`
|
|
242
|
+
- `TextArea`
|
|
243
|
+
- `TextInput`
|
|
244
|
+
|
|
245
|
+
<Table>
|
|
246
|
+
<Table.Head>
|
|
247
|
+
<Table.Row>
|
|
248
|
+
<Table.Header scope="col">Component</Table.Header>
|
|
249
|
+
<Table.Header scope="col">Variant</Table.Header>
|
|
250
|
+
<Table.Header scope="col">psuedo Class</Table.Header>
|
|
251
|
+
<Table.Header scope="col">Property</Table.Header>
|
|
252
|
+
<Table.Header scope="col">v10 Value</Table.Header>
|
|
253
|
+
<Table.Header scope="col">v11 Value</Table.Header>
|
|
254
|
+
</Table.Row>
|
|
255
|
+
</Table.Head>
|
|
256
|
+
<Table.Body>
|
|
257
|
+
<Table.Row>
|
|
258
|
+
<Table.Cell>Checkbox</Table.Cell>
|
|
259
|
+
<Table.Cell />
|
|
260
|
+
<Table.Cell>disabled</Table.Cell>
|
|
261
|
+
<Table.Cell>borderColor</Table.Cell>
|
|
262
|
+
<Table.Cell>soap600</Table.Cell>
|
|
263
|
+
<Table.Cell >
|
|
264
|
+
licorice100
|
|
265
|
+
</Table.Cell>
|
|
266
|
+
</Table.Row>
|
|
267
|
+
<Table.Row>
|
|
268
|
+
<Table.Cell>Checkbox</Table.Cell>
|
|
269
|
+
<Table.Cell>Inverse</Table.Cell>
|
|
270
|
+
<Table.Cell>disabled</Table.Cell>
|
|
271
|
+
<Table.Cell>borderColor</Table.Cell>
|
|
272
|
+
<Table.Cell>soap600</Table.Cell>
|
|
273
|
+
<Table.Cell>
|
|
274
|
+
licorice100
|
|
275
|
+
</Table.Cell>
|
|
276
|
+
</Table.Row>
|
|
277
|
+
<Table.Row>
|
|
278
|
+
<Table.Cell>DeleteButton</Table.Cell>
|
|
279
|
+
<Table.Cell />
|
|
280
|
+
<Table.Cell>disabled</Table.Cell>
|
|
281
|
+
<Table.Cell>backgroundColor</Table.Cell>
|
|
282
|
+
<Table.Cell>error.light</Table.Cell>
|
|
283
|
+
<Table.Cell>error.base</Table.Cell>
|
|
284
|
+
</Table.Row>
|
|
285
|
+
<Table.Row>
|
|
286
|
+
<Table.Cell>DeleteButton</Table.Cell>
|
|
287
|
+
<Table.Cell />
|
|
288
|
+
<Table.Cell>disabled</Table.Cell>
|
|
289
|
+
<Table.Cell>opacity</Table.Cell>
|
|
290
|
+
<Table.Cell>1</Table.Cell>
|
|
291
|
+
<Table.Cell>0.4</Table.Cell>
|
|
292
|
+
</Table.Row>
|
|
293
|
+
<Table.Row>
|
|
294
|
+
<Table.Cell>Radio</Table.Cell>
|
|
295
|
+
<Table.Cell />
|
|
296
|
+
<Table.Cell>disabled</Table.Cell>
|
|
297
|
+
<Table.Cell>borderColor</Table.Cell>
|
|
298
|
+
<Table.Cell>soap600</Table.Cell>
|
|
299
|
+
<Table.Cell>
|
|
300
|
+
licorice100
|
|
301
|
+
</Table.Cell>
|
|
302
|
+
</Table.Row>
|
|
303
|
+
<Table.Row>
|
|
304
|
+
<Table.Cell>SecondaryButton</Table.Cell>
|
|
305
|
+
<Table.Cell>Inverse</Table.Cell>
|
|
306
|
+
<Table.Cell>focus</Table.Cell>
|
|
307
|
+
<Table.Cell>border</Table.Cell>
|
|
308
|
+
<Table.Cell>soap400</Table.Cell>
|
|
309
|
+
<Table.Cell>
|
|
310
|
+
transparent
|
|
311
|
+
</Table.Cell>
|
|
312
|
+
</Table.Row>
|
|
313
|
+
<Table.Row>
|
|
314
|
+
<Table.Cell>SecondaryButton</Table.Cell>
|
|
315
|
+
<Table.Cell>Inverse</Table.Cell>
|
|
316
|
+
<Table.Cell>focus</Table.Cell>
|
|
317
|
+
<Table.Cell>boxShdaow (Inner Color)</Table.Cell>
|
|
318
|
+
<Table.Cell>blackPepper500</Table.Cell>
|
|
319
|
+
<Table.Cell>
|
|
320
|
+
blackPepper400
|
|
321
|
+
</Table.Cell>
|
|
322
|
+
</Table.Row>
|
|
323
|
+
<Table.Row>
|
|
324
|
+
<Table.Cell>SecondaryButton</Table.Cell>
|
|
325
|
+
<Table.Cell>Inverse</Table.Cell>
|
|
326
|
+
<Table.Cell>focus</Table.Cell>
|
|
327
|
+
<Table.Cell>color</Table.Cell>
|
|
328
|
+
<Table.Cell>blackPepper500</Table.Cell>
|
|
329
|
+
<Table.Cell>
|
|
330
|
+
blackPepper400
|
|
331
|
+
</Table.Cell>
|
|
332
|
+
</Table.Row>
|
|
333
|
+
<Table.Row>
|
|
334
|
+
<Table.Cell>SecondaryButton (Icon)</Table.Cell>
|
|
335
|
+
<Table.Cell>Inverse</Table.Cell>
|
|
336
|
+
<Table.Cell>focus</Table.Cell>
|
|
337
|
+
<Table.Cell>fill</Table.Cell>
|
|
338
|
+
<Table.Cell>blackPepper500</Table.Cell>
|
|
339
|
+
<Table.Cell>
|
|
340
|
+
blackPepper400
|
|
341
|
+
</Table.Cell>
|
|
342
|
+
</Table.Row>
|
|
343
|
+
<Table.Row>
|
|
344
|
+
<Table.Cell>StatusIndicator (Preview)</Table.Cell>
|
|
345
|
+
<Table.Cell>transparent</Table.Cell>
|
|
346
|
+
<Table.Cell/>
|
|
347
|
+
<Table.Cell>backgroundColor</Table.Cell>
|
|
348
|
+
<Table.Cell>blackPepper600</Table.Cell>
|
|
349
|
+
<Table.Cell>
|
|
350
|
+
rgba(0,0,0,.84)
|
|
351
|
+
</Table.Cell>
|
|
352
|
+
</Table.Row>
|
|
353
|
+
<Table.Row>
|
|
354
|
+
<Table.Cell>StatusIndicator (Preview)</Table.Cell>
|
|
355
|
+
<Table.Cell>transparent</Table.Cell>
|
|
356
|
+
<Table.Cell/>
|
|
357
|
+
<Table.Cell>opacity</Table.Cell>
|
|
358
|
+
<Table.Cell >0.85</Table.Cell>
|
|
359
|
+
<Table.Cell>
|
|
360
|
+
Removed
|
|
361
|
+
</Table.Cell>
|
|
362
|
+
</Table.Row>
|
|
363
|
+
<Table.Row>
|
|
364
|
+
<Table.Cell>Switch</Table.Cell>
|
|
365
|
+
<Table.Cell>Checked and Disabled</Table.Cell>
|
|
366
|
+
<Table.Cell/>
|
|
367
|
+
<Table.Cell>backgroundColor, opacity</Table.Cell>
|
|
368
|
+
<Table.Cell>blueberry200</Table.Cell>
|
|
369
|
+
<Table.Cell>
|
|
370
|
+
backgroundColor: brand.primary.base
|
|
371
|
+
opacity: system.opacity.disabled
|
|
372
|
+
</Table.Cell>
|
|
373
|
+
</Table.Row>
|
|
374
|
+
<Table.Row>
|
|
375
|
+
<Table.Cell>Table (Header)</Table.Cell>
|
|
376
|
+
<Table.Cell />
|
|
377
|
+
<Table.Cell />
|
|
378
|
+
<Table.Cell>borderColor</Table.Cell>
|
|
379
|
+
<Table.Cell>soap400</Table.Cell>
|
|
380
|
+
<Table.Cell>soap500</Table.Cell>
|
|
381
|
+
</Table.Row>
|
|
382
|
+
<Table.Row>
|
|
383
|
+
<Table.Cell>TertiaryButton</Table.Cell>
|
|
384
|
+
<Table.Cell />
|
|
385
|
+
<Table.Cell>hover</Table.Cell>
|
|
386
|
+
<Table.Cell>backgroundColor</Table.Cell>
|
|
387
|
+
<Table.Cell>soap200</Table.Cell>
|
|
388
|
+
<Table.Cell>soap300</Table.Cell>
|
|
389
|
+
</Table.Row>
|
|
390
|
+
<Table.Row>
|
|
391
|
+
<Table.Cell>TertiaryButton</Table.Cell>
|
|
392
|
+
<Table.Cell />
|
|
393
|
+
<Table.Cell>active</Table.Cell>
|
|
394
|
+
<Table.Cell>backgroundColor</Table.Cell>
|
|
395
|
+
<Table.Cell>soap300</Table.Cell>
|
|
396
|
+
<Table.Cell>soap400</Table.Cell>
|
|
397
|
+
</Table.Row>
|
|
398
|
+
<Table.Row>
|
|
399
|
+
<Table.Cell>TertiaryButton</Table.Cell>
|
|
400
|
+
<Table.Cell />
|
|
401
|
+
<Table.Cell>active</Table.Cell>
|
|
402
|
+
<Table.Cell>color</Table.Cell>
|
|
403
|
+
<Table.Cell>primary.dark</Table.Cell>
|
|
404
|
+
<Table.Cell>primary.darkest</Table.Cell>
|
|
405
|
+
</Table.Row>
|
|
406
|
+
<Table.Row>
|
|
407
|
+
<Table.Cell>TertiaryButton</Table.Cell>
|
|
408
|
+
<Table.Cell />
|
|
409
|
+
<Table.Cell>disabled</Table.Cell>
|
|
410
|
+
<Table.Cell>borderColor</Table.Cell>
|
|
411
|
+
<Table.Cell backgroundColor="frenchVanilla100">frenchVanilla100</Table.Cell>
|
|
412
|
+
<Table.Cell cs={{backgroundColor: 'transparent'}}>transparent</Table.Cell>
|
|
413
|
+
</Table.Row>
|
|
414
|
+
<Table.Row>
|
|
415
|
+
<Table.Cell>TertiaryButton (Icon Only)</Table.Cell>
|
|
416
|
+
<Table.Cell />
|
|
417
|
+
<Table.Cell>focus</Table.Cell>
|
|
418
|
+
<Table.Cell>fill</Table.Cell>
|
|
419
|
+
<Table.Cell>blackPepper500</Table.Cell>
|
|
420
|
+
<Table.Cell>blackPepper400</Table.Cell>
|
|
421
|
+
</Table.Row>
|
|
422
|
+
<Table.Row>
|
|
423
|
+
<Table.Cell>TertiaryButton (Icon Only)</Table.Cell>
|
|
424
|
+
<Table.Cell />
|
|
425
|
+
<Table.Cell>hover</Table.Cell>
|
|
426
|
+
<Table.Cell>fill</Table.Cell>
|
|
427
|
+
<Table.Cell>blackPepper500</Table.Cell>
|
|
428
|
+
<Table.Cell>blackPepper400</Table.Cell>
|
|
429
|
+
</Table.Row>
|
|
430
|
+
<Table.Row>
|
|
431
|
+
<Table.Cell>TextArea</Table.Cell>
|
|
432
|
+
<Table.Cell />
|
|
433
|
+
<Table.Cell>disabled</Table.Cell>
|
|
434
|
+
<Table.Cell>borderColor</Table.Cell>
|
|
435
|
+
<Table.Cell>soap600</Table.Cell>
|
|
436
|
+
<Table.Cell>licorice100</Table.Cell>
|
|
437
|
+
</Table.Row>
|
|
438
|
+
<Table.Row>
|
|
439
|
+
<Table.Cell>TextInput</Table.Cell>
|
|
440
|
+
<Table.Cell />
|
|
441
|
+
<Table.Cell>disabled</Table.Cell>
|
|
442
|
+
<Table.Cell>borderColor</Table.Cell>
|
|
443
|
+
<Table.Cell>soap600</Table.Cell>
|
|
444
|
+
<Table.Cell>
|
|
445
|
+
licorice100
|
|
446
|
+
</Table.Cell>
|
|
447
|
+
</Table.Row>
|
|
448
|
+
|
|
449
|
+
</Table.Body>
|
|
450
|
+
|
|
451
|
+
</Table>
|
|
452
|
+
|
|
453
|
+
> **Note:** If you use a visual regression tool, you'll need to update your tests to match the new
|
|
454
|
+
> visual changes.
|
|
455
|
+
|
|
456
|
+
## Component Updates
|
|
457
|
+
|
|
458
|
+
### Styling API and CSS Tokens
|
|
459
|
+
|
|
460
|
+
**PRs:** [#2666](https://github.com/Workday/canvas-kit/pull/2666),
|
|
461
|
+
[#2471](https://github.com/Workday/canvas-kit/pull/2471),
|
|
462
|
+
[#2542](https://github.com/Workday/canvas-kit/pull/2542),
|
|
463
|
+
[#2570](https://github.com/Workday/canvas-kit/pull/2570),
|
|
464
|
+
[#2442](https://github.com/Workday/canvas-kit/pull/2442),
|
|
465
|
+
[#2472](https://github.com/Workday/canvas-kit/pull/2472),
|
|
466
|
+
[#2685](https://github.com/Workday/canvas-kit/pull/2685),
|
|
467
|
+
[#2615](https://github.com/Workday/canvas-kit/pull/2615),
|
|
468
|
+
[#2699](https://github.com/Workday/canvas-kit/pull/2699),
|
|
469
|
+
[#2546](https://github.com/Workday/canvas-kit/pull/2546),
|
|
470
|
+
[#2570](https://github.com/Workday/canvas-kit/pull/2570),
|
|
471
|
+
[#2620](https://github.com/Workday/canvas-kit/pull/2620),
|
|
472
|
+
[#2583](https://github.com/Workday/canvas-kit/pull/2583),
|
|
473
|
+
[#2567](https://github.com/Workday/canvas-kit/pull/2567),
|
|
474
|
+
[#2455](https://github.com/Workday/canvas-kit/pull/2455),
|
|
475
|
+
[#2709](https://github.com/Workday/canvas-kit/pull/2709)
|
|
476
|
+
|
|
477
|
+
Several components have been refactored to use our new
|
|
478
|
+
[Canvas Tokens](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs) and
|
|
479
|
+
[styling API](https://workday.github.io/canvas-kit/?path=/docs/styling-basics--create-modifiers#createstyles-api).
|
|
480
|
+
The React interface **has not changed**, but CSS variables are now used for dynamic properties.
|
|
481
|
+
|
|
482
|
+
The following components are affected:
|
|
483
|
+
|
|
484
|
+
- `AccentIcon`
|
|
485
|
+
- `AppletIcon`
|
|
486
|
+
- `Card`
|
|
487
|
+
- `CheckBox`
|
|
488
|
+
- `Combobox`
|
|
489
|
+
- `CountBadge`
|
|
490
|
+
- `FormField (Preview)`
|
|
491
|
+
- `DeleteButton`
|
|
492
|
+
- `Graphic`
|
|
493
|
+
- `LoadingDots`
|
|
494
|
+
- `PrimaryButton`
|
|
495
|
+
- `SecondaryButton`
|
|
496
|
+
- `Radio (Preview)`
|
|
497
|
+
- `Select`
|
|
498
|
+
- `StatusIndicator`
|
|
499
|
+
- `Svg`
|
|
500
|
+
- `Switch`
|
|
501
|
+
- `SystemIconCircle`
|
|
502
|
+
- `SystemIcon`
|
|
503
|
+
- `Table`
|
|
504
|
+
- `TertiaryButton`
|
|
505
|
+
- `Text`
|
|
506
|
+
|
|
507
|
+
> **Note:** These components also support our new `cs` prop for styling. Learn more about styling
|
|
508
|
+
> with `cs` in our
|
|
509
|
+
> [documentation](https://workday.github.io/canvas-kit/?path=/docs/styling-basics--cs-prop).
|
|
510
|
+
|
|
511
|
+
### Count Badge
|
|
512
|
+
|
|
513
|
+
<StatusIndicator variant="red" emphasis="low">
|
|
514
|
+
<StatusIndicator.Label>Breaking Change</StatusIndicator.Label>
|
|
515
|
+
</StatusIndicator>
|
|
516
|
+
|
|
517
|
+
**PR:** [#2709](https://github.com/Workday/canvas-kit/pull/2709)
|
|
518
|
+
|
|
519
|
+
- `default` has been removed from the `variant` type and is now the default for styles.
|
|
520
|
+
|
|
521
|
+
We also removed the `default` variant and consolidated those styles into the badge's base styles.
|
|
522
|
+
This will not be a breaking change for most users. However, if you have a `CountBadge` with an
|
|
523
|
+
explicit `default` variant, you'll see a TypeScript error. To resolve this, simply remove the
|
|
524
|
+
variant prop.
|
|
525
|
+
|
|
526
|
+
```tsx
|
|
527
|
+
// Before (v10)
|
|
528
|
+
<CountBadge variant="default" count={10} />
|
|
529
|
+
|
|
530
|
+
// After (v11)
|
|
531
|
+
<CountBadge count={10} />
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
### Form Field (Preview)
|
|
535
|
+
|
|
536
|
+
<div style={{display: 'inline-flex', gap: '.5rem'}}>
|
|
537
|
+
<StatusIndicator variant="red" emphasis="low">
|
|
538
|
+
<StatusIndicator.Label>Breaking Change</StatusIndicator.Label>
|
|
539
|
+
</StatusIndicator>
|
|
540
|
+
<StatusIndicator variant="green" emphasis="low">
|
|
541
|
+
<StatusIndicator.Label>🤖 Codemod Available</StatusIndicator.Label>
|
|
542
|
+
</StatusIndicator>
|
|
543
|
+
</div>
|
|
544
|
+
|
|
545
|
+
**PR:** [#2472](https://github.com/Workday/canvas-kit/pull/2472)
|
|
546
|
+
[#2746](https://github.com/Workday/canvas-kit/pull/274)
|
|
547
|
+
|
|
548
|
+
`FormField` in [Preview](#preview) is a compound component and we intend to promote it in a future
|
|
549
|
+
version to replace the `FormField` in [Main](#main). Because of this, we've refactored how errors
|
|
550
|
+
are applied to `FormField` in [Preview](#preview) in order to match the API from the `FormField` in
|
|
551
|
+
[Main](#main).
|
|
552
|
+
|
|
553
|
+
- `hasError` prop has been renamed to `error`. **This is a breaking change**
|
|
554
|
+
- `error` accepts `"error" | "alert" | ""` instead of a boolean value.
|
|
555
|
+
- `orientation` prop defaults to `vertical` and is no longer required.
|
|
556
|
+
- `FormField.Input` can be used by any of our inputs including `Select`, `TextInput`, `TextArea`,
|
|
557
|
+
`RadioGroup`, `Switch` and `Checkbox`.
|
|
558
|
+
- `FormField` does **not** support the `useFieldSet` prop that the `FormField` in [Main](#main)
|
|
559
|
+
does. In order to achieve the same behavior, set the `as` prop on the `FormField` element to
|
|
560
|
+
`fieldset` and the `as` prop of `FormField.Label` to `legend`.
|
|
561
|
+
- The required asterisk is now a pseudo element. While the asterisk was never read out loud by
|
|
562
|
+
screen readers, Testing Library required it in the `*ByLabelText` query. `*ByRole` uses the w3c
|
|
563
|
+
[accessible name calculation specification](https://www.w3.org/TR/accname-1.2/), but
|
|
564
|
+
`*ByLabelText` uses
|
|
565
|
+
[textContent](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent). Additional
|
|
566
|
+
information: https://github.com/testing-library/dom-testing-library/issues/929
|
|
567
|
+
|
|
568
|
+
v10:
|
|
569
|
+
|
|
570
|
+
```ts
|
|
571
|
+
screen.getByLabelText('Email*'); // Email is a required field and asterisk is included in name
|
|
572
|
+
screen.getByRole('textbox', {name: 'Email'}); // correctly ignores the `*`
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
v11:
|
|
576
|
+
|
|
577
|
+
```ts
|
|
578
|
+
screen.getByLabelText('Email');
|
|
579
|
+
screen.getByRole('textbox', {name: 'Email'});
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
```tsx
|
|
583
|
+
// v10 FormField in Preview
|
|
584
|
+
|
|
585
|
+
<FormField orientation="vertical" hasError={true}>
|
|
586
|
+
<FormField.Label>Password</FormField.Label>
|
|
587
|
+
<FormField.Input as={TextInput} type="password" value={value} onChange={handleChange} />
|
|
588
|
+
<FormField.Hint>Must Contain a number and a capital letter</FormField.Hint>
|
|
589
|
+
</FormField>;
|
|
590
|
+
|
|
591
|
+
// v11
|
|
592
|
+
|
|
593
|
+
<FormField error="error">
|
|
594
|
+
<FormField.Label>Password</FormField.Label>
|
|
595
|
+
<FormField.Container>
|
|
596
|
+
<FormField.Input as={TextInput} type="password" value={value} onChange={handleChange} />
|
|
597
|
+
<FormField.Hint>Must Contain a number and a capital letter</FormField.Hint>
|
|
598
|
+
</FormField.Container>
|
|
599
|
+
</FormField>;
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
🤖 The codemod will handle the change of `hasError` to `error` for you automatically. You may need
|
|
603
|
+
to check your logic to make sure it sets the appropaite value to the prop.
|
|
604
|
+
|
|
605
|
+
> **Note:** If you use your own custom `input` you will need to handle the styling for error and
|
|
606
|
+
> alert states.
|
|
607
|
+
|
|
608
|
+
### Icons
|
|
609
|
+
|
|
610
|
+
<div style={{display: 'inline-flex', gap: '.5rem'}}>
|
|
611
|
+
<StatusIndicator variant="red" emphasis="low">
|
|
612
|
+
<StatusIndicator.Label>Breaking Change</StatusIndicator.Label>
|
|
613
|
+
</StatusIndicator>
|
|
614
|
+
<StatusIndicator variant="green" emphasis="low">
|
|
615
|
+
<StatusIndicator.Label>🤖 Codemod Available</StatusIndicator.Label>
|
|
616
|
+
</StatusIndicator>
|
|
617
|
+
</div>
|
|
618
|
+
|
|
619
|
+
`styles` prop has been removed. If you still need to style an Icon component, please use the `cs`
|
|
620
|
+
prop.
|
|
621
|
+
|
|
622
|
+
> **Note:** Passing a token name to a style prop will not be supported in a future major version.
|
|
623
|
+
> Please use our
|
|
624
|
+
> [Canvas Tokens](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs)
|
|
625
|
+
> instead.
|
|
626
|
+
|
|
627
|
+
```tsx
|
|
628
|
+
// This will no longer be supported in a future major version
|
|
629
|
+
<SystemIcon color="blueberry400" />;
|
|
630
|
+
|
|
631
|
+
// Use new tokens instead.
|
|
632
|
+
|
|
633
|
+
<SystemIcon color={base.blueberry400} />;
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
🤖 The codemod will handle the change of renaming `styles` to `cs` for you automatically.
|
|
637
|
+
|
|
638
|
+
#### AccentIcon
|
|
639
|
+
|
|
640
|
+
- `AccentIconStyles` prop has been deprecated and will be merged with `AccentIconProps` in a future
|
|
641
|
+
version.
|
|
642
|
+
- `accentIconStyles` has been deprecated and will be removed in a future version as a part of
|
|
643
|
+
implementation of stencils and new tokens. Consider using `accentIconStencil` to get styles or
|
|
644
|
+
class name.
|
|
645
|
+
- `AccentIcon` supports `size` and `color` css variables, along with `size` and `color` props. Both
|
|
646
|
+
ways are supported:
|
|
647
|
+
|
|
648
|
+
```tsx
|
|
649
|
+
// set size or color by props
|
|
650
|
+
<AccentIcon color={base.blueberry100} size={24} />;
|
|
651
|
+
|
|
652
|
+
// set size or color by css vars
|
|
653
|
+
|
|
654
|
+
const MyComponent = StyledRadioButton('div')({
|
|
655
|
+
[accentIconStencil.vars.color]: base.berrySmoothie100,
|
|
656
|
+
[accentIconStencil.vars.size]: '2rem',
|
|
657
|
+
});
|
|
658
|
+
|
|
659
|
+
<MyComponent>
|
|
660
|
+
<AccentIcon icon={myIcon} />
|
|
661
|
+
</MyComponent>;
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
#### AppletIcon
|
|
665
|
+
|
|
666
|
+
- `AppletIconStyles` prop has been deprecated and will be merged with `AppletIconProps` in a future
|
|
667
|
+
version.
|
|
668
|
+
- `appletIconStyles` has been deprecated and will be removed in a future version as a part of
|
|
669
|
+
implementation of stencils and new tokens. Consider using `appletIconStencil` to get styles or
|
|
670
|
+
class name.
|
|
671
|
+
- `AppletIcon` supports `size`, `color200`, `color300`, `color400` and `color500` css variables,
|
|
672
|
+
along with `size` and `color` props. Both ways are supported:
|
|
673
|
+
|
|
674
|
+
```tsx
|
|
675
|
+
// set size or color by props
|
|
676
|
+
<AppletIcon color="blueberry" size={240} />;
|
|
677
|
+
|
|
678
|
+
// set size or color by css vars
|
|
679
|
+
|
|
680
|
+
const MyComponent = StyledRadioButton('div')({
|
|
681
|
+
[appletIconStencil.vars.size]: '2rem',
|
|
682
|
+
[appletIconStencil.vars.color200]: base.berrySmoothie200,
|
|
683
|
+
[appletIconStencil.vars.color300]: base.berrySmoothie300,
|
|
684
|
+
[appletIconStencil.vars.color400]: base.berrySmoothie400,
|
|
685
|
+
[appletIconStencil.vars.color500]: base.berrySmoothie500,
|
|
686
|
+
});
|
|
687
|
+
|
|
688
|
+
<MyComponent>
|
|
689
|
+
<AppletIcon icon={myIcon} />
|
|
690
|
+
</MyComponent>;
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
#### Graphic
|
|
694
|
+
|
|
695
|
+
- `GraphicStyles` prop has been deprecated and will be merged with `GraphicProps` in a future
|
|
696
|
+
version.
|
|
697
|
+
- `graphicStyles` has been deprecated and will be removed in a future version as a part of
|
|
698
|
+
implementation of stencils and new tokens. Consider using `graphicStencil` to get styles or class
|
|
699
|
+
name.
|
|
700
|
+
|
|
701
|
+
#### Icon
|
|
702
|
+
|
|
703
|
+
This change only impacts internal Canvas Kit code. `Icon` component has been removed and is no
|
|
704
|
+
longer used to build our icons. It has been replaced by our `Svg` component. Most of our icons now
|
|
705
|
+
extend styles from `svgStencil`.
|
|
706
|
+
|
|
707
|
+
#### SystemIcon
|
|
708
|
+
|
|
709
|
+
- `SystemIconStyles` has been deprecated and will be removed in a future version as a part of
|
|
710
|
+
implementation of stencils and new tokens. Consider using `systemIconStencil` to get styles or
|
|
711
|
+
class name.
|
|
712
|
+
|
|
713
|
+
- `accentHover` is deprecated and will be removed in a future version. Please use the following when
|
|
714
|
+
overriding styles:
|
|
715
|
+
|
|
716
|
+
```tsx
|
|
717
|
+
'&:hover': {
|
|
718
|
+
[systemIconStencil.vars.accent]: desiredAccentHoverColor
|
|
719
|
+
}
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
- `backgroundHover` is deprecated and will be removed in a future version. Please use the following
|
|
723
|
+
when overriding styles:
|
|
724
|
+
|
|
725
|
+
```tsx
|
|
726
|
+
'&:hover': {
|
|
727
|
+
[systemIconStencil.vars.background]: desiredBackgroundHoverColor
|
|
728
|
+
}
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
- `fillHover` is deprecated and will be removed in a future version. Please use the following when
|
|
732
|
+
overriding styles:
|
|
733
|
+
|
|
734
|
+
```tsx
|
|
735
|
+
'&:hover': {
|
|
736
|
+
[systemIconStencil.vars.fill]: desiredFillHoverColor
|
|
737
|
+
}
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
- `fill` is deprecated and will be removed in a future version. Please use `color` and specify
|
|
741
|
+
`accent` color if you want `accent` to be different from `color`.
|
|
742
|
+
|
|
743
|
+
```tsx
|
|
744
|
+
'&:hover': {
|
|
745
|
+
[systemIconStencil.vars.fill]: desiredFillHoverColor
|
|
746
|
+
}
|
|
747
|
+
```
|
|
748
|
+
|
|
749
|
+
- `systemIconStyles` has been deprecated and will be removed in a future version as a part of
|
|
750
|
+
implementation of stencils and new tokens. Consider using `systemIconStencil` to get styles or
|
|
751
|
+
class name.
|
|
752
|
+
|
|
753
|
+
- `SystemIcon` supports `size`, `color`, `accentColor` and `background` css variables, along with
|
|
754
|
+
props. Both ways are supported:
|
|
755
|
+
|
|
756
|
+
```tsx
|
|
757
|
+
// set size or color by props
|
|
758
|
+
<SystemIcon color={base.blueberry100} size={24} />;
|
|
759
|
+
|
|
760
|
+
// set size or color by css vars
|
|
761
|
+
|
|
762
|
+
const MyComponent = StyledRadioButton('div')({
|
|
763
|
+
[accentIconStencil.vars.size]: '2rem',
|
|
764
|
+
[systemIconStencil.vars.color]: base.berrySmoothie400,
|
|
765
|
+
[systemIconStencil.vars.background]: base.frenchVanilla100,
|
|
766
|
+
// on hover:
|
|
767
|
+
'&:hover': {
|
|
768
|
+
[systemIconStencil.vars.color]: base.berrySmoothie500,
|
|
769
|
+
[systemIconStencil.vars.background]: 'transparent',
|
|
770
|
+
},
|
|
771
|
+
});
|
|
772
|
+
|
|
773
|
+
<MyComponent>
|
|
774
|
+
<SystemIcon icon={myIcon} />
|
|
775
|
+
</MyComponent>;
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
### Status Indicator (Preview)
|
|
779
|
+
|
|
780
|
+
<StatusIndicator variant="red" emphasis="low">
|
|
781
|
+
<StatusIndicator.Label>Visual Breaking Change</StatusIndicator.Label>
|
|
782
|
+
</StatusIndicator>
|
|
783
|
+
|
|
784
|
+
**PR:** [#2620](https://github.com/Workday/canvas-kit/pull/2620)
|
|
785
|
+
|
|
786
|
+
The `transparent` variant now uses `system.color.bg.translucent` which is a background color of
|
|
787
|
+
black with an opacity of `0.84`.
|
|
788
|
+
|
|
789
|
+
**There should be no developer impact and the visual changes are safe to accept**.
|
|
790
|
+
|
|
791
|
+
### Switch
|
|
792
|
+
|
|
793
|
+
<StatusIndicator variant="red" emphasis="low">
|
|
794
|
+
<StatusIndicator.Label>Visual Breaking Change</StatusIndicator.Label>
|
|
795
|
+
</StatusIndicator>
|
|
796
|
+
|
|
797
|
+
**PR:** [#2583](https://github.com/Workday/canvas-kit/pull/2583)
|
|
798
|
+
|
|
799
|
+
Switch no longer uses `blueberry200` which was part of our theme object
|
|
800
|
+
`theme.palette.primary.light` for the background color to indicate a Switch that is checked and
|
|
801
|
+
disabled. Now, it uses `blueberry400` or `brand.base.primary` with an opacity of `0.4` for checked
|
|
802
|
+
and disabled.
|
|
803
|
+
|
|
804
|
+
**There should be no developer impact and the visual changes are safe to accept**.
|
|
805
|
+
|
|
806
|
+
### Table
|
|
807
|
+
|
|
808
|
+
**PR:** [#2600](https://github.com/Workday/canvas-kit/pull/2600)
|
|
809
|
+
|
|
810
|
+
<StatusIndicator variant="red" emphasis="low">
|
|
811
|
+
<StatusIndicator.Label>Breaking Change</StatusIndicator.Label>
|
|
812
|
+
</StatusIndicator>
|
|
813
|
+
|
|
814
|
+
We've promoted `Table` from [Preview](#preview) to [Main](#main). It replaces the `Table` that was
|
|
815
|
+
previously in [Main](#main) (for reference, see
|
|
816
|
+
[`Table`](https://d2krrudi3mmzzw.cloudfront.net/v9/?path=/story/components-containers-table--basic)
|
|
817
|
+
in [Main](#main) from v9).
|
|
818
|
+
|
|
819
|
+
`Table` is a
|
|
820
|
+
[compound component](https://workday.github.io/canvas-kit/?path=/docs/guides-compound-components--docs)
|
|
821
|
+
which provides a flexible API and access to its internals via its subcomponents.
|
|
822
|
+
|
|
823
|
+
> **Note**: `rowState` prop is no longer a part of the `Table` component.
|
|
824
|
+
|
|
825
|
+
In v10, the `Table` component in [Main](#main) only exposed a `Table` and `TableRow` component to
|
|
826
|
+
build tables.
|
|
827
|
+
|
|
828
|
+
In v11, `Table` now exposes every subcomponent of a semantic HTML
|
|
829
|
+
[Table](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table). While more verbose, it
|
|
830
|
+
provides more flexibility for customization.
|
|
831
|
+
|
|
832
|
+
```tsx
|
|
833
|
+
// v10
|
|
834
|
+
|
|
835
|
+
<Table>
|
|
836
|
+
<thead>
|
|
837
|
+
<TableRow header={true}>
|
|
838
|
+
<th>Header Text</th>
|
|
839
|
+
</TableRow>
|
|
840
|
+
</thead>
|
|
841
|
+
<tbody>
|
|
842
|
+
<TableRow>
|
|
843
|
+
<td>Cell Text</td>
|
|
844
|
+
</TableRow>
|
|
845
|
+
</tbody>
|
|
846
|
+
</Table>;
|
|
847
|
+
|
|
848
|
+
// v11
|
|
849
|
+
|
|
850
|
+
<Table>
|
|
851
|
+
<Table.Head>
|
|
852
|
+
<Table.Row>
|
|
853
|
+
<Table.Header>Header Text</Table.Header>
|
|
854
|
+
</Table.Row>
|
|
855
|
+
</Table.Head>
|
|
856
|
+
<Table.Body>
|
|
857
|
+
<Table.Row>
|
|
858
|
+
<Table.Cell>Cell Text</Table.Cell>
|
|
859
|
+
</Table.Row>
|
|
860
|
+
</Table.Body>
|
|
861
|
+
</Table>;
|
|
862
|
+
```
|
|
863
|
+
|
|
864
|
+
Please refer to the
|
|
865
|
+
[Table examples](https://workday.github.io/canvas-kit/?path=/story/components-containers-table--basic)
|
|
866
|
+
for how to implement new tables.
|
|
867
|
+
|
|
868
|
+
> **Note:** If you were using the [Preview](#preview) `Table` compound component, then you will need
|
|
869
|
+
> to update your import from `@workday/canvas-kit-preview-react/table` to
|
|
870
|
+
> `@workday/canvas-kit-react/table`. This change is **not** handled by the codemod.
|
|
871
|
+
|
|
872
|
+
### Text
|
|
873
|
+
|
|
874
|
+
**PR:** [#2455](https://github.com/Workday/canvas-kit/pull/2455)
|
|
875
|
+
|
|
876
|
+
- `Text` no longer extends the `Box` component, however, it still supports Emotion `styled` and
|
|
877
|
+
style props.
|
|
878
|
+
- Type level components: `Title`, `Heading`, `BodyText` and `Subtext` remain unchanged.
|
|
879
|
+
|
|
880
|
+
## Style Utility Updates
|
|
881
|
+
|
|
882
|
+
### `createStencil`
|
|
883
|
+
|
|
884
|
+
**PR:** [#2697](https://github.com/Workday/canvas-kit/pull/2697)
|
|
885
|
+
|
|
886
|
+
<StatusIndicator variant="red" emphasis="low">
|
|
887
|
+
<StatusIndicator.Label>Breaking Change</StatusIndicator.Label>
|
|
888
|
+
</StatusIndicator>
|
|
889
|
+
|
|
890
|
+
Stencils were updated to automatically add `box-sizing: border-box` to all stencils. If your stencil
|
|
891
|
+
did not add this style already, it may change the way `width` works for the component. Our intent is
|
|
892
|
+
to make all elements use border box layouts to make width calculations more predictable. This change
|
|
893
|
+
may change the way your component works if you use the `width` style property.
|
|
894
|
+
|
|
895
|
+
> **Note:** This is only a breaking change if you were using `createStencil` to apply margin and
|
|
896
|
+
> padding without box-sizing. For reference, view box-sizing
|
|
897
|
+
> [documentation](https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing).
|
|
898
|
+
|
|
899
|
+
## Troubleshooting
|
|
900
|
+
|
|
901
|
+
### My Styles Seem Broken?
|
|
902
|
+
|
|
903
|
+
Our components are reliant on our new Canvas Tokens Web package. Be sure you install
|
|
904
|
+
`@workday/canvas-tokens-web`. For more information, reference our
|
|
905
|
+
[Getting Started docs](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs)
|
|
906
|
+
for this package.
|
|
907
|
+
|
|
908
|
+
### Did You Upgrade All Canvas Kit Related Packages?
|
|
909
|
+
|
|
910
|
+
In order for all the packages to work in harmony, you must upgrade all Canvas Kit packages to the
|
|
911
|
+
same version that you're using, including:
|
|
912
|
+
|
|
913
|
+
- `@workday/canvas-kit-react`
|
|
914
|
+
- `@workday/canvas-kit-preview-react`
|
|
915
|
+
- `@workday/canvas-kit-labs-react`
|
|
916
|
+
- `@workday/canvas-kit-styling`
|
|
917
|
+
- `@workday/canvas-kit-react-fonts`
|
|
918
|
+
- `@workday/canvas-kit-docs`
|
|
919
|
+
|
|
920
|
+
## Glossary
|
|
921
|
+
|
|
922
|
+
### Main
|
|
923
|
+
|
|
924
|
+
Our Main package of Canvas Kit tokens, components, and utilities at `@workday/canvas-kit-react` has
|
|
925
|
+
undergone a full design and a11y review and is approved for use in product.
|
|
926
|
+
|
|
927
|
+
Breaking changes to code in Main will only occur during major version updates and will always be
|
|
928
|
+
communicated in advance and accompanied by migration strategies.
|
|
929
|
+
|
|
930
|
+
---
|
|
931
|
+
|
|
932
|
+
### Preview
|
|
933
|
+
|
|
934
|
+
Our Preview package of Canvas Kit tokens, components, and utilities at
|
|
935
|
+
`@workday/canvas-kit-preview-react` has undergone a full design and a11y review and is approved for
|
|
936
|
+
use in product, but may not be up to the high code standards upheld in the [Main](#main) package.
|
|
937
|
+
Preview is analagous to code in beta.
|
|
938
|
+
|
|
939
|
+
Breaking changes are unlikely, but possible, and can be deployed to Preview at any time without
|
|
940
|
+
triggering a major version update, though such changes will be communicated in advance and
|
|
941
|
+
accompanied by migration strategies.
|
|
942
|
+
|
|
943
|
+
Generally speaking, our goal is to eventually promote code from Preview to [Main](#main).
|
|
944
|
+
Occasionally, a component with the same name will exist in both [Main](#main) and Preview (for
|
|
945
|
+
example, see Segmented Control in [Preview](/components/buttons/segmented-control/) and
|
|
946
|
+
[Main](https://d2krrudi3mmzzw.cloudfront.net/v8/?path=/docs/components-buttons-segmented-control--basic)).
|
|
947
|
+
In these cases, Preview serves as a staging ground for an improved version of the component with a
|
|
948
|
+
different API. The component in [Main](#main) will eventually be replaced with the one in Preview.
|
|
949
|
+
|
|
950
|
+
---
|
|
951
|
+
|
|
952
|
+
### Labs
|
|
953
|
+
|
|
954
|
+
Our Labs package of Canvas Kit tokens, components, and utilities at `@workday/canvas-kit-labs-react`
|
|
955
|
+
has **not** undergone a full design and a11y review. Labs serves as an incubator space for new and
|
|
956
|
+
experimental code and is analagous to code in alpha.
|
|
957
|
+
|
|
958
|
+
Breaking changes can be deployed to Labs at any time without triggering a major version update and
|
|
959
|
+
may not be subject to the same rigor in communcation and migration strategies reserved for breaking
|
|
960
|
+
changes in [Preview](#preview) and [Main](#main).
|