@workday/canvas-kit-docs 15.0.0-alpha.0028-next.0 → 15.0.0-alpha.0032-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.
@@ -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": "14.1.23",
22
- "@workday/canvas-kit-preview-react": "14.1.23",
23
- "@workday/canvas-kit-react": "14.1.23",
24
- "@workday/canvas-kit-react-fonts": "^14.1.23",
25
- "@workday/canvas-kit-styling": "14.1.23",
21
+ "@workday/canvas-kit-labs-react": "14.1.24",
22
+ "@workday/canvas-kit-preview-react": "14.1.24",
23
+ "@workday/canvas-kit-react": "14.1.24",
24
+ "@workday/canvas-kit-react-fonts": "^14.1.24",
25
+ "@workday/canvas-kit-styling": "14.1.24",
26
26
  "@workday/canvas-system-icons-web": "3.0.36",
27
27
  "@workday/canvas-tokens-web": "3.1.2"
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": "14.1.23",
22
- "@workday/canvas-kit-preview-react": "14.1.23",
23
- "@workday/canvas-kit-react": "14.1.23",
24
- "@workday/canvas-kit-react-fonts": "^14.1.23",
25
- "@workday/canvas-kit-styling": "14.1.23",
21
+ "@workday/canvas-kit-labs-react": "14.1.24",
22
+ "@workday/canvas-kit-preview-react": "14.1.24",
23
+ "@workday/canvas-kit-react": "14.1.24",
24
+ "@workday/canvas-kit-react-fonts": "^14.1.24",
25
+ "@workday/canvas-kit-styling": "14.1.24",
26
26
  "@workday/canvas-system-icons-web": "3.0.36",
27
27
  "@workday/canvas-tokens-web": "3.1.2"
28
28
  },
@@ -653,33 +653,47 @@ instead.
653
653
 
654
654
  ### Modals and Dialogs
655
655
 
656
- Previously, the `usePopupStack` hook created a CSS class name that was passed to our Popups. We attached those theme styles to that class name. This allowed the theme to be available in our Popups. But it also created a cascade barrier that blocked the global theme from being applied to our Popup components.
657
- Because we now use global CSS variables, we no longer need this class name to provide the global theme to Popups. But we have to remove this generated class name to allow the global theme to be applied to Popups.
656
+ Previously, the `usePopupStack` hook created a CSS class name that was passed to our Popups. We
657
+ attached those theme styles to that class name. This allowed the theme to be available in our
658
+ Popups. But it also created a cascade barrier that blocked the global theme from being applied to
659
+ our Popup components. Because we now use global CSS variables, we no longer need this class name to
660
+ provide the global theme to Popups. But we have to remove this generated class name to allow the
661
+ global theme to be applied to Popups. Instead, only the defined theme properties from the `theme` prop from the `CanvasProvider` will be applied to Popups and Modals.
658
662
 
663
+ If you want to have scoped theming where a part of your application needs different theming, you can
664
+ still do this via the `theme` prop.
659
665
 
660
- > **Important:** Passing a `theme` to the `CanvasProvider` **will not** theme components in Modals
661
- > and Dialogs. You can either pass a `className` or define CSS variables at the root.
666
+ > **Note:** Only the properties of the theme object that are changed will be forward to popups and
667
+ > modals. IE, if you change theme.palette.primary.main, only those tokens will change for popups and
668
+ > modals.
662
669
 
663
- **Before in v13**
670
+ #### Scoped Theming vs Global Theming
671
+
672
+ **Only** use the `theme` prop on the `CanvasProvider` if you intentionally want to theme part of
673
+ your application that is different from global theming.
674
+
675
+ **Scoped Theming**
664
676
 
665
677
  ```tsx
666
- // When passing a theme to the Canvas Provider, the `usePopupStack` would grab the theme and generate a class to forward the theme to Modals and Dialogs. This would create a cascade barrier for any CSS variables deinfed at the root.
667
- <CanvasProvider theme={{canvas: {palette: {primary: {main: 'blue'}}}}}>
668
- <Modal>//... rest of modal code</Modal>
678
+
679
+ <CanvasProvider theme={{canvas: {palette: {primary: {main: 'teal'}}}}}>
680
+ {//part of your app to have different theme from the rest of your application}
669
681
  </CanvasProvider>
670
682
  ```
671
683
 
