@workday/canvas-kit-docs 14.0.0-alpha.1153-next.0 → 14.0.0-alpha.1162-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.
Files changed (30) hide show
  1. package/dist/es6/index.d.ts +2 -0
  2. package/dist/es6/index.d.ts.map +1 -1
  3. package/dist/es6/index.js +2 -0
  4. package/dist/es6/lib/AIIndicator.d.ts +2 -0
  5. package/dist/es6/lib/AIIndicator.d.ts.map +1 -0
  6. package/dist/es6/lib/AIIndicator.js +12 -0
  7. package/dist/es6/lib/DownloadLLMFile.d.ts +7 -0
  8. package/dist/es6/lib/DownloadLLMFile.d.ts.map +1 -0
  9. package/dist/es6/lib/DownloadLLMFile.js +45 -0
  10. package/dist/es6/lib/docs.js +7154 -3961
  11. package/dist/es6/lib/stackblitzFiles/packageJSONFile.js +5 -5
  12. package/dist/es6/lib/stackblitzFiles/packageJSONFile.ts +5 -5
  13. package/dist/es6/mdx/tokens/StorybookInformationHighlight/index.d.ts +2 -0
  14. package/dist/es6/mdx/tokens/StorybookInformationHighlight/index.d.ts.map +1 -0
  15. package/dist/es6/mdx/tokens/StorybookInformationHighlight/index.js +7 -0
  16. package/dist/mdx/labs-react/ai-assistant-ingress-button/AiAssistantIngressButton.mdx +35 -0
  17. package/dist/mdx/labs-react/ai-assistant-ingress-button/examples/Basic.tsx +16 -0
  18. package/dist/mdx/labs-react/ai-assistant-ingress-button/examples/Inverse.tsx +24 -0
  19. package/dist/mdx/react/tabs/examples/DynamicTabs.tsx +5 -2
  20. package/dist/mdx/react/tokens/Tokens.mdx +7 -6
  21. package/dist/mdx/tokens/TokenMigrationCodemod.mdx +217 -0
  22. package/dist/mdx/tokens/TokenMigrationFinal.mdx +201 -0
  23. package/dist/mdx/tokens/TokenMigrationInstall.mdx +130 -0
  24. package/dist/mdx/tokens/TokenMigrationMappingColors.mdx +230 -0
  25. package/dist/mdx/tokens/TokenMigrationMappingSystem.mdx +287 -0
  26. package/dist/mdx/tokens/TokenMigrationOverview.mdx +148 -0
  27. package/index.ts +2 -0
  28. package/lib/AIIndicator.tsx +22 -0
  29. package/lib/DownloadLLMFile.tsx +69 -0
  30. package/package.json +7 -7
@@ -18,11 +18,11 @@ export const packageJSONFile = `{
18
18
  "@emotion/react": "11.11.4",
19
19
  "@types/react": "18.2.60",
20
20
  "@types/react-dom": "18.2.19",
21
- "@workday/canvas-kit-labs-react": "13.1.5",
22
- "@workday/canvas-kit-preview-react": "13.1.5",
23
- "@workday/canvas-kit-react": "13.1.5",
24
- "@workday/canvas-kit-react-fonts": "^13.1.5",
25
- "@workday/canvas-kit-styling": "13.1.5",
21
+ "@workday/canvas-kit-labs-react": "13.2.0",
22
+ "@workday/canvas-kit-preview-react": "13.2.0",
23
+ "@workday/canvas-kit-react": "13.2.0",
24
+ "@workday/canvas-kit-react-fonts": "^13.2.0",
25
+ "@workday/canvas-kit-styling": "13.2.0",
26
26
  "@workday/canvas-system-icons-web": "3.0.22",
27
27
  "@workday/canvas-tokens-web": "2.0.0"
28
28
  },
@@ -18,11 +18,11 @@ export const packageJSONFile = `{
18
18
  "@emotion/react": "11.11.4",
19
19
  "@types/react": "18.2.60",
20
20
  "@types/react-dom": "18.2.19",
21
- "@workday/canvas-kit-labs-react": "13.1.5",
22
- "@workday/canvas-kit-preview-react": "13.1.5",
23
- "@workday/canvas-kit-react": "13.1.5",
24
- "@workday/canvas-kit-react-fonts": "^13.1.5",
25
- "@workday/canvas-kit-styling": "13.1.5",
21
+ "@workday/canvas-kit-labs-react": "13.2.0",
22
+ "@workday/canvas-kit-preview-react": "13.2.0",
23
+ "@workday/canvas-kit-react": "13.2.0",
24
+ "@workday/canvas-kit-react-fonts": "^13.2.0",
25
+ "@workday/canvas-kit-styling": "13.2.0",
26
26
  "@workday/canvas-system-icons-web": "3.0.22",
27
27
  "@workday/canvas-tokens-web": "2.0.0"
28
28
  },
