@workday/canvas-kit-docs 14.0.0-alpha.1252-next.0 → 14.0.0-alpha.1254-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.
@@ -1 +1 @@
1
- {"version":3,"file":"welcomePage.d.ts","sourceRoot":"","sources":["../../../mdx/welcomePage.tsx"],"names":[],"mappings":"AAgDA,eAAO,MAAM,WAAW,+CAmGvB,CAAC"}
1
+ {"version":3,"file":"welcomePage.d.ts","sourceRoot":"","sources":["../../../mdx/welcomePage.tsx"],"names":[],"mappings":"AAqDA,eAAO,MAAM,WAAW,+CAmGvB,CAAC"}
@@ -1,15 +1,20 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // @ts-ignore: Cannot find module error
3
3
  import headerImage from './ck-banner.jpg';
4
+ // @ts-ignore: Cannot find module error
5
+ import componentsImage from './Components.png';
6
+ // @ts-ignore: Cannot find module error
7
+ import tokensImage from './Tokens.png';
8
+ // @ts-ignore: Cannot find module error
9
+ import stylingImage from './Styling.png';
4
10
  import { Flex, Grid, Box } from '@workday/canvas-kit-react/layout';
5
11
  import { InstallBlock } from './installBlock';
6
12
  import { Text, Heading } from '@workday/canvas-kit-react/text';
7
13
  import { Card } from '@workday/canvas-kit-react/card';
8
14
  import { ExternalHyperlink, Hyperlink } from '@workday/canvas-kit-react/button';
9
- import { rocketIcon, tokensIcon, shapesIcon } from '@workday/canvas-system-icons-web';
10
- import { SystemIcon } from '@workday/canvas-kit-react/icon';
11
- import { system, base } from '@workday/canvas-tokens-web';
15
+ import { system } from '@workday/canvas-tokens-web';
12
16
  import { createStyles } from '@workday/canvas-kit-styling';
17
+ import { Graphic } from '@workday/canvas-kit-react/icon';
13
18
  // @ts-ignore: Cannot find module error
14
19
  import { version } from '../../../lerna.json';
