@workday/canvas-kit-docs 15.0.0-alpha.0028-next.0 → 15.0.0-alpha.0041-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.
package/dist/es6/lib/docs.js
CHANGED
|
@@ -205791,7 +205791,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
205791
205791
|
{
|
|
205792
205792
|
"name": "useUniqueId",
|
|
205793
205793
|
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/react/common/lib/utils/useUniqueId.ts",
|
|
205794
|
-
"description": "Generate a unique ID if one is not provided. The generated ID will be stable across renders. Uses\n`React.useId()` if available.",
|
|
205794
|
+
"description": "Generate a unique ID if one is not provided. The generated ID will be stable across renders. Uses\n`React.useId()` if available.\n\nNote: In React 18, `useId()` generates IDs with colons (e.g., `:r0:`), which are not valid in CSS\nselectors. We transform to use unicode guillemets (`«r0»`) matching React's upcoming format\nchange (https://github.com/facebook/react/pull/32001).",
|
|
205795
205795
|
"declarations": [
|
|
205796
205796
|
{
|
|
205797
205797
|
"name": "useUniqueId",
|
|
@@ -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.
|
|
22
|
-
"@workday/canvas-kit-preview-react": "14.1.
|
|
23
|
-
"@workday/canvas-kit-react": "14.1.
|
|
24
|
-
"@workday/canvas-kit-react-fonts": "^14.1.
|
|
25
|
-
"@workday/canvas-kit-styling": "14.1.
|
|
21
|
+
"@workday/canvas-kit-labs-react": "14.1.25",
|
|
22
|
+
"@workday/canvas-kit-preview-react": "14.1.25",
|
|
23
|
+
"@workday/canvas-kit-react": "14.1.25",
|
|
24
|
+
"@workday/canvas-kit-react-fonts": "^14.1.25",
|
|
25
|
+
"@workday/canvas-kit-styling": "14.1.25",
|
|
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.
|
|
22
|
-
"@workday/canvas-kit-preview-react": "14.1.
|
|
23
|
-
"@workday/canvas-kit-react": "14.1.
|
|
24
|
-
"@workday/canvas-kit-react-fonts": "^14.1.
|
|
25
|
-
"@workday/canvas-kit-styling": "14.1.
|
|
21
|
+
"@workday/canvas-kit-labs-react": "14.1.25",
|
|
22
|
+
"@workday/canvas-kit-preview-react": "14.1.25",
|
|
23
|
+
"@workday/canvas-kit-react": "14.1.25",
|
|
24
|
+
"@workday/canvas-kit-react-fonts": "^14.1.25",
|
|
25
|
+
"@workday/canvas-kit-styling": "14.1.25",
|
|
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
|
|
657
|
-
|
|
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
|
-
> **
|
|
661
|
-
>
|
|
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
|
-
|
|
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
|
-
|
|
667
|
-
<CanvasProvider theme={{canvas: {palette: {primary: {main: '
|
|
668
|
-
|
|
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
|
-
**
|
|
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
|
-
|
|
676
|
-
|
|
677
|
-
|
|
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
|
-
<
|
|
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.
|
|
3
|
+
"version": "15.0.0-alpha.0041-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.
|
|
49
|
-
"@workday/canvas-kit-preview-react": "^15.0.0-alpha.
|
|
50
|
-
"@workday/canvas-kit-react": "^15.0.0-alpha.
|
|
51
|
-
"@workday/canvas-kit-styling": "^15.0.0-alpha.
|
|
48
|
+
"@workday/canvas-kit-labs-react": "^15.0.0-alpha.0041-next.0",
|
|
49
|
+
"@workday/canvas-kit-preview-react": "^15.0.0-alpha.0041-next.0",
|
|
50
|
+
"@workday/canvas-kit-react": "^15.0.0-alpha.0041-next.0",
|
|
51
|
+
"@workday/canvas-kit-styling": "^15.0.0-alpha.0041-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": "
|
|
64
|
+
"gitHead": "5c732d6fc6fd916b01d0077162ffdb65f7777055"
|
|
65
65
|
}
|