672
- **After in v14**
684
+ > **Important:** Use the `theme` prop on the `CanvasProvider` if you intentionally want to theme
685
+ > part of your application that is different from global theming.
686
+
687
+ **Global Theming**
673
688
 
674
689
  ```tsx
675
- // If you wish to still theme you application and Modals, you can either define the CSS variables at the root level of your application or define a className and pass it to the CanvasProvider.
676
- :root {
677
- --cnvs-brand-primary-base: blue;
678
- }
690
+ import '@workday/canvas-tokens-web/css/base/_variables.css';
691
+ import '@workday/canvas-tokens-web/css/brand/_variables.css';
692
+ import '@workday/canvas-tokens-web/css/system/_variables.css';
679
693
 
680
694
  <CanvasProvider>
681
- <Modal>//... rest of modal code</Modal>
682
- </CanvasProvider>
695
+ <App />
696
+ </CanvasProvider>;
683
697
  ```
684
698
  ### Search Form (Labs) 🚨
685
699
 
@@ -71,6 +71,43 @@ and scoped to the `div` that the `CanvasProvider` created. This meant that anyth
71
71
  or outside of the `CanvasProvider` would not be able to cascade down to the components within the
72
72
  `CanvasProvider`.
73
73
 
74
+ ## Global vs Scoped Theming
75
+
76
+ Canvas Kit v14 supports two theming strategies: **global theming** and **scoped theming**. Understanding the difference is important to avoid unexpected behavior.
77
+
78
+ ### Global Theming
79
+
80
+ Global theming applies CSS variables at the `:root` level, making them available throughout your entire application. This is the **recommended approach** for most use cases.
81
+
82
+ ```css
83
+ :root {
84
+ --cnvs-brand-primary-base: var(--cnvs-base-palette-magenta-600);
85
+ }
86
+ ```
87
+
88
+ ### Scoped Theming
89
+
90
+ Scoped theming applies CSS variables to a specific section of your application using the `CanvasProvider` with either a `className` or `theme` prop. The theme only affects components within that provider.
91
+
92
+ ```tsx
93
+ // Using the theme prop for scoped theming
94
+ <CanvasProvider theme={{canvas: {palette: {primary: {main: 'purple'}}}}}>
95
+ <ScopedSection />
96
+ </CanvasProvider>
97
+ ```
98
+
99
+ > **⚠️ Warning:** Scoped theming creates a cascade barrier that **will break global theming** within its scope. Any CSS variables defined at `:root` will be overridden by the scoped theme. Only the tokens explicitly defined in the `theme` prop will be changed - other tokens will use their default values, not your global overrides.
100
+
101
+ ### When to Use Scoped Theming
102
+
103
+ Only use scoped theming when you intentionally need a different theme for a specific section of your application, such as:
104
+
105
+ - Embedding a Canvas Kit component in a third-party application with a different brand
106
+ - Creating a preview panel that shows components with different themes
107
+ - Supporting multi-tenant applications where sections have different branding
108
+
109
+ For all other cases, use global theming at `:root` to ensure consistent theming throughout your application.
110
+
74
111
  ## ✅ Preferred Approach (v14+)
75
112
 
76
113
  Canvas Kit v14 promotes using CSS variables for theming, which can be applied in two ways:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-docs",
3
- "version": "15.0.0-alpha.0028-next.0",
3
+ "version": "15.0.0-alpha.0032-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": "^15.0.0-alpha.0028-next.0",
49
- "@workday/canvas-kit-preview-react": "^15.0.0-alpha.0028-next.0",
50
- "@workday/canvas-kit-react": "^15.0.0-alpha.0028-next.0",
51
- "@workday/canvas-kit-styling": "^15.0.0-alpha.0028-next.0",
48
+ "@workday/canvas-kit-labs-react": "^15.0.0-alpha.0032-next.0",
49
+ "@workday/canvas-kit-preview-react": "^15.0.0-alpha.0032-next.0",
50
+ "@workday/canvas-kit-react": "^15.0.0-alpha.0032-next.0",
51
+ "@workday/canvas-kit-styling": "^15.0.0-alpha.0032-next.0",
52
52
  "@workday/canvas-system-icons-web": "^3.0.36",
53
53
  "@workday/canvas-tokens-web": "4.0.0-alpha.3",
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": "0054a4629daac5e8d66cc4ce3ab221681677150f"
64
+ "gitHead": "f48e25e031c1287c7d5160ef76a8746fe726de1c"
65
65
  }