15
20
  const parentFlexStyles = createStyles({
@@ -32,7 +37,7 @@ const imageStyles = createStyles({
32
37
  height: 'auto',
33
38
  });
34
39
  const gridStyles = createStyles({
35
- maxHeight: 320,
40
+ maxHeight: 400,
36
41
  gridTemplateRows: '1fr 1fr 2fr 1fr',
37
42
  display: 'grid',
38
43
  });
@@ -41,5 +46,5 @@ const linkStyles = createStyles({
41
46
  marginTop: system.space.x3,
42
47
  });
43
48
  export const WelcomePage = () => {
44
- return (_jsx("div", { className: "sb-unstyled", children: _jsxs("div", { className: parentFlexStyles, children: [_jsxs(Box, { cs: { overflow: 'hidden', position: 'relative' }, children: [_jsx("img", { src: headerImage, alt: "banner with canvas kit logo and version", className: imageStyles }), _jsx(Flex, { cs: { flexDirection: 'row', position: 'absolute', top: '45%', right: '5%' }, children: _jsxs(Text, { typeLevel: "title.medium", cs: [bannerTextStyles, versionStyles], children: ["v", version] }) })] }), _jsxs(Text, { typeLevel: "body.medium", children: ["This project provides a set of components for the Workday Canvas Design System that can be used to implement user experiences consistent with", _jsx(ExternalHyperlink, { href: "https://canvas.workdaydesign.com/", iconLabel: "Open docs in new window", cs: { marginInlineStart: system.space.x1 }, children: "Workday Design Principles." })] }), _jsx(Heading, { size: "medium", children: "Quick Links" }), _jsxs(Grid, { gridAutoColumns: "auto", gridTemplateColumns: "repeat(auto-fill, minmax(250px, 1fr))", gridGap: "s", children: [_jsxs(Grid, { as: Card, className: gridStyles, children: [_jsx(SystemIcon, { color: base.magenta600, icon: rocketIcon, size: 60 }), _jsx(Card.Heading, { children: "Getting Started" }), _jsx(Card.Body, { children: _jsx(Text, { children: "For all things getting started including helpful guides and docs." }) }), _jsx(Grid.Item, { as: Hyperlink, className: linkStyles, href: "https://workday.github.io/canvas-kit/?path=/docs/guides-getting-started--docs", children: "Getting Started Guide" })] }), _jsxs(Grid, { as: Card, className: gridStyles, children: [_jsx(SystemIcon, { color: base.red300, icon: tokensIcon, size: 60 }), _jsx(Card.Heading, { children: "Tokens" }), _jsx(Card.Body, { children: _jsx(Text, { children: "Tokens are the smallest pieces of our Design System with the primary function of storing UI information." }) }), _jsx(Grid.Item, { as: ExternalHyperlink, className: linkStyles, href: "https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs", children: "View Our Tokens" })] }), _jsxs(Grid, { as: Card, className: gridStyles, children: [_jsx(SystemIcon, { color: base.teal500, icon: shapesIcon, size: 60 }), _jsx(Card.Heading, { children: "Styling" }), _jsx(Card.Body, { children: _jsx(Text, { children: "Learn how to style Canvas components using tokens, theming, and custom CSS approaches." }) }), _jsx(Grid.Item, { as: Hyperlink, className: linkStyles, href: "https://workday.github.io/canvas-kit/?path=/docs/styling-getting-started-overview--docs", children: "Get Started" })] })] }), _jsx(Heading, { size: "medium", children: "Installation" }), _jsx(Text, { children: "To get started using Canvas Kit React first add or install the module to your existing React project" }), _jsx(InstallBlock, { command: "yarn add", packageName: "@workday/canvas-kit-react @workday/canvas-tokens-web" }), "or", _jsx(InstallBlock, { command: "npm install", packageName: "@workday/canvas-kit-react @workday/canvas-tokens-web" })] }) }));
49
+ return (_jsx("div", { className: "sb-unstyled", children: _jsxs("div", { className: parentFlexStyles, children: [_jsxs(Box, { cs: { overflow: 'hidden', position: 'relative' }, children: [_jsx("img", { src: headerImage, alt: "banner with canvas kit logo and version", className: imageStyles }), _jsx(Flex, { cs: { flexDirection: 'row', position: 'absolute', top: '45%', right: '5%' }, children: _jsxs(Text, { typeLevel: "title.medium", cs: [bannerTextStyles, versionStyles], children: ["v", version] }) })] }), _jsxs(Text, { typeLevel: "body.medium", children: ["This project provides a set of components for the Workday Canvas Design System that can be used to implement user experiences consistent with", _jsx(ExternalHyperlink, { href: "https://canvas.workdaydesign.com/", iconLabel: "Open docs in new window", cs: { marginInlineStart: system.space.x1 }, children: "Workday Design Principles." })] }), _jsx(Heading, { size: "medium", children: "Quick Links" }), _jsxs(Grid, { gridAutoColumns: "auto", gridTemplateColumns: "repeat(auto-fill, minmax(250px, 1fr))", gridGap: "s", children: [_jsxs(Grid, { as: Card, className: gridStyles, children: [_jsx(Graphic, { src: { url: componentsImage } }), _jsx(Card.Heading, { children: "Getting Started" }), _jsx(Card.Body, { children: _jsx(Text, { children: "For all things getting started including helpful guides and docs." }) }), _jsx(Grid.Item, { as: Hyperlink, className: linkStyles, href: "https://workday.github.io/canvas-kit/?path=/docs/guides-getting-started--docs", children: "Getting Started Guide" })] }), _jsxs(Grid, { as: Card, className: gridStyles, children: [_jsx(Graphic, { src: { url: tokensImage } }), _jsx(Card.Heading, { children: "Tokens" }), _jsx(Card.Body, { children: _jsx(Text, { children: "Tokens are the smallest pieces of our Design System with the primary function of storing UI information." }) }), _jsx(Grid.Item, { as: ExternalHyperlink, className: linkStyles, href: "https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs", children: "View Our Tokens" })] }), _jsxs(Grid, { as: Card, className: gridStyles, children: [_jsx(Graphic, { src: { url: stylingImage } }), _jsx(Card.Heading, { children: "Styling" }), _jsx(Card.Body, { children: _jsx(Text, { children: "Learn how to style Canvas components using tokens, theming, and custom CSS approaches." }) }), _jsx(Grid.Item, { as: Hyperlink, className: linkStyles, href: "https://workday.github.io/canvas-kit/?path=/docs/styling-getting-started-overview--docs", children: "Get Started" })] })] }), _jsx(Heading, { size: "medium", children: "Installation" }), _jsx(Text, { children: "To get started using Canvas Kit React first add or install the module to your existing React project" }), _jsx(InstallBlock, { command: "yarn add", packageName: "@workday/canvas-kit-react @workday/canvas-tokens-web" }), "or", _jsx(InstallBlock, { command: "npm install", packageName: "@workday/canvas-kit-react @workday/canvas-tokens-web" })] }) }));
45
50
  };
@@ -9,7 +9,9 @@ any questions.
9
9
  v14.0 Introduces Workday's new brand direction which includes a new color palette and with it, some
10
10
  styling updates to our components.
11
11
 
12
- > **Note:** v14.0 requires an upgrade to the `@workday/canvas-tokens-web` package to `@v3.0.0`.
12
+ **Please consult our [v14 Visual Changes](/help/upgrade-guides/canvas-v14-upgrade-guide/#tab=visual-changes) page for a visual reference of what's changed.**
13
+
14
+ > **Note:** While v14 does not require an upgrade to our v3 tokens, we strongly advise to upgrade to the latest to ensure proper branding.
13
15
 
14
16
  ## Table of contents
15
17
 
@@ -18,9 +20,10 @@ styling updates to our components.
18
20
  - [Tokens](#tokens)
19
21
  - [Caution Naming](#caution-naming)
20
22
  - [Theming](#theming)
23
+ - [New Documentation](#new-documentation)
21
24
  - [Canvas Provider](#canvas-provider-)
22
25
  - [Component Updates](#component-updates)
23
- - [Avatar Preview](#avatar-preview)
26
+ - [Avatar (Preview)](#avatar-preview)
24
27
  - [Branding Changes](#branding-changes-)
25
28
  - [Buttons](#buttons)
26
29
  - [Card](#card-)
@@ -28,24 +31,24 @@ styling updates to our components.
28
31
  - [Expandable](#expandable)
29
32
  - [Hyperlink and ExternalHyperlink](#hyperlink-and-external-hyperlink)
30
33
  - [Loading Dots](#loading-dots)
31
- - [Pill](#pill)
32
- - [SearchForm](#search-form)
33
- - [Status Indicator (Preview)](#status-indicator-preview)
34
+ - [Pill (Preview)](#pill-preview)
35
+ - [Search Form (Labs)](#searchform-)
36
+ - [Status Indicator (Preview)](#status-indicator-preview-)
34
37
  - [Deprecations](#deprecations)
35
- - [Avatar in Main](#avatar-in-main)
38
+ - [Avatar (Main)](#avatar-in-main)
36
39
  - [Combobox (Labs)](#combobox-labs)
37
40
  - [Radio (Main)](#radio-main)
38
- - [SearchForm (Labs)](#search-form-labs)
41
+ - [Search Form (Labs)](#searchform-labs)
39
42
  - [Segmented Control (Main)](#segmented-control-main)
40
43
  - [Side Panel (Main)](#side-panel-main)
41
44
  - [Tokens](#tokens)
42
45
  - [Removals](#removals)
43
46
  - [Deprecated Buttons](#deprecated-buttons)
44
47
  - [Input Provider](#input-provider)
45
- - [Menu (preview)](#menu-preview)
46
- - [readyOnlyPillStencil and removeablePillStencil](#readyOnlyPillStencil-and-removeablePillStencil)
47
- - [Text Area](#text-area)
48
- - [Text Input](#text-input)
48
+ - [Menu (Preview)](#menu-preview)
49
+ - [readyOnlyPillStencil and removeablePillStencil](#readonlypillstencil-and-removeablepillstencil)
50
+ - [Text Area (Labs)](#text-area)
51
+ - [Text Input (Labs)](#text-input)
49
52
  - [Troubleshooting](#troubleshooting)
50
53
  - [Glossary](#glossary)
51
54
  - [Main](#main)
@@ -116,7 +119,7 @@ yarn remove @workday/canvas-kit-codemod
116
119
  ## Tokens
117
120
 
118
121
  Canvas Kit v14 now uses `@workday/canvas-tokens-web` v3, which introduces new color palettes and
119
- replaces the old "fruity" color names (for example, use `red` instead of `cinnamon`, `blue` instead
122
+ deprecates the old "fruity" color names (for example, use `red` instead of `cinnamon`, `blue` instead
120
123
  of `blueberry`, and `green` instead of `greenApple`). We strongly recommend upgrading to
121
124
  `@workday/canvas-tokens-web` v3, as using older versions will not match the new brand guidelines or
122
125
  color system. Although this dependency upgrade is not required, we've offered migration guides and
@@ -142,8 +145,7 @@ Follow these guides to migrate:
142
145
  To better align with the brand refresh, Alert and Warning states are being renamed to Caution for
143
146
  better semantics.
144
147
 
145
- This change mostly affects how you pass an error state to our input components. In most cases, our
146
- inputs components should be used with our `FormField` component to ensure correct accessiblity.
148
+ This change mostly affects how you pass an error state to our input components. In most cases, our input components should be used with our `FormField` component to ensure correct accessibility.
147
149
 
148
150
  **Before in v13**
149
151
 
@@ -169,8 +171,7 @@ inputs components should be used with our `FormField` component to ensure correc
169
171
  </FormField>
170
172
  ```
171
173
 
172
- If you are using the error type either from our `Common` package or the one exposed from the
173
- component, the naming as also changed.
174
+ If you are using the error type either from our `Common` package or the one exposed from the component, the naming has also changed.
174
175
 
175
176
  **Before in v13**
176
177
 
@@ -195,7 +196,6 @@ import {TextInput} from '@workday/canvas-kit-react/text-input';
195
196
  import {Switch} from '@workday/canvas-kit-react/switch';
196
197
  import {TextArea} from '@workday/canvas-kit-react/text-area';
197
198
 
198
-
199
199
  someFunction(ErrorType.Caution);
200
200
 
201
201
  <TextInput error={TextInput.ErrorType.Caution} />
@@ -208,6 +208,10 @@ someFunction(ErrorType.Caution);
208
208
 
209
209
  ## Theming
210
210
 
211
+ ### New Documentation
212
+
213
+ We've **significantly** improved our theming documentation. Please consult our new [Canvas Kit Theming Guide](/get-started/for-developers/theming/overview/).
214
+
211
215
  ### Canvas Provider 🚨
212
216
 
213
217
  **PRs:** [#3407](https://github.com/Workday/canvas-kit/pull/3407),
@@ -222,7 +226,10 @@ Canvas Provider has been updated to **remove** default branding colors to ensure
222
226
  our CSS variables. Instead of generating a palette and shifting the brightness and darkness with
223
227
  `chroma.js`, we use `oklch` to generate the palette colors.
224
228
 
225
- **Before in v13** In v13, the `useTheme` hook would call `createCanvasTheme` which generated a
229
+ Prior to v14, `CanvasProvider` created a [cascade barrier](/get-started/for-developers/theming/overview/#what-is-a-cascade-barrier), which redefined brand CSS variables under a class and created a higher specificity. This made it difficult to override brand tokens in certain scenarios. v14 removes that barrier.
230
+
231
+ **Before in v13**
232
+ In v13, the `useTheme` hook would call `createCanvasTheme` which generated a
226
233
  palette given a `main` color via `chroma.js`.
227
234
 
228
235
  ```tsx
@@ -258,7 +265,7 @@ different. If you want more control over the colors, we suggest providing the fu
258
265
  **Or**
259
266
 
260
267
  ```tsx
261
- <CanvasProvider theme={{canvas: {palette: {primary: {main: cssVar(base.blue600)}}}}}>
268
+ <CanvasProvider theme={{canvas: {palette: {primary: {main: base.blue600}}}}}>
262
269
  <App />
263
270
  </CanvasProvider>
264
271
  ```
@@ -289,7 +296,7 @@ specificity.
289
296
  A new `Avatar` component has been added to the `@workday/canvas-kit-preview-react` package that
290
297
  matches our brand refresh.
291
298
 
292
- #### API Changes from the Main Avatar
299
+ #### API Changes from Avatar in Main
293
300
 
294
301
  - `Avatar` has a `name` prop. This is required to ensure a fallback if a `url` is not provided. The
295
302
  `name` prop also determines the initials and the `alt` text for the image if a `url` is provided.
@@ -318,7 +325,7 @@ import { Avatar } from '@workday/canvas-kit-react/avatar';
318
325
 
319
326
  <Avatar altText="John Doe" size="extraExtraLarge" variant="light" as="div" url={yourImageUrl} />
320
327
 
321
- // For Avatars that where buttons
328
+ // For Avatars that were buttons
322
329
  <Avatar altText="John Doe" size="extraExtraLarge" variant="dark" url={yourImageUrl} />
323
330
  ```
324
331
 
@@ -340,12 +347,9 @@ revolve around the use of our new brand colors. For a better guide on what has c
340
347
  tokens, please view the Tokens v3.0.0
341
348
  [Upgrade Guide](https://workday.github.io/canvas-tokens/?path=/docs/guides-upgrade-guides-v3-overview--docs).
342
349
 
343
- > **Note:** If you want a visual diff of the changes, please view the [Visual Changes](https://workday.github.io/canvas-kit/?path=/docs/guides-upgrade-guides-v14-0-visual-changes--docs) guide.
350
+ The following components have been updated (**see [v14 Visual Changes](/help/upgrade-guides/canvas-v14-upgrade-guide/#tab=visual-changes) for a visual reference of the updates**):
344
351
 
345
- The following components have been updated:
346
-
347
- - `Breadcrumbs` [#3270](https://github.com/Workday/canvas-kit/pull/3270),
348
- [#3447](https://github.com/Workday/canvas-kit/pull/3447)
352
+ - `Breadcrumbs` [#3270](https://github.com/Workday/canvas-kit/pull/3270),[#3447](https://github.com/Workday/canvas-kit/pull/3447)
349
353
  - `Buttons` [#3394](https://github.com/Workday/canvas-kit/pull/3394)
350
354
  - `ColorPicker` (Main) [#3307](https://github.com/Workday/canvas-kit/pull/3307)
351
355
  - `ColorPicker` (preview) [#3307](https://github.com/Workday/canvas-kit/pull/3307)
@@ -361,25 +365,32 @@ The following components have been updated:
361
365
 
362
366
  ### Buttons
363
367
 
364
- #### TertiaryButton
368
+ #### TertiaryButton 🚨
365
369
 
366
- The `TertiaryButton` component no longer supports the `isThemable` prop. To customize the appearance
367
- of `TertiaryButton`, use the `cs` prop for custom styles or the `colors` prop for palette-based
368
- color overrides.
370
+ **Breaking Changes**
369
371
 
370
- **After in v14**
372
+ - The `TertiaryButton` component no longer supports the `isThemable` prop. To customize the appearance
373
+ of `TertiaryButton`, use the `cs` prop for custom styles or the `colors` prop for palette-based
374
+ color overrides.
375
+ - The shape of `TertiaryButton` has changed to have rounded corners, aligning with other buttons and
376
+ our new brand direction.
377
+
378
+ **Before in v13**
371
379
 
372
380
  ```tsx
373
- <TertiaryButton cs={{[buttonStencil.vars.background: 'red']}}>
374
- Click Me
375
- </TertiaryButton>
381
+ <TertiaryButton isThemable>Themable Button</TertiaryButton>
376
382
  ```
377
383
 
378
- The shape of `TertiaryButton` has changed to have rounded corners, aligning with other buttons and
379
- our new brand direction.
384
+ **After in v14**
385
+
386
+ ```tsx
387
+ <TertiaryButton cs={{/* custom styles */}}>Custom Button</TertiaryButton>
388
+ // OR
389
+ <TertiaryButton colors={{/* palette colors */}}>Custom Button</TertiaryButton>
390
+ ```
380
391
 
381
392
  If you need to override default styles, follow
382
- [this guide](https://workday.github.io/canvas-kit/?path=/docs/components-buttons--docs#custom-styles)
393
+ [this guide](https://workday.github.io/canvas-kit/?path=/docs/components-buttons--docs#custom-styles).
383
394
 
384
395
  ### Card 🚨
385
396
 
@@ -388,12 +399,12 @@ If you need to override default styles, follow
388
399
  We've rebranded the `Card` component to align with our new brand directions and provide better
389
400
  visual hierarchy and more flexible styling options. The following changes have been made:
390
401
 
391
- #### Default Card No Longer Has Shadow
402
+ #### Default Card No Longer Has a Box Shadow
392
403
 
393
- The default `Card` variant no longer includes a box shadow, creating a cleaner, flatter appearance
394
- that aligns with our new brand's emphasis on simplicity and clarity. This is a **visual breaking
395
- change** that may affect your application's visual hierarchy. If your design requires a shadow you
396
- can add it through `cs` prop.
404
+ The default `Card` variant no longer includes a box shadow, creating a cleaner, flatter appearance that
405
+ aligns with our new brand's emphasis on simplicity and clarity. This is a **visual breaking change**
406
+ that may affect your application's visual hierarchy. If your design requires shadow you can add it
407
+ through the `cs` prop.
397
408
 
398
409
  **Before in v13**
399
410
 
@@ -404,7 +415,8 @@ can add it through `cs` prop.
404
415
  </Card>
405
416
  ```
406
417
 
407
- **After in v14** Only do this if you need a shadow. Otherwise, adhere to the default styling.
418
+ **After in v14**
419
+ Only do this if you need a shadow. Otherwise, adhere to the default styling.
408
420
 
409
421
  ```tsx
410
422
  import {system} from '@workday/canvas-tokens-web';
@@ -485,8 +497,8 @@ emphasis for the badge.
485
497
 
486
498
  ```tsx
487
499
  <CountBadge /> // Default count badge with high emphasis
488
- <CountBadge variant="inverse" /> // Inverse default count badge to use on dark backgrounds
489
- // new
500
+ <CountBadge variant="inverse" /> // Inverse default count badge
501
+ // New emphasis prop
490
502
  <CountBadge emphasis="low" /> // Default count badge with low emphasis
491
503
  <CountBadge variant="inverse" emphasis="low" /> // Inverse count badge with low emphasis
492
504
  ```
@@ -496,23 +508,25 @@ emphasis for the badge.
496
508
  **PRs:** [#3389](https://github.com/Workday/canvas-kit/pull/3389),
497
509
  [#3430](https://github.com/Workday/canvas-kit/pull/3430)
498
510
 
499
- - `<Expandable.Target>` hover state has been update to use `system.color.bg.alt.soft` instead of
511
+ - `<Expandable.Target>` hover state has been updated to use `system.color.bg.alt.soft` instead of
500
512
  `system.color.bg.alt.default` to match our new brand directions.
501
- - The `focus` state has been update to use `system.color.border.primary.default` to ensure the same
513
+ - The `focus` state has been updated to use `system.color.border.primary.default` to ensure the same
502
514
  focus state color across all components.
503
515
  - `Expandable.Avatar` has been updated to use the `Avatar` component from Preview. This change
504
516
  requires that you update the `altText` prop to `name`.
505
517
 
506
518
  > 🤖 The codemod will handle the change of `altText` to `name` on `Expandable.Avatar`.
507
519
 
508
- ### Hyperlink and External Hyperlink
520
+ These changes are only **visual** and should not affect the functionality of the component.
521
+
522
+ ### Hyperlink and ExternalHyperlink
509
523
 
510
524
  **PR:** [#3390](https://github.com/Workday/canvas-kit/pull/3390)
511
525
 
512
526
  - `Hyperlink` and `ExternalHyperlink` now have a `standalone` and `standaloneInverse` variant. This
513
527
  removes the underline text decoration for use outside the context of body text.
514
528
 
515
- **In v14**
529
+ **Hyperlink and ExternalHyperlink in v14**
516
530
 
517
531
  ```tsx
518
532
  <Hyperlink variant="standalone" href="#hyperlink">Hyperlink</Hyperlink>
@@ -530,7 +544,7 @@ emphasis for the badge.
530
544
 
531
545
  - We've updated the colors to match our brand refresh. The default color changes from
532
546
  `system.color.bg.alt.strong` to `system.color.bg.muted.strong`.
533
- - `LoadingDots` now has a `inverse` variant. Use this variant when the Loading Dots are on a dark
547
+ - `LoadingDots` now has an `inverse` variant. Use this variant when the Loading Dots are on a dark
534
548
  background or image.
535
549
 
536
550
  **After in v14**
@@ -553,7 +567,7 @@ emphasis for the badge.
553
567
  - The `Pill` component no longer supports `'default'` as a value for the `variant` prop. If the
554
568
  `variant` prop is not provided, the component will use its default styling.
555
569
 
556
- - `readyOnlyPillStencil` and `removeablePillStencil` have been removed due to some styling clean up.
570
+ - `readyOnlyPillStencil` and `removeablePillStencil` have been removed due to some styling cleanup.
557
571
  Please use `pillStencil` instead.
558
572
 
559
573
  **Before in v13**
@@ -574,7 +588,7 @@ emphasis for the badge.
574
588
  </Pill>
575
589
  ```
576
590
 
577
- ### Search Form 🚨
591
+ ### SearchForm 🚨
578
592
 
579
593
  **PR:** [#3303](https://github.com/Workday/canvas-kit/pull/3303)
580
594
 
@@ -585,20 +599,19 @@ emphasis for the badge.
585
599
 
586
600
  ```tsx
587
601
  const customTheme = {
588
- background: colors.cinnamon600,
589
- backgroundFocus: colors.frenchVanilla100,
590
- placeholderColor: colors.frenchVanilla100,
591
- placeholderColorFocus: colors.blackPepper400,
592
- boxShadow: ['10px 5px 5px red', '60px -16px teal']
593
- boxShadowFocus: ['10px 5px 5px red', '60px -16px teal']
602
+ background: colors.cinnamon600,
603
+ backgroundFocus: colors.frenchVanilla100,
604
+ placeholderColor: colors.frenchVanilla100,
605
+ placeholderColorFocus: colors.blackPepper400,
606
+ boxShadow: ['10px 5px 5px red', '60px -16px teal'],
607
+ boxShadowFocus: ['10px 5px 5px red', '60px -16px teal']
594
608
  } as SearchThemeAttributes;
595
- //...
596
609
 
597
- <SearchForm
598
- searchTheme={customTheme}
599
- autocompleteItems={menuItems}
600
- onInputChange={filterMenuItems}
601
- onSubmit={handleSubmit}
610
+ <SearchForm
611
+ searchTheme={customTheme}
612
+ autocompleteItems={menuItems}
613
+ onInputChange={filterMenuItems}
614
+ onSubmit={handleSubmit}
602
615
  />
603
616
  ```
604
617
 
@@ -613,14 +626,13 @@ const customTheme = {
613
626
  boxShadow: '10px 5px 5px red',
614
627
  boxShadowFocus: '10px 5px 5px red',
615
628
  } as SearchThemeAttributes;
616
- //...
617
629
 
618
630
  <SearchForm
619
631
  searchTheme={customTheme}
620
632
  autocompleteItems={menuItems}
621
633
  onInputChange={filterMenuItems}
622
634
  onSubmit={handleSubmit}
623
- />;
635
+ />
624
636
  ```
625
637
 
626
638
  - `SearchTheme` enum type has been updated to have string values `light`, `dark` and `transparent`.
@@ -631,20 +643,40 @@ const customTheme = {
631
643
 
632
644
  **PR:** [#3287](https://github.com/Workday/canvas-kit/pull/3287)
633
645
 
634
- Preview `StatusIndicator` is a rounder and more vibrant base emphasis (`low`).
646
+ Preview `StatusIndicator` is rounder and more vibrant with base emphasis (`low`).
635
647
 
636
648
  Variant names of the preview `StatusIndicator` have been updated by the following mapping:
637
649
 
638
- - `blue` -> `primary`
639
- - `green` -> `success`
640
- - `orange` -> `caution`
641
- - `red` -> `critical`
642
- - `gray` -> `neutral`
650
+ - `blue` `primary`
651
+ - `green` `success`
652
+ - `orange` `caution`
653
+ - `red` `critical`
654
+ - `gray` `neutral`
643
655
 
644
656
  The `StatusIndicatorVariant` type has been updated to contain the new variant names listed above. If
645
657
  you use the old variant values, update to use the new ones mapped above. It has also been
646
658
  deprecated. Use `StatusIndicatorProps['variant']` instead.
647
659
 
660
+ **Before in v13**
661
+
662
+ ```tsx
663
+ <StatusIndicator variant="blue" />
664
+ <StatusIndicator variant="green" />
665
+ <StatusIndicator variant="orange" />
666
+ <StatusIndicator variant="red" />
667
+ <StatusIndicator variant="gray" />
668
+ ```
669
+
670
+ **After in v14**
671
+
672
+ ```tsx
673
+ <StatusIndicator variant="primary" />
674
+ <StatusIndicator variant="success" />
675
+ <StatusIndicator variant="caution" />
676
+ <StatusIndicator variant="critical" />
677
+ <StatusIndicator variant="neutral" />
678
+ ```
679
+
648
680
  ## Deprecations
649
681
 
650
682
  We add the [@deprecated](https://jsdoc.app/tags-deprecated.html) JSDoc tag to code we plan to remove
@@ -663,10 +695,10 @@ We've deprecated the `Avatar` component in `@workday/canvas-kit-react` Main pack
663
695
  ```tsx
664
696
  import { Avatar } from '@workday/canvas-kit-react/avatar';
665
697
 
666
- // For Avatars that where divs
698
+ // For Avatars that were divs
667
699
  <Avatar altText="John Doe" size="extraExtraLarge" as="div" url={yourImageUrl} />
668
700
 
669
- // For Avatars that where buttons
701
+ // For Avatars that were buttons
670
702
  <Avatar altText="John Doe" onClick={() => console.log('Avatar clicked')} />
671
703
  ```
672
704
 
@@ -675,8 +707,8 @@ import { Avatar } from '@workday/canvas-kit-react/avatar';
675
707
  ```tsx
676
708
  import {Avatar} from '@workday/canvas-kit-preview-react/avatar';
677
709
  // name is used as a fallback if the image url is broken or still loading
678
- // variant light or dark are not used. Instead, variant defines the color of the Avatar
679
- <Avatar name="John Doe" size="extraExtraLarge" variant="teal" url={yourImageUrl} />;
710
+ // variant defines the color of the Avatar
711
+ <Avatar name="John Doe" size="extraExtraLarge" variant="teal" url={yourImageUrl} />
680
712
  ```
681
713
 
682
714
  If you need to render a `button` element use the `BaseAvatar` component.
@@ -692,7 +724,7 @@ import {BaseAvatar} from '@workday/canvas-kit-preview-react/avatar';
692
724
  onClick={() => console.log('Avatar clicked')}
693
725
  >
694
726
  <BaseAvatar.Name name="John Doe" />
695
- </BaseAvatar>;
727
+ </BaseAvatar>
696
728
  ```
697
729
 
698
730
  ### Combobox (Labs)
@@ -708,7 +740,7 @@ The Radio component in `@workday/canvas-kit-react/radio` has been deprecated. Pl
708
740
  [Radio](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-radio--docs) component
709
741
  from the same package, which offers improved accessibility and API consistency.
710
742
 
711
- ### Search Form (Labs)
743
+ ### SearchForm (Labs)
712
744
 
713
745
  **PR:** [#3469](https://github.com/Workday/canvas-kit/pull/3469)
714
746
 
@@ -735,9 +767,9 @@ functionality.
735
767
 
736
768
  The legacy tokens from `@workday/canvas-kit-react/tokens` are now deprecated. Please use the new
737
769
  [Canvas Tokens Web](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs)
738
- package (`@workday/canvas-tokens-web`) for all token usage. Follow
739
- [a migration guide](https://workday.github.io/canvas-kit?path=/docs/guides-tokens-migration-overview--docs)
740
- for smootier upgrade.
770
+ package (`@workday/canvas-tokens-web`) for all token usage. Follow the
771
+ [migration guide](https://workday.github.io/canvas-kit?path=/docs/guides-tokens-migration-overview--docs)
772
+ for a smoother upgrade.
741
773
 
742
774
  ## Removals
743
775
 
@@ -751,10 +783,10 @@ promoted or replaced a component or utility.
751
783
  Long overdue, but a sign of moving forward, we are removing our `DeprecatedButton`. Our design
752
784
  system supported this for quite some time, but with the advancement in theming, our components API
753
785
  and our flexibility, it is time for us to finally remove this component. This component has served
754
- as a reminder of how far we've come and it part we're thankful for this change.
786
+ as a reminder of how far we've come and we're thankful for this change.
755
787
 
756
- Al though unlikely, but not impossible, if you were using `DeprecatedButton` please use our flexible
757
- and themable buttons like `PrimaryButton`, `ScondaryButton` or `TertiaryButton`.
788
+ Although unlikely, if you were using `DeprecatedButton` please use our flexible
789
+ and themable buttons like `PrimaryButton`, `SecondaryButton` or `TertiaryButton`.
758
790
 
759
791
  ### Input Provider
760
792
 
@@ -766,7 +798,7 @@ browser heuristics to determine when an element should receive visual focus styl
766
798
  information, please view the
767
799
  [MDN docs on `:focus-visible`](https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible).
768
800
 
769
- If you are trying to apply focus styles to our components, we strongly avise to use `:focus-visible`
801
+ If you are trying to apply focus styles to our components, we strongly advise using the `:focus-visible`
770
802
  pseudo selector.
771
803
 
772
804
  ```tsx
@@ -780,11 +812,11 @@ const buttonStyles = createStyles({
780
812
  })
781
813
 
782
814
  <PrimaryButton cs={buttonStyles}>
783
- Click Me
815
+ Click Me
784
816
  </PrimaryButton>
785
817
  ```
786
818
 
787
- ### Menu (preview)
819
+ ### Menu (Preview)
788
820
 
789
821
  **PR:** [#3353](https://github.com/Workday/canvas-kit/pull/3353)
790
822
 
@@ -797,7 +829,7 @@ We've removed `Menu` from `@workday/canvas-kit-preview-react` package. Please us
797
829
  The `readyOnlyPillStencil` and `removeablePillStencil` utilities have been removed from the Pill
798
830
  package. Please use `pillStencil` instead.
799
831
 
800
- ### Text Area (preview)
832
+ ### Text Area (Preview)
801
833
 
802
834
  **PR:** [#3471](https://github.com/Workday/canvas-kit/pull/3471)
803
835
 
@@ -867,19 +899,35 @@ import {FormField} from '@workday/canvas-kit-react/form-field';
867
899
 
868
900
  ## Troubleshooting
869
901
 
870
- - When upgrading to the latest major version of Canvas Kit, all related Canvas Kit packages should
902
+ ### Common Issues
903
+
904
+ - **Dependency Conflicts**: When upgrading to the latest major version of Canvas Kit, all related Canvas Kit packages should
871
905
  be updated at the same time:
872
- - `"@workday/canvas-kit-react": "^13.5.6"` -> `"@workday/canvas-kit-react": "^14.0.0"`
873
- - `"@workday/canvas-kit-styling": "^13.5.6"` -> `"@workday/canvas-kit-styling": "^14.0.0"`
874
- - `"@workday/canvas-kit-preview-react": "^13.5.6"` ->
906
+ - `"@workday/canvas-kit-react": "^13.5.6"` `"@workday/canvas-kit-react": "^14.0.0"`
907
+ - `"@workday/canvas-kit-styling": "^13.5.6"` `"@workday/canvas-kit-styling": "^14.0.0"`
908
+ - `"@workday/canvas-kit-preview-react": "^13.5.6"`
875
909
  `"@workday/canvas-kit-preview-react": "^14.0.0"`
876
- - `"@workday/canvas-kit-labs-react": "^13.5.6"` -> `"@workday/canvas-kit-labs-react": "^14.0.0"`
877
- - Our components rely on the `@workday/canvas-tokens-web` package which provides our CSS variables
910
+ - `"@workday/canvas-kit-labs-react": "^13.5.6"` `"@workday/canvas-kit-labs-react": "^14.0.0"`
911
+
912
+ - **Token Issues**: Our components rely on the `@workday/canvas-tokens-web` package which provides our CSS variables
878
913
  and ensures the correct styling of our components. Make sure to upgrade to the latest version of
879
914
  Canvas Tokens Web and install it correctly. For more information,
880
915
  [view our docs](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs).
881
916
 
917
+ - **Color Discrepancies**: If you notice visual differences after upgrading, this may be due to the change from `chroma.js` to `oklch` color generation. Consider providing explicit color values in your theme configuration.
918
+
919
+ - **Build Errors**: If you encounter build errors after running the codemod, ensure your linter is run as the codemod's formatting may not match your project conventions.
920
+
882
921
  ## Glossary
883
922
 
884
- For an overview of the different packages we provide, plase view our docs
885
- [here](https://workday.github.io/canvas-kit/?path=/docs/guides-packages--docs).
923
+ For an overview of the different packages we provide, please view our docs
924
+ [here](https://workday.github.io/canvas-kit/?path=/docs/guides-packages--docs).
925
+
926
+ ### Main
927
+ Components in the Main package are stable and ready for production use.
928
+
929
+ ### Preview
930
+ Components in the Preview package are mostly stable but may still receive breaking changes before being promoted to Main.
931
+
932
+ ### Labs
933
+ Components in the Labs package are experimental and may receive significant changes or be removed entirely.
@@ -22,7 +22,7 @@ import textInputImage from './images/v14-text-input.png';
22
22
 
23
23
  # Canvas Kit 14.0 Visual Changes
24
24
 
25
- This guide contains an overview of the changes in Canvas Kit v14. If you have any issues, feel free to report them [here](https://github.com/Workday/canvas-kit/issues). For a mode detailed overview of the changes in v14, please view our [v14 Upgrade Guide](https://workday.github.io/canvas-kit/?path=/docs/guides-upgrade-guides-v14-0-overview--docs).
25
+ This guide contains an overview of the changes in Canvas Kit v14. If you have any issues, feel free to report them [here](https://github.com/Workday/canvas-kit/issues). For a mode detailed overview of the changes in v14, please view our [v14 Upgrade Guide](/help/upgrade-guides/canvas-v14-upgrade-guide/).
26
26
 
27
27
  <Graphic src={{url: avatarImage}} />
28
28
  <Graphic src={{url: breadcrumbsImage}} />
@@ -0,0 +1,417 @@
1
+ import {ExampleCodeBlock} from '@workday/canvas-kit-docs';
2
+ import RTL from './examples/RTL';
3
+ import Theming from './examples/Theming';
4
+
5
+
6
+ # Canvas Kit Theming Guide
7
+
8
+ ## Overview
9
+
10
+ Canvas Kit v14 introduces a significant shift in our approach to theming: we've moved away from JavaScript-based theme objects to CSS variables. This change provides better performance, improved developer experience, and greater flexibility for theming applications.
11
+
12
+ ## Migration from v10 Theme Prop to v14 CSS Variables
13
+
14
+ ### The Evolution
15
+
16
+ **Canvas Kit v10** introduced CSS tokens through the `@workday/canvas-tokens-web` package, providing a foundation for consistent design system values.
17
+
18
+ **Canvas Kit v14** Removes the cascade barrier created by the `CanvasProvider`, allowing CSS variables to work as intended.
19
+
20
+ ## Old Approach (v10-v13)
21
+
22
+ The old theming approach used JavaScript objects passed to the `CanvasProvider` theme prop:
23
+
24
+ ```tsx
25
+ import {CanvasProvider} from "@workday/canvas-kit-react/common"
26
+ import {base} from "@workday/canvas-tokens-web"
27
+
28
+ <CanvasProvider theme={{canvas: {palette: {primary: {main: 'purple'}}}}}>
29
+ <App/>
30
+ </CanvasProvider>
31
+ ```
32
+
33
+ This would use `chroma.js` to generate a palette based on the `main` color provided.
34
+
35
+ **Why we're moving away from this approach:**
36
+ - Performance overhead from JavaScript theme object processing
37
+ - Limited flexibility for complex theming scenarios
38
+ - Inconsistent cascade behavior
39
+
40
+ Any time `theme` is passed, the `CanvasProvider` would generate a palette and attach brand variables via a `className` scoping those brand variables to a wrapping div.
41
+ In order for us to provide a better solution to theming that is scalable and is more aligned with our CSS variables, we changed this approach.
42
+
43
+ ## What is a Cascade Barrier?
44
+
45
+ When we say "cascade barrier", we're talking about how [CSS cascades](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_cascade/Cascade) and takes precedence. Take the following example:
46
+
47
+ ```css
48
+ :root {
49
+ --cnbvs-brand-primary-base: blue;
50
+ }
51
+
52
+ // the element with the class .my-app will have a higher specificity than root, creating a barrier where the CSS variables gets redefined and takes precedence over what is defined at root.
53
+ .my-app {
54
+ --cnvs-brand-primary-base: red;
55
+ }
56
+ ```
57
+ In the case of the `CanvasProvider` prior to v14, all our brand tokens where defined within a class and scoped to the `div` that the `CanvasProvider` created. This meant that anything set on `:root` or outside of the `CanvasProvider` would not be able to cascade down to the components within the `CanvasProvider`.
58
+
59
+ ## ✅ Preferred Approach (v14+)
60
+
61
+ Canvas Kit v14 promotes using CSS variables for theming, which can be applied in two ways:
62
+
63
+ ### Method 1: Global CSS Variables (Recommended)
64
+
65
+ Apply theming at the global level by importing CSS variable files and overriding values in your root CSS:
66
+
67
+ ```css
68
+ /* index.css */
69
+ @import '@workday/canvas-tokens-web/css/base/_variables.css';
70
+ @import '@workday/canvas-tokens-web/css/system/_variables.css';
71
+ @import '@workday/canvas-tokens-web/css/brand/_variables.css';
72
+
73
+ :root {
74
+ /* Override brand primary colors */
75
+ --cnvs-brand-primary-base: var(--cnvs-base-palette-magenta-600);
76
+ --cnvs-brand-primary-light: var(--cnvs-base-palette-magenta-200);
77
+ --cnvs-brand-primary-lighter: var(--cnvs-base-palette-magenta-50);
78
+ --cnvs-brand-primary-lightest: var(--cnvs-base-palette-magenta-25);
79
+ --cnvs-brand-primary-dark: var(--cnvs-base-palette-magenta-700);
80
+ --cnvs-brand-primary-darkest: var(--cnvs-base-palette-magenta-800);
81
+ --cnvs-brand-primary-accent: var(--cnvs-base-palette-neutral-0);
82
+ }
83
+ ```
84
+
85
+ > **Note:** You should only import the CSS variables *once* at the root level of your application. If your application renders within another environment that imports these and sets them, **do not** re import them.
86
+
87
+ ### Method 2: Provider-Level CSS Variables
88
+
89
+ Use Canvas Kit's `createStyles` utility to generate themed class names that can be applied to specific components or sections:
90
+
91
+ > **Note:** Doing the following **will create a cascade barrier**. Only use this method if you intentionally want to override the default theme.
92
+
93
+ ```tsx
94
+ import {createStyles}from "@workday/canvas-kit-styling"
95
+ import {brand, base} from "@workday/canvas-tokens-web"
96
+ import {CanvasProvider} from "@workday/canvas-kit-react/common"
97
+
98
+ // You can import the CSS variables in a ts file or an index.css file. You do not need to do both.
99
+ import '@workday/canvas-tokens-web/css/base/_variables.css';
100
+ import '@workday/canvas-tokens-web/css/system/_variables.css';
101
+ import '@workday/canvas-tokens-web/css/brand/_variables.css';
102
+
103
+ // Generate a class name that defines CSS variables
104
+ const themedBrand = createStyles({
105
+ [brand.primary.accent]: base.neutral0,
106
+ [brand.primary.darkest]: base.blue800,
107
+ [brand.primary.dark]: base.blue700,
108
+ [brand.primary.base]: base.blue600,
109
+ [brand.primary.light]: base.blue200,
110
+ [brand.primary.lighter]: base.blue50,
111
+ [brand.primary.lightest]: base.blue25,
112
+ })
113
+
114
+ <CanvasProvider className={themedBrand}>
115
+ <App/>
116
+ </CanvasProvider>
117
+ ```
118
+
119
+ ## CSS Token Structure
120
+
121
+ Canvas Kit provides three layers of CSS variables.
122
+
123
+ ### Base Tokens (`base/_variables.css`)
124
+ Base tokens define foundation palette and design values.
125
+ ```css
126
+ --cnvs-base-palette-blue-600: oklch(0.5198 0.1782 256.11 / 1);
127
+ --cnvs-base-palette-magenta-600: oklch(0.534 0.183 344.19 / 1);
128
+ --cnvs-base-font-size-100: 1rem;
129
+ --cnvs-base-space-x4: calc(var(--cnvs-base-unit) * 4);
130
+ ```
131
+
132
+ ### Brand Tokens (`brand/_variables.css`)
133
+ Brand tokens define semantic color assignments.
134
+ ```css
135
+ --cnvs-brand-primary-base: var(--cnvs-base-palette-blue-600);
136
+ --cnvs-brand-primary-accent: var(--cnvs-base-palette-neutral-0);
137
+ --cnvs-brand-error-base: var(--cnvs-base-palette-red-600);
138
+ --cnvs-brand-success-base: var(--cnvs-base-palette-green-600);
139
+ ```
140
+
141
+ ### System Tokens (`system/_variables.css`)
142
+ System tokens define component-specific values.
143
+ ```css
144
+ --cnvs-sys-color-bg-primary-default: var(--cnvs-base-palette-blue-600);
145
+ --cnvs-sys-color-text-primary-default: var(--cnvs-base-palette-blue-600);
146
+ --cnvs-sys-space-x4: calc(var(--cnvs-base-unit) * 4);
147
+ ```
148
+
149
+ ## Practical Examples
150
+
151
+ ### Complete Brand Theming
152
+
153
+ ```css
154
+ /* themes/magenta-theme.css */
155
+ @import '@workday/canvas-tokens-web/css/base/_variables.css';
156
+ @import '@workday/canvas-tokens-web/css/system/_variables.css';
157
+ @import '@workday/canvas-tokens-web/css/brand/_variables.css';
158
+
159
+ :root {
160
+ /* Primary brand colors */
161
+ --cnvs-brand-primary-base: var(--cnvs-base-palette-magenta-600);
162
+ --cnvs-brand-primary-light: var(--cnvs-base-palette-magenta-200);
163
+ --cnvs-brand-primary-lighter: var(--cnvs-base-palette-magenta-50);
164
+ --cnvs-brand-primary-lightest: var(--cnvs-base-palette-magenta-25);
165
+ --cnvs-brand-primary-dark: var(--cnvs-base-palette-magenta-700);
166
+ --cnvs-brand-primary-darkest: var(--cnvs-base-palette-magenta-800);
167
+ --cnvs-brand-primary-accent: var(--cnvs-base-palette-neutral-0);
168
+ }
169
+ ```
170
+
171
+ ### App-Specific Theming
172
+
173
+ ```tsx
174
+ import {createStyles} from "@workday/canvas-kit-styling";
175
+ import {brand, base} from "@workday/canvas-tokens-web";
176
+ import {PrimaryButton} from "@workday/canvas-kit-react/button";
177
+ import {CanvasProvider} from "@workday/canvas-kit-react/common";
178
+
179
+ const greenTheme = createStyles({
180
+ [brand.primary.base]: base.green600,
181
+ [brand.primary.dark]: base.green700,
182
+ [brand.primary.darkest]: base.green800,
183
+ [brand.primary.light]: base.green200,
184
+ [brand.primary.lighter]: base.green50,
185
+ [brand.primary.lightest]: base.green25,
186
+ [brand.primary.accent]: base.neutral0,
187
+ });
188
+
189
+ <CanvasProvider className={greenTheme}>
190
+ <PrimaryButton>Click me</PrimaryButton>
191
+ </CanvasProvider>
192
+ );
193
+ ```
194
+
195
+ <ExampleCodeBlock code={Theming} />
196
+
197
+ ### Dark Mode Implementation
198
+
199
+ ```css
200
+ /* Dark mode theming */
201
+ [data-theme="dark"] {
202
+ --cnvs-sys-color-bg-default: var(--cnvs-base-palette-neutral-950);
203
+ --cnvs-sys-color-text-default: var(--cnvs-base-palette-neutral-50);
204
+ --cnvs-sys-color-border-container: var(--cnvs-base-palette-slate-700);
205
+ --cnvs-sys-color-bg-alt-default: var(--cnvs-base-palette-slate-800);
206
+ }
207
+ ```
208
+
209
+ ### RTL Support
210
+ Canvas Kit supports RTL out of the box. Our components are styled to use [CSS logical properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_logical_properties_and_values). If you want to add additional styles based on RTL,
211
+ you can also use the `:dir` [pseudo selector](https://developer.mozilla.org/en-US/docs/Web/CSS/:dir).
212
+
213
+ <ExampleCodeBlock code={RTL} />
214
+
215
+ ### Resetting to Default Brand Theme
216
+
217
+ If you need to reset the theme in parts of your application, there's a few ways to do this.
218
+ We export a `defaultBranding` class that can be applied to the `CanvasProvider` which can wrap parts of your application.
219
+
220
+ ```tsx
221
+ import {CanvasProvider, defaultBranding} from "@workday/canvas-kit-react/common"
222
+
223
+ <CanvasProvider className={defaultBranding}>
224
+ <SomeSubComponent/>
225
+ </CanvasProvider>
226
+ ```
227
+
228
+ > **Note:** Doing the following **will create a cascade barrier**. Only use this method if you intentionally want to override the default theme.
229
+
230
+ ## Migration Guide
231
+
232
+ ### Step 1: Identify Current Theme Usage
233
+
234
+ Find all instances of `CanvasProvider` with theme props in your application.
235
+
236
+ ```tsx
237
+ // Find these patterns:
238
+ <CanvasProvider theme={{canvas: {palette: {...}}}}>
239
+ ```
240
+
241
+ ### Step 2: Extract Theme Values
242
+
243
+ Convert JavaScript theme objects to CSS variable overrides.
244
+
245
+ ```tsx
246
+ // Old approach:
247
+ const theme = {
248
+ canvas: {
249
+ palette: {
250
+ primary: {
251
+ main: colors.greenApple400,
252
+ dark: colors.greenApple500,
253
+ }
254
+ }
255
+ }
256
+ };
257
+
258
+ // New approach - CSS variables:
259
+ :root {
260
+ --cnvs-brand-primary-base: var(--cnvs-base-palette-green-400);
261
+ --cnvs-brand-primary-dark: var(--cnvs-base-palette-green-500);
262
+ }
263
+ ```
264
+
265
+ ### Step 3: App Level Theming Usage
266
+
267
+ Replace theme-based `CanvasProvider` usage with CSS class-based theming.
268
+
269
+ ```tsx
270
+ // Before:
271
+ <CanvasProvider theme={customTheme}>
272
+ <App />
273
+ </CanvasProvider>
274
+
275
+ // After:
276
+ <CanvasProvider className={customThemeClass}>
277
+ <App />
278
+ </CanvasProvider>
279
+ ```
280
+
281
+ > **Note:** Using a class means you will need to define each property of the palette for full control over theming.
282
+
283
+ ### Step 4: Test Component Rendering
284
+
285
+ Verify that Canvas Kit components (like `PrimaryButton`) correctly use the new CSS variables.
286
+
287
+ ```tsx
288
+ import {PrimaryButton} from "@workday/canvas-kit-react/button";
289
+
290
+ // This should automatically use your CSS variable overrides
291
+ <PrimaryButton>Themed Button</PrimaryButton>
292
+ ```
293
+
294
+ ## Best Practices
295
+
296
+ ### 1. Use Semantic Token Names
297
+ Use brand tokens instead of base tokens for better maintainability.
298
+
299
+ ```css
300
+ /* ✅ Good - semantic meaning */
301
+ --cnvs-brand-primary-base: var(--cnvs-base-palette-blue-600);
302
+
303
+ /* ❌ Avoid - direct base token usage */
304
+ --cnvs-base-palette-blue-600: blue;
305
+ ```
306
+
307
+
308
+ ### 2. Test Accessibility
309
+ Ensure color combinations meet accessibility standards.
310
+
311
+ ```css
312
+ /* Verify contrast ratios for text/background combinations */
313
+ :root {
314
+ --cnvs-brand-primary-base: var(--cnvs-base-palette-blue-600);
315
+ --cnvs-brand-primary-accent: var(--cnvs-base-palette-neutral-0); /* White text */
316
+ }
317
+ ```
318
+
319
+ ### 3. Avoid Component Level Theming
320
+
321
+ Theming is meant to be done at the app level or root level of the application. Avoid theming at the component level.
322
+
323
+ ```tsx
324
+ /* ✅ Good - App level theming */
325
+ import {CanvasProvider} from '@workday/canvas-kit-react/common';
326
+ import {createStyles} from '@workday/canvas-kit-styling';
327
+ import {base, brand} from '@workday/canvas-tokens-web';
328
+
329
+ const myCustomTheme = createStyles({
330
+ [brand.primary.base]: base.magenta600
331
+ })
332
+
333
+
334
+ <CanvasProvider className={myCustomTheme}>
335
+ <App/>
336
+ </CanvasProvider>
337
+
338
+ /* ❌ Avoid - wrapping components to theme */
339
+ import {CanvasProvider} from '@workday/canvas-kit-react/common';
340
+ import {PrimaryButton} from '@workday/canvas-kit-react/button';
341
+
342
+ const myCustomTheme = createStyles({
343
+ [brand.primary.base]: base.magenta600
344
+ })
345
+
346
+ <CanvasProvider className={myCustomTheme}>
347
+ <PrimaryButton>Click Me</PrimaryButton>
348
+ </CanvasProvider>
349
+
350
+ ```
351
+
352
+ ## Component Compatibility
353
+
354
+ All Canvas Kit components in v14 automatically consume CSS variables. No component-level changes are required when switching from the theme prop approach to CSS variables.
355
+
356
+ ### Supported Components
357
+ - ✅ All Button variants (`PrimaryButton`, `SecondaryButton`, etc.)
358
+ - ✅ Form components (`TextInput`, `FormField`, etc.)
359
+ - ✅ Layout components (`Card`, `Modal`, etc.)
360
+ - ✅ Navigation components (`Tabs`, `SidePanel`, etc.)
361
+
362
+ ## Performance Benefits
363
+
364
+ The CSS variable approach provides several performance improvements:
365
+
366
+ - **Reduced Bundle Size**: No JavaScript theme object processing
367
+ - **Better Caching**: CSS variables can be cached by the browser
368
+ - **Faster Rendering**: Native CSS cascade instead of JavaScript calculations
369
+ - **Runtime Efficiency**: No theme context propagation overhead
370
+
371
+ ## Troubleshooting
372
+
373
+ ### Theme Not Applied
374
+ Ensure CSS variable files are imported in the correct order.
375
+
376
+ ```css
377
+ /* Correct order */
378
+ @import '@workday/canvas-tokens-web/css/base/_variables.css';
379
+ @import '@workday/canvas-tokens-web/css/system/_variables.css';
380
+ @import '@workday/canvas-tokens-web/css/brand/_variables.css';
381
+
382
+ /* Your overrides after imports */
383
+ :root {
384
+ --cnvs-brand-primary-base: var(--cnvs-base-palette-magenta-600);
385
+ }
386
+ ```
387
+
388
+ ### Inconsistent Theming
389
+ Check for CSS specificity issues.
390
+
391
+ ```css
392
+ /* Ensure your overrides have sufficient specificity */
393
+ :root {
394
+ --cnvs-brand-primary-base: var(--cnvs-base-palette-blue-600) !important;
395
+ }
396
+
397
+ /* Or use more specific selectors */
398
+ .my-app {
399
+ --cnvs-brand-primary-base: var(--cnvs-base-palette-blue-600);
400
+ }
401
+ ```
402
+
403
+ ### Missing Token Values
404
+ Verify all required CSS token files are imported and token names are correct.
405
+
406
+ ```tsx
407
+ import {brand, base, system} from "@workday/canvas-tokens-web";
408
+
409
+ // Check token availability in development
410
+ console.log(brand.primary.base); // Should output CSS variable name
411
+ ```
412
+
413
+ ## Conclusion
414
+
415
+ The migration to CSS variables in Canvas Kit v14 provides a more performant, flexible, and maintainable theming solution. By following this guide and best practices, you can successfully migrate your applications and take advantage of the improved theming capabilities.
416
+
417
+ For additional support and examples, refer to the Canvas Kit Storybook documentation and the `@workday/canvas-tokens` [repository](https://github.com/Workday/canvas-tokens).
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+ import {createStyles} from '@workday/canvas-kit-styling';
3
+
4
+ import {CanvasProvider} from '@workday/canvas-kit-react/common';
5
+ import {Card} from '@workday/canvas-kit-react/card';
6
+ import {PrimaryButton} from '@workday/canvas-kit-react/button';
7
+ import {FormField} from '@workday/canvas-kit-react/form-field';
8
+ import {TextInput} from '@workday/canvas-kit-react/text-input';
9
+ import {arrowRightSmallIcon} from '@workday/canvas-system-icons-web';
10
+ import {system} from '@workday/canvas-tokens-web';
11
+
12
+ const rtlStyles = createStyles({
13
+ paddingInlineStart: system.space.x16,
14
+ });
15
+
16
+ const rtlButtonStyles = createStyles({
17
+ ':dir(rtl)': {
18
+ svg: {
19
+ transform: 'rotate(180deg)',
20
+ },
21
+ },
22
+ });
23
+
24
+ const App = () => {
25
+ const [value, setValue] = React.useState('');
26
+
27
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
28
+ setValue(event.target.value);
29
+ };
30
+ return (
31
+ <Card>
32
+ <Card.Heading>RTL Support</Card.Heading>
33
+ <Card.Body cs={rtlStyles}>
34
+ <FormField>
35
+ <FormField.Label>Email</FormField.Label>
36
+ <FormField.Field>
37
+ <FormField.Input as={TextInput} onChange={handleChange} value={value} />
38
+ </FormField.Field>
39
+ </FormField>
40
+ <PrimaryButton cs={rtlButtonStyles} iconPosition="end" icon={arrowRightSmallIcon}>
41
+ RTL
42
+ </PrimaryButton>
43
+ </Card.Body>
44
+ </Card>
45
+ );
46
+ };
47
+
48
+ export default () => {
49
+ return (
50
+ <CanvasProvider dir="rtl">
51
+ <App />
52
+ </CanvasProvider>
53
+ );
54
+ };
@@ -0,0 +1,34 @@
1
+ import {createStyles} from '@workday/canvas-kit-styling';
2
+ import {brand, base, system} from '@workday/canvas-tokens-web';
3
+ import {CanvasProvider} from '@workday/canvas-kit-react/common';
4
+ import {Card} from '@workday/canvas-kit-react/card';
5
+ import {PrimaryButton} from '@workday/canvas-kit-react/button';
6
+
7
+ const customTheme = createStyles({
8
+ [brand.primary.base]: base.green600,
9
+ [brand.primary.dark]: base.green700,
10
+ [brand.primary.darkest]: base.green800,
11
+ [brand.common.focusOutline]: base.green600,
12
+ [system.color.fg.strong]: base.indigo900,
13
+ [system.color.border.container]: base.indigo300,
14
+ });
15
+
16
+ const App = () => {
17
+ return (
18
+ <Card>
19
+ <Card.Heading>Theming</Card.Heading>
20
+ <Card.Body>
21
+ <PrimaryButton>Theming</PrimaryButton>
22
+ <input />
23
+ </Card.Body>
24
+ </Card>
25
+ );
26
+ };
27
+
28
+ export default () => {
29
+ return (
30
+ <CanvasProvider className={customTheme}>
31
+ <App />
32
+ </CanvasProvider>
33
+ );
34
+ };
@@ -9,8 +9,7 @@ import { version } from '../../../lerna.json';
9
9
 
10
10
  ### Canvas Provider
11
11
 
12
- The `<CanvasProvider>` is required for proper branding support. Furthermore, if you use Emotion for
13
- styling your components, the `<CanvasProvider>` ensures your styles will merge as expected. Note:
12
+ If you use Emotion for styling your components, the `<CanvasProvider>` ensures your styles will merge as expected. Note:
14
13
  Custom use of `<CacheProvider>` provided by Emotion is not supported. `@workday/canvas-kit-styling`
15
14
  owns the creating of the cache reference. This ensures both static styling and Emotion’s dynamic
16
15
  styling solutions work together. In most cases you'll want to wrap your application at the root
@@ -20,9 +19,6 @@ level in `<CanvasProvider>`.
20
19
  import * as React from 'react';
21
20
  import {
22
21
  CanvasProvider,
23
- ContentDirection,
24
- PartialEmotionCanvasTheme,
25
- useTheme,
26
22
  } from '@workday/canvas-kit-react/common';
27
23
  // Ensure CSS variables are defined. You Can also do this at the root index.css
28
24
  import '@workday/canvas-tokens-web/css/base/_variables.css';
@@ -30,15 +26,8 @@ import '@workday/canvas-tokens-web/css/brand/_variables.css';
30
26
  import '@workday/canvas-tokens-web/css/system/_variables.css';
31
27
 
32
28
  export const App = () => {
33
- // useTheme is filling in the Canvas theme object if any keys are missing
34
- const canvasTheme: PartialEmotionCanvasTheme = useTheme({
35
- canvas: {
36
- // Switch to `ContentDirection.RTL` to change direction
37
- direction: ContentDirection.LTR,
38
- },
39
- });
40
29
  return (
41
- <CanvasProvider theme={canvasTheme}>
30
+ <CanvasProvider>
42
31
  <main>
43
32
  <p>Get Started With Canvas Kit</p>
44
33
  </main>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-docs",
3
- "version": "14.0.0-alpha.1252-next.0",
3
+ "version": "14.0.0-alpha.1254-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,10 +45,10 @@
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.1252-next.0",
49
- "@workday/canvas-kit-preview-react": "^14.0.0-alpha.1252-next.0",
50
- "@workday/canvas-kit-react": "^14.0.0-alpha.1252-next.0",
51
- "@workday/canvas-kit-styling": "^14.0.0-alpha.1252-next.0",
48
+ "@workday/canvas-kit-labs-react": "^14.0.0-alpha.1254-next.0",
49
+ "@workday/canvas-kit-preview-react": "^14.0.0-alpha.1254-next.0",
50
+ "@workday/canvas-kit-react": "^14.0.0-alpha.1254-next.0",
51
+ "@workday/canvas-kit-styling": "^14.0.0-alpha.1254-next.0",
52
52
  "@workday/canvas-system-icons-web": "^3.0.35",
53
53
  "@workday/canvas-tokens-web": "3.0.0-alpha.12",
54
54
  "markdown-to-jsx": "^7.2.0",
@@ -61,5 +61,5 @@
61
61
  "mkdirp": "^1.0.3",
62
62
  "typescript": "5.0"
63
63
  },
64
- "gitHead": "80e4dc6c529068c00bce5b14c625ea69a6ee63c2"
64
+ "gitHead": "a177192ec9673c8f8d71ab20c7effc6382cae308"
65
65
  }