@@ -0,0 +1,2 @@
1
+ export declare const StorybookInformationHighlight: ({ variant, emphasis, title, description, link, linkText, isExternal, }: any) => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../mdx/tokens/StorybookInformationHighlight/index.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,6BAA6B,2EAQvC,GAAG,4CAaL,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ExternalHyperlink } from '@workday/canvas-kit-react/button';
3
+ import { InformationHighlight } from '@workday/canvas-kit-preview-react/information-highlight';
4
+ import { Unstyled } from '@storybook/blocks';
5
+ export const StorybookInformationHighlight = ({ variant, emphasis, title, description, link, linkText, isExternal, }) => {
6
+ return (_jsx(Unstyled, { children: _jsxs(InformationHighlight, { variant: variant, emphasis: emphasis, children: [_jsx(InformationHighlight.Icon, {}), _jsx(InformationHighlight.Heading, { children: title }), _jsx(InformationHighlight.Body, { children: description }), _jsx(InformationHighlight.Link, { as: isExternal && ExternalHyperlink, href: link, children: linkText })] }) }));
7
+ };
@@ -0,0 +1,35 @@
1
+ import {SymbolDoc, Specifications, ExampleCodeBlock} from '@workday/canvas-kit-docs';
2
+
3
+ import {AiAssistantIngressButton} from '@workday/canvas-kit-labs-react/ai-assistant-ingress-button';
4
+ import Basic from './examples/Basic';
5
+ import Inverse from './examples/Inverse';
6
+
7
+ # AI Assistant Ingress Button
8
+
9
+ CTA to open and close AI assistant
10
+
11
+ ## Installation
12
+
13
+ ```sh
14
+ yarn add @workday/canvas-kit-labs-react
15
+ ```
16
+
17
+
18
+ ## Usage
19
+
20
+ ### Basic Example
21
+
22
+ You can click to toggle the AI assistant.
23
+
24
+ <ExampleCodeBlock code={Basic} />
25
+
26
+ ### Inverse Example
27
+
28
+ The Button can also be used on dark backgrounds.
29
+
30
+ <ExampleCodeBlock code={Inverse} />
31
+
32
+
33
+ ## Component API
34
+
35
+ <SymbolDoc name="AiAssistantIngressButton" hideDescription />
@@ -0,0 +1,16 @@
1
+ import {useState} from 'react';
2
+
3
+ import {AiAssistantIngressButton} from '@workday/canvas-kit-labs-react/ai-assistant-ingress-button';
4
+
5
+ export default () => {
6
+ const [toggled, setToggled] = useState(false);
7
+ return (
8
+ <div>
9
+ <AiAssistantIngressButton
10
+ aria-label={toggled ? 'Hide AI Assistant' : 'Show AI Assistant'}
11
+ onClick={() => setToggled(!toggled)}
12
+ toggled={toggled}
13
+ />
14
+ </div>
15
+ );
16
+ };
@@ -0,0 +1,24 @@
1
+ import {useState} from 'react';
2
+
3
+ import {AiAssistantIngressButton} from '@workday/canvas-kit-labs-react/ai-assistant-ingress-button';
4
+ import {createStyles} from '@workday/canvas-kit-styling';
5
+ import {system} from '@workday/canvas-tokens-web';
6
+
7
+ const darkBackground = createStyles({
8
+ background: system.color.bg.contrast.strong,
9
+ padding: system.space.x8,
10
+ });
11
+
12
+ export default () => {
13
+ const [toggled, setToggled] = useState(false);
14
+ return (
15
+ <div className={darkBackground}>
16
+ <AiAssistantIngressButton
17
+ variant="inverse"
18
+ onClick={() => setToggled(!toggled)}
19
+ aria-label={toggled ? 'Hide Assistant' : 'Show Assistant'}
20
+ toggled={toggled}
21
+ />
22
+ </div>
23
+ );
24
+ };
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
+ import {slugify} from '@workday/canvas-kit-react/common';
3
4
  import {isCursor} from '@workday/canvas-kit-react/collection';
