@workday/canvas-kit-docs 14.0.0-alpha.1156-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 +6964 -3870
  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
@@ -0,0 +1,148 @@
1
+ import {AIIndicator, DownloadLLMFile} from '@workday/canvas-kit-docs';
2
+ import {StorybookInformationHighlight} from './StorybookInformationHighlight';
3
+
4
+
5
+ # Canvas Kit Token Migration Guide: Moving to `@workday/canvas-tokens-web`
6
+
7
+ Canvas Kit v10+ introduces a new token system that replaces the old JavaScript-based tokens from
8
+ `@workday/canvas-kit-react/tokens` with CSS variables from `@workday/canvas-tokens-web`.
9
+
10
+ ## Why Migrate?
11
+
12
+ - **Better Performance**: CSS variables eliminate the runtime cost of Emotion's dynamic styling
13
+ - **Enhanced Theming**: System and brand tokens provide semantic, themeable values
14
+ - **Cross-Platform Consistency**: Single source of truth for design tokens across web, iOS, and
15
+ Android
16
+ - **Future-Proofing**: Aligns with modern CSS capabilities and Canvas Kit's long-term direction
17
+
18
+ ## LLM Assisted Migration <AIIndicator />
19
+
20
+ We provide a **LLM migration mapping file** (`llm-token-migration.txt`) specifically designed for
21
+ use with LLM-based code assistants (such as [Cursor](https://www.cursor.so/) or similar tools). This
22
+ file is not intended for direct human reference or team documentation, but rather as structured
23
+ input for LLMs to automate and assist with your token migration process.
24
+
25
+ > The LLM migration file is regularly updated to reflect the latest token mappings and best
26
+ > practices.
27
+ > For more details, see other sections of this migration guide.
28
+
29
+ This file contains a comprehensive mapping of old Canvas Kit token usages to their new equivalents
30
+ in `@workday/canvas-tokens-web`, along with migration tips and examples and formatted for optimal
31
+ LLM consumption.
32
+
33
+ **How to use:**
34
+
35
+ - **View raw file**: Open the file in a new tab to see the complete migration mapping
36
+ - **Download as txt**: Save the file locally to upload or paste into your LLM/code assistant
37
+ - **Use with LLM**: Provide the raw content to your LLM/code assistant as context for automated
38
+ migration
39
+
40
+ <DownloadLLMFile
41
+ rawFileLink="https://raw.githubusercontent.com/Workday/canvas-kit/master/modules/docs/llm-txt/llm-token-migration.txt"
42
+ filename="llm-token-migration-13.2.0.txt"
43
+ />
44
+
45
+ ## Core Principles
46
+
47
+ ### Token Hierarchy
48
+
49
+ The new token system is organized into three categories:
50
+
51
+ - **Base Tokens**: Fundamental values (colors, measurements) - use sparingly
52
+ - **System Tokens**: Semantic, themeable values - **use these in most cases**
53
+ - **Brand Tokens**: Tenant/brand-specific customization values
54
+
55
+ ### CSS Variables Requirement
56
+
57
+ Unlike the old JavaScript tokens, the new tokens are CSS variables that must be wrapped in `var()`
58
+ for the browser to understand them.
59
+
60
+ **The Fundamental Change**: Raw (hex, px, etc) values → CSS variables wrapped in `var()`
61
+
62
+ ```javascript
63
+ // Old approach - Raw values
64
+ import {space} from '@workday/canvas-kit-react/tokens';
65
+ // padding: '1rem'
66
+ const styles = {padding: space.s};
67
+
68
+ // New approach - CSS variables with var()
69
+ import {system} from '@workday/canvas-tokens-web';
70
+ // padding: 'var(--cnvs-sys-space-x4)'
71
+ const styles = {padding: `var(${system.space.x4})`};
72
+
73
+ // New approach - Using cssVar utility (recommended) and fallback
74
+ import {cssVar} from '@workday/canvas-kit-styling';
75
+ // padding: 'var(--cnvs-sys-space-x4, 1rem)'
76
+ const styles = {padding: cssVar(system.space.x4, '1rem')};
77
+ ```
78
+
79
+ ### Styling Utilities
80
+
81
+ Canvas Kit provides styling utilities such as `createStyles`, `createStencil`, `cssVar`, and calc
82
+ functions to handle CSS variable syntax automatically.
83
+
84
+ <StorybookInformationHighlight
85
+ title="Why use styling utilities?"
86
+ description="Styling utilities automatically wrap tokens in <code>var()</code> and provide fallbacks for better browser support. They also ensure consistent token usage across your components."
87
+ link="/?path=/docs/styling-getting-started-overview--docs"
88
+ linkText="Learn more about styling utilities"
89
+ />
90
+
91
+ ## Best Practices
92
+
93
+ <br />
94
+
95
+ ### Prefer System Tokens
96
+
97
+ Use system tokens over base tokens whenever possible for better theming support:
98
+
99
+ ```javascript
100
+ // Good - Semantic and themeable
101
+ backgroundColor: system.color.bg.default;
102
+
103
+ // Avoid - Hard-coded base value
104
+ backgroundColor: base.frenchVanilla100;
105
+ ```
106
+
107
+ ### Use Complete Type Levels
108
+
109
+ Instead of mixing individual type properties, use complete type level tokens:
110
+
111
+ ```javascript
112
+ // Good - Consistent type styling
113
+ ...system.type.body.medium
114
+
115
+ // Avoid - Mixing individual properties
116
+ fontSize: system.fontSize.body.medium,
117
+ fontWeight: system.fontWeight.regular,
118
+ lineHeight: '1.5'
119
+ ```
120
+
121
+ ### Leverage Styling Utilities
122
+
123
+ Always use `createStyles` and `cssVar` for proper CSS variable handling:
124
+
125
+ ```javascript
126
+ // Good - Proper CSS variable wrapping
127
+ const styles = createStyles({
128
+ padding: system.space.x4,
129
+ });
130
+
131
+ // Avoid - Manual CSS variable handling
132
+ const styles = {
133
+ padding: `var(${system.space.x4})`,
134
+ };
135
+ ```
136
+
137
+ ### Convert Pixel Values
138
+
139
+ Use `px2rem` for pixel-based values to maintain consistency:
140
+
141
+ ```javascript
142
+ import {px2rem} from '@workday/canvas-kit-styling';
143
+
144
+ const styles = createStyles({
145
+ border: `solid ${px2rem(1)}`,
146
+ borderColor: system.color.border.container,
147
+ });
148
+ ```
package/index.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export {AIIndicator} from './lib/AIIndicator';
2
+ export {DownloadLLMFile} from './lib/DownloadLLMFile';
1
3
  export {ExampleCodeBlock} from './lib/ExampleCodeBlock';
2
4
  export * from './lib/specs';
3
5
  export * from './lib/Specifications';
@@ -0,0 +1,22 @@
1
+ import {StatusIndicator} from '@workday/canvas-kit-preview-react/status-indicator';
2
+ import {system} from '@workday/canvas-tokens-web';
3
+ import {sparkleSingleSmallIcon} from '@workday/canvas-system-icons-web';
4
+ import {systemIconStencil} from '@workday/canvas-kit-react/icon';
5
+
6
+ export const AIIndicator = () => {
7
+ return (
8
+ <>
9
+ <StatusIndicator
10
+ className="sb-unstyled indicator"
11
+ cs={{
12
+ background: system.color.bg.ai.default,
13
+ color: system.color.fg.ai,
14
+ [systemIconStencil.vars.color]: system.color.fg.ai,
15
+ }}
16
+ >
17
+ <StatusIndicator.Icon icon={sparkleSingleSmallIcon} />
18
+ <StatusIndicator.Label>AI Content</StatusIndicator.Label>
19
+ </StatusIndicator>
20
+ </>
21
+ );
22
+ };
@@ -0,0 +1,69 @@
1
+ import {Card} from '@workday/canvas-kit-react/card';
2
+ import {ExternalHyperlink, SecondaryButton} from '@workday/canvas-kit-react/button';
3
+ import {downloadIcon, fileIcon} from '@workday/canvas-system-icons-web';
4
+ import {SystemIcon} from '@workday/canvas-kit-react';
5
+ import {createStencil} from '@workday/canvas-kit-styling';
6
+ import {system} from '@workday/canvas-tokens-web';
7
+
8
+ type DownloadLLMFileProps = {
9
+ rawFileLink: string;
10
+ filename: string;
11
+ };
12
+
13
+ const flexBlock = createStencil({
14
+ vars: {
15
+ gap: system.space.x1,
16
+ },
17
+ base: ({gap}) => ({
18
+ display: 'flex',
19
+ alignItems: 'center',
20
+ gap,
21
+ code: {
22
+ fontFamily: system.fontFamily.mono,
23
+ padding: system.space.x1,
24
+ paddingInline: system.space.x2,
25
+ backgroundColor: system.color.bg.alt.softer,
26
+ borderRadius: system.shape.half,
27
+ },
28
+ }),
29
+ });
30
+
31
+ export const DownloadLLMFile = ({rawFileLink, filename}: DownloadLLMFileProps) => {
32
+ const handleDownload = async () => {
33
+ try {
34
+ const response = await fetch(rawFileLink);
35
+ const content = await response.text();
36
+
37
+ const blob = new Blob([content], {type: 'text/plain'});
38
+ const url = URL.createObjectURL(blob);
39
+
40
+ const link = document.createElement('a');
41
+ link.href = url;
42
+ link.download = filename;
43
+ document.body.appendChild(link);
44
+ link.click();
45
+ document.body.removeChild(link);
46
+
47
+ URL.revokeObjectURL(url);
48
+ } catch (error) {
49
+ console.error('Failed to download file:', error);
50
+ }
51
+ };
52
+
53
+ return (
54
+ <Card className="sb-unstyled" cs={{boxShadow: 'none', borderStyle: 'dashed'}}>
55
+ <Card.Body cs={{display: 'grid', gridTemplateColumns: '1fr auto', alignItems: 'center'}}>
56
+ <div {...flexBlock()}>
57
+ <SystemIcon icon={fileIcon} />
58
+ <code>{filename}</code>
59
+ </div>
60
+ <div {...flexBlock({gap: system.space.x4})}>
61
+ <ExternalHyperlink href={rawFileLink}>See raw file</ExternalHyperlink>
62
+ <SecondaryButton icon={downloadIcon} size="small" onClick={handleDownload}>
63
+ Download LLM File
64
+ </SecondaryButton>
65
+ </div>
66
+ </Card.Body>
67
+ </Card>
68
+ );
69
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-docs",
3
- "version": "14.0.0-alpha.1156-next.0",
3
+ "version": "14.0.0-alpha.1162-next.0",
4
4
  "description": "Documentation components of Canvas Kit components",
5
5
  "author": "Workday, Inc. (https://www.workday.com)",
6
6
  "license": "Apache-2.0",
@@ -45,11 +45,11 @@
45
45
  "@emotion/styled": "^11.6.0",
46
46
  "@stackblitz/sdk": "^1.11.0",
47
47
  "@storybook/csf": "0.0.1",
48
- "@workday/canvas-kit-labs-react": "^14.0.0-alpha.1156-next.0",
49
- "@workday/canvas-kit-preview-react": "^14.0.0-alpha.1156-next.0",
50
- "@workday/canvas-kit-react": "^14.0.0-alpha.1156-next.0",
51
- "@workday/canvas-kit-styling": "^14.0.0-alpha.1156-next.0",
52
- "@workday/canvas-system-icons-web": "^3.0.0",
48
+ "@workday/canvas-kit-labs-react": "^14.0.0-alpha.1162-next.0",
49
+ "@workday/canvas-kit-preview-react": "^14.0.0-alpha.1162-next.0",
50
+ "@workday/canvas-kit-react": "^14.0.0-alpha.1162-next.0",
51
+ "@workday/canvas-kit-styling": "^14.0.0-alpha.1162-next.0",
52
+ "@workday/canvas-system-icons-web": "^3.0.35",
53
53
  "@workday/canvas-tokens-web": "3.0.0-alpha.5",
54
54
  "markdown-to-jsx": "^7.2.0",
55
55
  "react-syntax-highlighter": "^15.5.0",
@@ -61,5 +61,5 @@
61
61
  "mkdirp": "^1.0.3",
62
62
  "typescript": "5.0"
63
63
  },
64
- "gitHead": "e5711be8fa7794a67a880925c1b582a1abbcfbf6"
64
+ "gitHead": "542377d8b4fcaf4fa3f40e4ef6ef66a8524e8de9"
65
65
  }