Canvas Kit 14.0 Upgrade Guide This guide contains an overview of the changes in Canvas Kit v14. Why You Should Upgrade v14.0 Introduces Workday’s new brand direction which includes a new color palette and with it, some styling updates to our components. Note: While v14 does not require an upgrade to our v3 tokens, we strongly advise to upgrade to the latest to ensure proper branding. Table of contents - Codemod - Instructions - Tokens - Caution Naming - Theming - Canvas Provider - Component Updates - Avatar Preview - Branding Changes - Buttons - Card - Count Badge - Expandable - Hyperlink and ExternalHyperlink - Loading Dots - Pill - SearchForm - Status Indicator (Preview) - Deprecations - Avatar in Main - Combobox (Labs) - Radio (Main) - SearchForm (Labs) - Segmented Control (Main) - Side Panel (Main) - Tokens - Removals - Deprecated Buttons - Input Provider - Menu (preview) - readOnlyPillStencil and removeablePillStencil - Text Area - Text Input - Troubleshooting - Glossary - Main - Preview - Labs Codemod Overview A codemod automatically updates your code to work with most of the breaking changes in v14. Breaking changes handled by the codemod are marked with πŸ€– in the Upgrade Guide. A codemod is a script that makes programmatic transformations on your codebase by traversing the AST, identifying patterns, and making prescribed changes. This decreases opportunities for error and reduces manual updates. Using the codemod is recommended. - Codemods must be run sequentially across versions (v8 -> v9 -> v10, etc.). - The codemod will not remove outdated dependencies or upgrade dependencies. Do this manually first. - Codemods will not cover every breaking change in v14. Manual changes are required. - Codemods are not bulletproof. Perform a full PR and QA review of all changes. - Commit codemod changes in a separate commit for rollback safety. Codemod Instructions Run with npx: npx @workday/canvas-kit-codemod v14 [path] Run with yarn: yarn add @workday/canvas-kit-codemod --dev yarn canvas-kit-codemod v14 [path] yarn remove @workday/canvas-kit-codemod The codemod works only on .js, .jsx, .ts, and .tsx files. Edit .json, .mdx, .md, etc. manually. Run your linter after executing codemod. Tokens Canvas Kit v14 uses @workday/canvas-tokens-web v3. Old β€œfruity” color names are replaced (e.g., cinnamon -> red, blueberry -> blue, greenApple -> green). Upgrade is recommended. Migration guides: - Migration from @workday/canvas-kit-react/tokens - v2 to v3 Migration Guide πŸ€– The v14-tokens codemod will migrate tokens automatically. Run v14-tokens with npx: npx @workday/canvas-kit-codemod v14-tokens [path] Caution Naming Alert and Warning states are renamed to Caution. This affects error states in components. Before in v13 First Name Cannot contain numbers After in v14 First Name Cannot contain numbers πŸ€– The codemod changes ErrorType.Alert to ErrorType.Caution and error="alert" to error="caution". If using error enums from `@workday/canvas-kit-react/common` or component-specific `ErrorType`, names change accordingly. Before in v13: import {ErrorType} from '@workday/canvas-kit-react/common'; import {TextInput} from '@workday/canvas-kit-react/text-input'; import {Switch} from '@workday/canvas-kit-react/switch'; import {TextArea} from '@workday/canvas-kit-react/text-area'; someFunction(ErrorType.Alert); ; After in v14: import {TextArea} from '@workday/canvas-kit-preview-react/text-area'; import {FormField} from '@workday/canvas-kit-react/form-field'; Leave a Review ; Removals >> Text Input (Preview) TextInput in `@workday/canvas-kit-preview-react/text-input` removed; use TextInput in `@workday/canvas-kit-react` TextInput (docs: https://workday.github.io/canvas-kit/?path=/docs/components-inputs-text-input--docs). Before in v13: import {TextInput} from '@workday/canvas-kit-preview-react/text-input'; Email ; After in v14: import {TextArea} from '@workday/canvas-kit-preview-react/text-input'; import {FormField} from '@workday/canvas-kit-react/form-field'; Leave a Review ; **Troubleshooting** When upgrading to the latest major version of Canvas Kit, update all related packages at the same time: - `"@workday/canvas-kit-react": "^13.5.6"` β†’ `"@workday/canvas-kit-react": "^14.0.0"` - `"@workday/canvas-kit-styling": "^13.5.6"` β†’ `"@workday/canvas-kit-styling": "^14.0.0"` - `"@workday/canvas-kit-preview-react": "^13.5.6"` β†’ `"@workday/canvas-kit-preview-react": "^14.0.0"` - `"@workday/canvas-kit-labs-react": "^13.5.6"` β†’ `"@workday/canvas-kit-labs-react": "^14.0.0"` Ensure `@workday/canvas-tokens-web` is installed and up to date to provide CSS variables and correct styling; docs: https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs. **Glossary** For an overview of available packages, see: https://workday.github.io/canvas-kit/?path=/docs/guides-packages--docs