4
5
  import {Tabs, useTabsModel} from '@workday/canvas-kit-react/tabs';
5
6
 
@@ -46,13 +47,15 @@ export default () => {
46
47
 
47
48
  // wait for stabilization of state
48
49
  requestAnimationFrame(() => {
49
- document.querySelector<HTMLElement>(`#${model.state.id}-${nextId}`)?.focus();
50
+ document
51
+ .querySelector<HTMLElement>(`[id="${slugify(`${model.state.id}-${nextId}`)}"]`)
52
+ ?.focus();
50
53
  });
51
54
  }
52
55
  };
53
56
 
54
57
  const onKeyDown = (id: string) => (e: React.KeyboardEvent<HTMLElement>) => {
55
- if (e.key === 'Delete' && id !== 'add') {
58
+ if ((e.key === 'Delete' || e.key === 'Backspace') && id !== 'add') {
56
59
  setTabs(tabs.filter(item => item.id !== id));
57
60
  const model = modelRef.current;
58
61
  removeItem(id, model);
@@ -5,15 +5,16 @@ import Overview from './examples/Overview';
5
5
 
6
6
  # Tokens
7
7
 
8
- <InformationHighlight>
8
+ <InformationHighlight variant="caution" className="sb-unstyled" cs={{p: {margin: 0}}}>
9
9
  <InformationHighlight.Icon />
10
- <InformationHighlight.Heading>New Tokens Package Available!</InformationHighlight.Heading>
10
+ <InformationHighlight.Heading>React tokens have been deprecated!</InformationHighlight.Heading>
11
11
  <InformationHighlight.Body>
12
- The tokens documented below are still available in Canvas Kit but are being replaced by our new
13
- Canvas Tokens Web package. We encourage you to begin moving to our new tokens.
12
+ The tokens documented below are deprecated and will be removed in a future release. You must
13
+ migrate to the new Canvas Tokens Web package to ensure continued support and access to the
14
+ latest tokens.
14
15
  </InformationHighlight.Body>
15
- <InformationHighlight.Link href="https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs">
16
- View the Docs
16
+ <InformationHighlight.Link href="/?path=/docs/guides-tokens-migration-overview--docs">
17
+ See migration guide
17
18
  </InformationHighlight.Link>
18
19
  </InformationHighlight>
19
20
 
@@ -0,0 +1,217 @@
1
+ # Canvas Kit Tokens Migration Codemod
2
+
3
+ This codemod helps migrate Canvas Kit tokens from `@workday/canvas-kit-react/tokens` to
4
+ `@workday/canvas-tokens-web` v2 format. It automatically transforms token usage in your codebase to
5
+ use the new token system.
6
+
7
+ ## Important Notes
8
+
9
+ - **Run on Small Batches**: We recommend running the codemod on a small number of files in batches
10
+ instead of your entire repository all at once. This makes the changes easier to review and allows
11
+ you to catch issues more quickly with less frustration. This allows for easier manual review of
12
+ the changes and helps catch any potential issues early.
13
+ - **Use System Tokens**: You should generally always opt to use system (semantic) tokens over base
14
+ tokens. This clarifies the token's intent, simplifies future updates to new tokens, and maintains
15
+ better consistency across your codebase.
16
+ - **Codemod Limitations**: The codemod does not cover every possible token usage or migration
17
+ scenario. Please review the codemod's changes and be prepared to update tokens as needed. Some
18
+ manual changes will be required, especially for:
19
+ - Custom or dynamic token usages
20
+ - Inline styles, string templates, or non-standard patterns
21
+ - Updating documentation, comments, or non-code files
22
+ - Ensuring correct semantic token choices for your specific use case
23
+
24
+ ## Required Dependencies
25
+
26
+ The codemod requires the following packages to be installed:
27
+
28
+ - `@workday/canvas-kit-styling`
29
+ - `@workday/canvas-tokens-web`. See
30
+ [instructions here](/docs/guides-tokens-migration-installation-setup--docs).
31
+
32
+ ## Installation
33
+
34
+ You can run the codemod using npx:
35
+
36
+ ```sh
37
+ npx @workday/canvas-tokens-codemod v2 [path]
38
+ ```
39
+
40
+ Or install the package and run it directly. But remember to uninstall the package after you have
41
+ completed the upgrade.
42
+
43
+ ```sh
44
+ yarn add @workday/canvas-tokens-codemod
45
+ canvas-tokens-codemod v2 [path]
46
+ ```
47
+
48
+ > Note: These codemods only work on .js, .jsx, .ts, and .tsx extensions. You may need to make some
49
+ > manual changes in other file types (.json, .mdx, .md, etc.).
50
+
51
+ > Note: You may need to run your linter after executing the codemod, as its resulting formatting
52
+ > (spacing, quotes, etc.) may not match your project's styling.
53
+
54
+ ## What This Codemod Does
55
+
56
+ The codemod transforms the following tokens:
57
+
58
+ - [Colors](#colors)
59
+ - [Depth](#depth)
60
+ - [Shape](#shape)
61
+ - [Space](#space)
62
+ - [Typography](#typography)
63
+
64
+ ### Colors
65
+
66
+ - Converts color tokens from `@workday/canvas-kit-react/tokens` to the new system
67
+ - Transforms color usage in `createStyles`, `createStencil`, and CSS objects
68
+ - Maps old color tokens to new semantic color tokens
69
+ - Adds required imports for `cssVar` and new token packages
70
+
71
+ #### Color Token Mappings to System
72
+
73
+ ##### Background Colors
74
+
75
+ | Old Token | New Token |
76
+ | ------------------------- | ----------------------------------- |
77
+ | `colors.frenchVanilla100` | `system.color.bg.default` |
78
+ | `colors.blueberry200` | `system.color.bg.primary.soft` |
79
+ | `colors.blueberry400` | `system.color.bg.primary.default` |
80
+ | `colors.blueberry500` | `system.color.bg.primary.strong` |
81
+ | `colors.blueberry600` | `system.color.bg.primary.stronger` |
82
+ | `colors.cantaloupe100` | `system.color.bg.caution.softer` |
83
+ | `colors.cantaloupe400` | `system.color.bg.caution.default` |
84
+ | `colors.cantaloupe500` | `system.color.bg.caution.strong` |
85
+ | `colors.cantaloupe600` | `system.color.bg.caution.stronger` |
86
+ | `colors.cinnamon100` | `system.color.bg.critical.softer` |
87
+ | `colors.cinnamon500` | `system.color.bg.critical.default` |
88
+ | `colors.cinnamon600` | `system.color.bg.critical.strong` |
89
+ | `colors.greenApple100` | `system.color.bg.positive.softer` |
90
+ | `colors.greenApple400` | `system.color.bg.positive.default` |
91
+ | `colors.greenApple500` | `system.color.bg.positive.strong` |
92
+ | `colors.greenApple600` | `system.color.bg.positive.stronger` |
93
+ | `colors.licorice100` | `system.color.bg.muted.softer` |
94
+ | `colors.licorice200` | `system.color.bg.muted.soft` |
95
+ | `colors.licorice300` | `system.color.bg.muted.default` |
96
+ | `colors.licorice500` | `system.color.bg.muted.strong` |
97
+ | `colors.soap100` | `system.color.bg.alt.softer` |
98
+ | `colors.soap200` | `system.color.bg.alt.soft` |
99
+ | `colors.soap300` | `system.color.bg.alt.default` |
100
+ | `colors.soap400` | `system.color.bg.alt.strong` |
101
+ | `colors.soap500` | `system.color.bg.alt.stronger` |
102
+ | `colors.blackPepper400` | `system.color.bg.contrast.default` |
103
+ | `colors.blackPepper500` | `system.color.bg.contrast.strong` |
104
+
105
+ ##### Foreground Colors
106
+
107
+ | Old Token | New Token |
108
+ | ------------------------- | ---------------------------------- |
109
+ | `colors.blackPepper300` | `system.color.fg.default` |
110
+ | `colors.blackPepper400` | `system.color.fg.strong` |
111
+ | `colors.blackPepper500` | `system.color.fg.stronger` |
112
+ | `colors.blueberry400` | `system.color.fg.primary.default` |
113
+ | `colors.blueberry500` | `system.color.fg.primary.strong` |
114
+ | `colors.cinnamon500` | `system.color.fg.critical.default` |
115
+ | `colors.frenchVanilla100` | `system.color.fg.inverse` |
116
+ | `colors.licorice100` | `system.color.fg.disabled` |
117
+ | `colors.licorice200` | `system.color.fg.muted.soft` |
118
+ | `colors.licorice300` | `system.color.fg.muted.default` |
119
+ | `colors.licorice400` | `system.color.fg.muted.strong` |
120
+ | `colors.licorice500` | `system.color.fg.muted.stronger` |
121
+
122
+ ##### Border Colors
123
+
124
+ | Old Token | New Token |
125
+ | ------------------------- | -------------------------------------- |
126
+ | `colors.blackPepper400` | `system.color.border.contrast.default` |
127
+ | `colors.blackPepper500` | `system.color.border.contrast.strong` |
128
+ | `colors.blueberry400` | `system.color.border.primary.default` |
129
+ | `colors.cantaloupe400` | `system.color.border.caution.default` |
130
+ | `colors.cantaloupe600` | `system.color.border.caution.strong` |
131
+ | `colors.cinnamon500` | `system.color.border.critical.default` |
132
+ | `colors.frenchVanilla100` | `system.color.border.inverse` |
133
+ | `colors.licorice100` | `system.color.border.input.disabled` |
134
+ | `colors.licorice200` | `system.color.border.input.default` |
135
+ | `colors.licorice500` | `system.color.border.input.strong` |
136
+ | `colors.soap300` | `system.color.border.input.inverse` |
137
+ | `colors.soap400` | `system.color.border.divider` |
138
+ | `colors.soap500` | `system.color.border.container` |
139
+
140
+ ##### Other Colors
141
+
142
+ | Old Token | New Token |
143
+ | ------------------------------ | ----------------------------------- |
144
+ | `colors.blackPepper600` | `system.color.static.black` |
145
+ | `colors.toastedMarshmallow600` | `system.color.static.gold.stronger` |
146
+
147
+ ### Depth
148
+
149
+ - Converts depth tokens to objects with `boxShadow` property
150
+ - Handles special case for depth[0] (converts to `boxShadow: "none"`)
151
+ - Transforms depth tokens in nested CSS selectors
152
+ - Handles depth tokens in component props
153
+
154
+ ### Shape
155
+
156
+ - Converts border radius tokens to
157
+ [new shape tokens](/docs/guides-tokens-migration-mapping-tables-system--docs#shape-border-radius-token-migration)
158
+ - Transforms `borderRadius.m` to `system.shape.x1`
159
+
160
+ ### Space
161
+
162
+ - Converts all space tokens to the new system tokens
163
+ - Maps old space values to
164
+ [a new scale](/docs/guides-tokens-migration-mapping-tables-system--docs#space)
165
+
166
+ ### Typography
167
+
168
+ - Converts font family tokens to
169
+ [new system tokens](docs/guides-tokens-migration-mapping-tables-system--docs#font-family)
170
+ - Transforms font size tokens to
171
+ [new system tokens](docs/guides-tokens-migration-mapping-tables-system--docs#font-size)
172
+ - Converts font weight tokens to
173
+ [new system tokens](docs/guides-tokens-migration-mapping-tables-system--docs#font-weight)
174
+ - Handles type levels and their properties
175
+ - Transforms typography in component styles
176
+
177
+ ## What to Expect
178
+
179
+ After running the codemod, your code will:
180
+
181
+ 1. Use the new token system with `cssVar` and system tokens
182
+ 2. Have updated imports for the new token packages
183
+ 3. Use semantic color tokens instead of direct color values
184
+ 4. Have consistent spacing and typography using the new scale
185
+
186
+ ## Example Transformations
187
+
188
+ ### Before
189
+
190
+ ```typescript
191
+ import {colors} from '@workday/canvas-kit-react/tokens';
192
+
193
+ const styles = createStyles({
194
+ background: colors.frenchVanilla100,
195
+ color: colors.blueberry400,
196
+ });
197
+ ```
198
+
199
+ ### After
200
+
201
+ ```typescript
202
+ import {cssVar} from '@workday/canvas-kit-styling';
203
+ import {base, system} from '@workday/canvas-tokens-web';
204
+
205
+ const styles = createStyles({
206
+ background: system.color.bg.default,
207
+ color: system.color.fg.primary.default,
208
+ });
209
+ ```
210
+
211
+ ## Summary
212
+
213
+ - The codemod handles various edge cases including aliased imports and nested CSS selectors
214
+ - It preserves existing code structure while updating token usage
215
+ - It adds necessary imports automatically
216
+ - It handles template literals and spread operators in CSS objects
217
+ - It maintains proper type safety through the transformation process
@@ -0,0 +1,201 @@
1
+ # Q&A and more
2
+
3
+ ## Common Pitfalls & Solutions
4
+
5
+ ### Forgetting CSS Variable Imports
6
+
7
+ **Problem**: Styles don't apply because CSS variables aren't defined. **Solution**: Ensure you've
8
+ imported the CSS variable files at your app's top level.
9
+
10
+ ### Not Using var() Wrapper
11
+
12
+ **Problem**: CSS properties don't work with raw token values. **Solution**: Use `createStyles` or
13
+ `cssVar` utility instead of direct token references.
14
+
15
+ ### Mixing Old and New Tokens
16
+
17
+ **Problem**: Inconsistent styling and potential conflicts. **Solution**: Migrate completely to new
18
+ tokens rather than mixing systems.
19
+
20
+ ### Using Base Tokens for Everything
21
+
22
+ **Problem**: Missing out on theming capabilities. **Solution**: Prefer system tokens for their
23
+ semantic meaning and theming support.
24
+
25
+ ## Incremental Migration Strategy
26
+
27
+ 1. **Start with New Projects**: Use new tokens for all new components and features
28
+ 2. **Component-by-Component**: Migrate existing components one at a time
29
+ 3. **Test Thoroughly**: Ensure visual consistency after each component migration
30
+ 4. **Update Style Patterns**: Migrate from style props to `createStyles` where needed
31
+ 5. **Consolidate Imports**: Remove old token imports once migration is complete
32
+
33
+ ## Complete Migration Examples
34
+
35
+ <br />
36
+
37
+ ### Example 1: Card Component Migration
38
+
39
+ #### Before (Old Tokens)
40
+
41
+ ```javascript
42
+ import {colors, space, borderRadius, type, depth} from '@workday/canvas-kit-react/tokens';
43
+ import {createStyles} from '@workday/canvas-kit-styling';
44
+
45
+ const cardStyles = createStyles({
46
+ padding: space.l,
47
+ backgroundColor: colors.frenchVanilla100,
48
+ borderColor: colors.soap500,
49
+ borderRadius: borderRadius.m,
50
+ color: colors.blackPepper300,
51
+ depth: 1,
52
+ ...type.levels.body.medium,
53
+ });
54
+
55
+ const headerStyles = createStyles({
56
+ color: colors.blackPepper500,
57
+ marginBottom: space.s,
58
+ ...type.levels.heading.small,
59
+ });
60
+
61
+ const errorTextStyles = createStyles({
62
+ color: colors.cinnamon500,
63
+ ...type.levels.subtext.large,
64
+ });
65
+ ```
66
+
67
+ #### After (New Tokens - Semantic System Approach)
68
+
69
+ ```javascript
70
+ import {createStyles, px2rem} from '@workday/canvas-kit-styling';
71
+ import {system} from '@workday/canvas-tokens-web';
72
+
73
+ const cardStyles = createStyles({
74
+ padding: system.space.x8,
75
+ backgroundColor: system.color.bg.default,
76
+ border: `solid ${px2rem(1)}`,
77
+ borderColor: system.color.border.container,
78
+ borderRadius: system.shape.x1,
79
+ color: system.color.text.default,
80
+ boxShadow: system.depth[1],
81
+ ...system.type.body.medium,
82
+ });
83
+
84
+ const headerStyles = createStyles({
85
+ color: system.color.text.default,
86
+ marginBottom: system.space.x4,
87
+ ...system.type.heading.small,
88
+ });
89
+
90
+ const errorTextStyles = createStyles({
91
+ color: system.color.text.critical.default,
92
+ ...system.type.subtext.large,
93
+ });
94
+ ```
95
+
96
+ ### Example 2: Form Input Migration
97
+
98
+ #### Before (Old Tokens)
99
+
100
+ ```javascript
101
+ import {colors, space, borderRadius} from '@workday/canvas-kit-react/tokens';
102
+
103
+ const inputStyles = createStyles({
104
+ padding: `${space.xs} ${space.s}`,
105
+ backgroundColor: colors.frenchVanilla100,
106
+ borderColor: colors.soap400,
107
+ borderRadius: borderRadius.s,
108
+ color: colors.blackPepper400,
109
+ '&:focus': {
110
+ borderColor: colors.blueberry400,
111
+ backgroundColor: colors.frenchVanilla100,
112
+ },
113
+ '&.error': {
114
+ borderColor: colors.cinnamon500,
115
+ backgroundColor: colors.cinnamon100,
116
+ },
117
+ '&:disabled': {
118
+ backgroundColor: colors.soap200,
119
+ color: colors.soap600,
120
+ },
121
+ });
122
+ ```
123
+
124
+ #### After (New Tokens - System Approach)
125
+
126
+ ```javascript
127
+ import {system} from '@workday/canvas-tokens-web';
128
+
129
+ const inputStyles = createStyles({
130
+ padding: `${system.space.x3} ${system.space.x4}`,
131
+ backgroundColor: system.color.bg.default,
132
+ borderColor: system.color.border.default,
133
+ borderRadius: system.shape.half,
134
+ color: system.color.text.default,
135
+ '&:focus': {
136
+ borderColor: system.color.border.contrast,
137
+ backgroundColor: system.color.bg.default,
138
+ },
139
+ '&.error': {
140
+ borderColor: system.color.border.critical.default,
141
+ backgroundColor: system.color.bg.critical.subtle,
142
+ },
143
+ '&:disabled': {
144
+ backgroundColor: system.color.bg.disabled,
145
+ color: system.color.text.disabled,
146
+ },
147
+ });
148
+ ```
149
+
150
+ ### Example 3: Button Migration with Brand Colors
151
+
152
+ #### Before (Old Tokens)
153
+
154
+ ```javascript
155
+ import {colors, space, borderRadius} from '@workday/canvas-kit-react/tokens';
156
+ import {theme} from '@emotion/react';
157
+
158
+ const primaryButtonStyles = createStyles({
159
+ padding: `${space.xs} ${space.m}`,
160
+ backgroundColor: theme.canvas.palette.primary.main,
161
+ borderColor: theme.canvas.palette.primary.main,
162
+ borderRadius: borderRadius.m,
163
+ color: theme.canvas.palette.primary.contrast,
164
+ '&:hover': {
165
+ backgroundColor: theme.canvas.palette.primary.dark,
166
+ },
167
+ });
168
+ ```
169
+
170
+ #### After (New Tokens - Brand + System)
171
+
172
+ ```javascript
173
+ import {system, brand} from '@workday/canvas-tokens-web';
174
+
175
+ const primaryButtonStyles = createStyles({
176
+ padding: `${system.space.x3} ${system.space.x6}`,
177
+ backgroundColor: brand.primary.base,
178
+ borderColor: brand.primary.base,
179
+ borderRadius: system.shape.x1,
180
+ color: brand.primary.accent,
181
+ '&:hover': {
182
+ backgroundColor: brand.primary.dark,
183
+ },
184
+ });
185
+ ```
186
+
187
+ ## Next Steps
188
+
189
+ After completing the token migration:
190
+
191
+ - Review your components for consistent use of system tokens
192
+ - Consider implementing theming if not already in place
193
+ - Update your team's coding standards to reflect new token usage
194
+ - Monitor for any visual regressions and address them promptly
195
+
196
+ ## Resources
197
+
198
+ - [Canvas Tokens Documentation](https://canvas.workday.com/styles/tokens/)
199
+ - [Canvas Kit Styling Documentation](https://workday.github.io/canvas-kit/?path=/docs/features-styling-welcome--page)
200
+ - [Token Migration Discussion](https://github.com/Workday/canvas-tokens/discussions/77)
201
+ - [Canvas Kit GitHub Repository](https://github.com/Workday/canvas-kit)