@workday/canvas-kit-docs 16.0.0-alpha.0499-next.0 → 16.0.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 +2801 -17
- package/dist/es6/lib/specs.js +1549 -615
- package/dist/es6/lib/stackblitzFiles/packageJSONFile.js +5 -5
- package/dist/es6/lib/stackblitzFiles/packageJSONFile.ts +5 -5
- package/dist/es6/utils/parseSpecFile.d.ts.map +1 -1
- package/dist/es6/utils/parseSpecFile.js +27 -6
- package/dist/mdx/16.0-UPGRADE-GUIDE.mdx +148 -3
- package/dist/mdx/react/common/mdx/Theming.mdx +75 -431
- package/dist/mdx/react/common/mdx/examples/SimplifiedSanaSetup.tsx +35 -0
- package/dist/mdx/react/common/mdx/examples/ThemingBrandScope.tsx +29 -0
- package/package.json +6 -6
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/CommentBoxWithCharLimit.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/CommentBoxWithCharLimit.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/CommentBoxWithCharLimit.js +0 -31
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/FilterListWithLiveStatus.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/FilterListWithLiveStatus.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/FilterListWithLiveStatus.js +0 -43
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/HiddenLiveRegion.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/HiddenLiveRegion.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/HiddenLiveRegion.js +0 -27
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/IconButtonsWithLiveBadges.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/IconButtonsWithLiveBadges.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/IconButtonsWithLiveBadges.js +0 -56
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/TextInputWithLiveError.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/TextInputWithLiveError.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/TextInputWithLiveError.js +0 -19
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/VisibleLiveRegion.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/VisibleLiveRegion.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/AriaLiveRegions/VisibleLiveRegion.js +0 -35
- package/dist/es6/mdx/accessibility/examples/GlobalHeader.d.ts +0 -8
- package/dist/es6/mdx/accessibility/examples/GlobalHeader.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/GlobalHeader.js +0 -149
- package/dist/es6/mdx/accessibility/examples/PageStructure/BreadcrumbNavRegion.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/PageStructure/BreadcrumbNavRegion.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/PageStructure/BreadcrumbNavRegion.js +0 -12
- package/dist/es6/mdx/accessibility/examples/PageStructure/FullPageDemo.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/PageStructure/FullPageDemo.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/PageStructure/FullPageDemo.js +0 -46
- package/dist/es6/mdx/accessibility/examples/PageStructure/LandmarkRegions.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/PageStructure/LandmarkRegions.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/PageStructure/LandmarkRegions.js +0 -28
- package/dist/es6/mdx/accessibility/examples/Popups/InlinePopupNoPortal.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/Popups/InlinePopupNoPortal.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/Popups/InlinePopupNoPortal.js +0 -62
- package/dist/es6/mdx/accessibility/examples/Popups/InlinePortalPopup.d.ts +0 -7
- package/dist/es6/mdx/accessibility/examples/Popups/InlinePortalPopup.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/Popups/InlinePortalPopup.js +0 -65
- package/dist/es6/mdx/accessibility/examples/Popups/PopupAriaOwns.d.ts +0 -7
- package/dist/es6/mdx/accessibility/examples/Popups/PopupAriaOwns.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/Popups/PopupAriaOwns.js +0 -46
- package/dist/es6/mdx/accessibility/examples/SidePanelWithNavigation.d.ts +0 -3
- package/dist/es6/mdx/accessibility/examples/SidePanelWithNavigation.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/SidePanelWithNavigation.js +0 -100
- package/dist/es6/mdx/accessibility/examples/SidePanelWithOverlay.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/SidePanelWithOverlay.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/SidePanelWithOverlay.js +0 -30
- package/dist/es6/mdx/accessibility/examples/Table/WithColumnHeaderFilters.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/Table/WithColumnHeaderFilters.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/Table/WithColumnHeaderFilters.js +0 -101
- package/dist/es6/mdx/accessibility/examples/Table/WithExpandableRows.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/Table/WithExpandableRows.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/Table/WithExpandableRows.js +0 -115
- package/dist/es6/mdx/accessibility/examples/Table/WithFormFields.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/Table/WithFormFields.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/Table/WithFormFields.js +0 -79
- package/dist/es6/mdx/accessibility/examples/Table/WithSelectableRows.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/Table/WithSelectableRows.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/Table/WithSelectableRows.js +0 -89
- package/dist/es6/mdx/accessibility/examples/Table/WithSortableColumnHeaders.d.ts +0 -2
- package/dist/es6/mdx/accessibility/examples/Table/WithSortableColumnHeaders.d.ts.map +0 -1
- package/dist/es6/mdx/accessibility/examples/Table/WithSortableColumnHeaders.js +0 -114
- package/dist/es6/mdx/installBlock.d.ts +0 -6
- package/dist/es6/mdx/installBlock.d.ts.map +0 -1
- package/dist/es6/mdx/installBlock.js +0 -35
- package/dist/es6/mdx/style-props/examples/Background.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/Background.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/Background.js +0 -13
- package/dist/es6/mdx/style-props/examples/Border.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/Border.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/Border.js +0 -11
- package/dist/es6/mdx/style-props/examples/Color.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/Color.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/Color.js +0 -10
- package/dist/es6/mdx/style-props/examples/Depth.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/Depth.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/Depth.js +0 -11
- package/dist/es6/mdx/style-props/examples/Flex.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/Flex.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/Flex.js +0 -9
- package/dist/es6/mdx/style-props/examples/FlexItem.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/FlexItem.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/FlexItem.js +0 -9
- package/dist/es6/mdx/style-props/examples/Grid.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/Grid.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/Grid.js +0 -7
- package/dist/es6/mdx/style-props/examples/GridItem.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/GridItem.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/GridItem.js +0 -7
- package/dist/es6/mdx/style-props/examples/Layout.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/Layout.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/Layout.js +0 -10
- package/dist/es6/mdx/style-props/examples/Other.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/Other.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/Other.js +0 -11
- package/dist/es6/mdx/style-props/examples/Position.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/Position.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/Position.js +0 -12
- package/dist/es6/mdx/style-props/examples/Space.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/Space.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/Space.js +0 -9
- package/dist/es6/mdx/style-props/examples/Text.d.ts +0 -2
- package/dist/es6/mdx/style-props/examples/Text.d.ts.map +0 -1
- package/dist/es6/mdx/style-props/examples/Text.js +0 -3
- package/dist/es6/mdx/tokens/StorybookInformationHighlight/index.d.ts +0 -2
- package/dist/es6/mdx/tokens/StorybookInformationHighlight/index.d.ts.map +0 -1
- package/dist/es6/mdx/tokens/StorybookInformationHighlight/index.js +0 -6
- package/dist/es6/mdx/versionsTable.d.ts +0 -2
- package/dist/es6/mdx/versionsTable.d.ts.map +0 -1
- package/dist/es6/mdx/versionsTable.js +0 -60
- package/dist/es6/mdx/welcomePage.d.ts +0 -2
- package/dist/es6/mdx/welcomePage.d.ts.map +0 -1
- package/dist/es6/mdx/welcomePage.js +0 -57
|
@@ -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": "
|
|
22
|
-
"@workday/canvas-kit-preview-react": "
|
|
23
|
-
"@workday/canvas-kit-react": "
|
|
24
|
-
"@workday/canvas-kit-react-fonts": "^
|
|
25
|
-
"@workday/canvas-kit-styling": "
|
|
21
|
+
"@workday/canvas-kit-labs-react": "16.0.0",
|
|
22
|
+
"@workday/canvas-kit-preview-react": "16.0.0",
|
|
23
|
+
"@workday/canvas-kit-react": "16.0.0",
|
|
24
|
+
"@workday/canvas-kit-react-fonts": "^16.0.0",
|
|
25
|
+
"@workday/canvas-kit-styling": "16.0.0",
|
|
26
26
|
"@workday/canvas-system-icons-web": "^5.0.3",
|
|
27
27
|
"@workday/canvas-expressive-icons-web": "1.0.1",
|
|
28
28
|
"@workday/canvas-tokens-web": "4.4.0-beta.11"
|
|
@@ -19,11 +19,11 @@ export const packageJSONFile = `{
|
|
|
19
19
|
"@emotion/react": "11.11.4",
|
|
20
20
|
"@types/react": "18.2.60",
|
|
21
21
|
"@types/react-dom": "18.2.19",
|
|
22
|
-
"@workday/canvas-kit-labs-react": "
|
|
23
|
-
"@workday/canvas-kit-preview-react": "
|
|
24
|
-
"@workday/canvas-kit-react": "
|
|
25
|
-
"@workday/canvas-kit-react-fonts": "^
|
|
26
|
-
"@workday/canvas-kit-styling": "
|
|
22
|
+
"@workday/canvas-kit-labs-react": "16.0.0",
|
|
23
|
+
"@workday/canvas-kit-preview-react": "16.0.0",
|
|
24
|
+
"@workday/canvas-kit-react": "16.0.0",
|
|
25
|
+
"@workday/canvas-kit-react-fonts": "^16.0.0",
|
|
26
|
+
"@workday/canvas-kit-styling": "16.0.0",
|
|
27
27
|
"@workday/canvas-system-icons-web": "^5.0.3",
|
|
28
28
|
"@workday/canvas-expressive-icons-web": "1.0.1",
|
|
29
29
|
"@workday/canvas-tokens-web": "4.4.0-beta.11"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseSpecFile.d.ts","sourceRoot":"","sources":["../../../utils/parseSpecFile.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,CAAC,aAAa,GAAG,OAAO,CAAC,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,CAAC,aAAa,GAAG,OAAO,CAAC,EAAE,CAAC;CACvC;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"parseSpecFile.d.ts","sourceRoot":"","sources":["../../../utils/parseSpecFile.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,CAAC,aAAa,GAAG,OAAO,CAAC,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,CAAC,aAAa,GAAG,OAAO,CAAC,EAAE,CAAC;CACvC;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAsG3E"}
|
|
@@ -15,14 +15,35 @@ export async function parseSpecFile(file) {
|
|
|
15
15
|
const contents = await fs
|
|
16
16
|
.readFile(file)
|
|
17
17
|
.then(contents => contents.toString())
|
|
18
|
-
.then(contents =>
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
.then(contents =>
|
|
19
|
+
// Strip imports before transpile. Use [\s\S] so multiline named imports are matched —
|
|
20
|
+
// otherwise typescript.transpile leaves `require(...)` calls that fail under eval.
|
|
21
|
+
contents.replace(/import\s+([\s\S]+?)\s+from\s+['"][^'"]+['"];?/g, (_substr, imports) => {
|
|
22
|
+
const trimmed = imports.trim();
|
|
23
|
+
if (trimmed.includes('{')) {
|
|
24
|
+
const names = trimmed
|
|
25
|
+
.replace(/[{}]/g, '')
|
|
26
|
+
.split(',')
|
|
27
|
+
.map(part => {
|
|
28
|
+
// support `Foo as Bar` and whitespace/newlines
|
|
29
|
+
const pieces = part
|
|
30
|
+
.trim()
|
|
31
|
+
.split(/\s+as\s+|\s+/)
|
|
32
|
+
.filter(Boolean);
|
|
33
|
+
return pieces[pieces.length - 1];
|
|
34
|
+
})
|
|
35
|
+
.filter(Boolean);
|
|
36
|
+
// Stub as both a component and a CSF story object (`Example.render`)
|
|
37
|
+
return names
|
|
38
|
+
.map(name => `const ${name} = Object.assign(() => {}, {render: () => {}});`)
|
|
39
|
+
.join('\n');
|
|
21
40
|
}
|
|
22
|
-
if (/react/
|
|
23
|
-
return `const React = {createElement: () => {}}
|
|
41
|
+
if (/react/i.test(trimmed)) {
|
|
42
|
+
return `const React = {createElement: () => {}};`;
|
|
24
43
|
}
|
|
25
|
-
|
|
44
|
+
// default / namespace imports — stub the binding name
|
|
45
|
+
const name = trimmed.replace(/^\*\s+as\s+/, '').trim();
|
|
46
|
+
return name ? `const ${name} = () => {};` : '';
|
|
26
47
|
})) // remove imports
|
|
27
48
|
.then(contents => typescript.transpile(contents, { jsx: typescript.JsxEmit.React }))
|
|
28
49
|
.then(contents => {
|
|
@@ -6,10 +6,157 @@ any questions.
|
|
|
6
6
|
|
|
7
7
|
## Why You Should Upgrade
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Canvas Kit v16 is a 1:1 component update that aligns every Canvas component to Sana's visual
|
|
10
|
+
styling. Components ship that styling regardless of theme — you do not need to opt into the Sana
|
|
11
|
+
Canvas theme for components to look correct.
|
|
12
|
+
|
|
13
|
+
The Sana Canvas **theme** (CSS variables + `data-theme="sana-canvas"`) is a separate, opt-in step
|
|
14
|
+
that updates brand colors, neutrals, surfaces, and shapes at the application level. See
|
|
15
|
+
[Sana Canvas Theme](#sana-canvas-theme) below.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## Sana Canvas Theme
|
|
19
|
+
|
|
20
|
+
Your application is Sana-aligned out of the box when the Sana Canvas theme is applied. To opt in —
|
|
21
|
+
brand neutrals, surfaces, and shapes — import the Sana CSS variables and set
|
|
22
|
+
`data-theme="sana-canvas"` on `<html>`.
|
|
23
|
+
|
|
24
|
+
> **Note:** All visual updates in this guide apply to both the Default Canvas theme and the Sana
|
|
25
|
+
> Canvas theme unless specified otherwise.
|
|
26
|
+
|
|
27
|
+
### Opting In
|
|
28
|
+
|
|
29
|
+
Import the Sana variables **last** in your root CSS entry point. Sana's `[data-theme="sana-canvas"]`
|
|
30
|
+
selector and `:root` have equal specificity — source order determines the winner.
|
|
31
|
+
|
|
32
|
+
```css
|
|
33
|
+
/* index.css — order matters */
|
|
34
|
+
@import '@workday/canvas-tokens-web/css/base/_variables.css';
|
|
35
|
+
@import '@workday/canvas-tokens-web/css/brand/_variables.css';
|
|
36
|
+
@import '@workday/canvas-tokens-web/css/component/_variables.css';
|
|
37
|
+
@import '@workday/canvas-tokens-web/css/system/_variables.css';
|
|
38
|
+
/* Sana last: [data-theme="sana-canvas"] and :root have equal specificity (0,1,0),
|
|
39
|
+
so when both match <html> the cascade falls back to source order. */
|
|
40
|
+
@import '@workday/canvas-tokens-web/css/sana/_variables.css';
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Set `data-theme="sana-canvas"` on `<html>` when you control the document root (preferred). Nested
|
|
44
|
+
elements are not enough for portaled popups (including all Canvas Kit popups such as menus,
|
|
45
|
+
selects, modals, and toasts) — those render under `document.body` via React portals, outside the
|
|
46
|
+
parent component's DOM hierarchy, and only inherit theme from `<html>`, or from
|
|
47
|
+
`sanaCanvasProviderTheme` on `CanvasProvider` when `<html>` is unavailable.
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<html lang="en" data-theme="sana-canvas"></html>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
> **Gotcha:** There is no `[data-theme="canvas"]` rule. The sana file only defines
|
|
54
|
+
> `[data-theme="sana-canvas"]` overrides, so removing the attribute is how you get classic Canvas —
|
|
55
|
+
> there's nothing to undo it with.
|
|
56
|
+
|
|
57
|
+
### What Changes When You Opt In
|
|
58
|
+
|
|
59
|
+
Things that change are primary brand consumers and Sana's neutral color scale
|
|
60
|
+
(`--cnvs-brand-neutral-*`, which replaces classic slate neutrals). Verified against
|
|
61
|
+
`@workday/canvas-tokens-web/css/sana/_variables.css`:
|
|
62
|
+
|
|
63
|
+
- **Brand primary consumers flip.** `--cnvs-sys-color-brand-accent-primary` and `-accent-action`
|
|
64
|
+
re-point from blue to `--cnvs-brand-neutral-975`, and `-brand-fg-primary-default/-strong` to
|
|
65
|
+
`--cnvs-brand-neutral-a900/-a950`. `PrimaryButton`, brand links, and selected states are what
|
|
66
|
+
visibly change.
|
|
67
|
+
- **Focus does not.** `--cnvs-sys-color-brand-focus-primary` and `-border-primary` stay `blue-500`.
|
|
68
|
+
- **`--cnvs-brand-primary-600` is intentionally _not_ redefined** — it stays the consumer's brand
|
|
69
|
+
hook.
|
|
70
|
+
- **The full neutral color scale is replaced** (`--cnvs-brand-neutral-*`, all steps plus alphas),
|
|
71
|
+
plus selected `critical`, `caution`, `positive`, shapes (`sm`, `xs`, `xxl`, `xxxl`),
|
|
72
|
+
surfaces/overlays, and chart ramps.
|
|
73
|
+
|
|
74
|
+
### Scoped Theming
|
|
75
|
+
|
|
76
|
+
The `CanvasProvider` theming updates in
|
|
77
|
+
[#4060](https://github.com/Workday/canvas-kit/pull/4060) are for **scoped** use cases — embedding
|
|
78
|
+
Canvas in another brand, multi-tenant sections, and popup parity when you cannot set
|
|
79
|
+
`data-theme="sana-canvas"` on `<html>`. Application teams that control `<html>` and import the
|
|
80
|
+
Sana variables globally do not need a `theme` prop for app-wide Sana.
|
|
81
|
+
|
|
82
|
+
For the scoped theming API, see our
|
|
83
|
+
[Theming documentation](https://workday.github.io/canvas-kit/?path=/docs/features-theming-overview--docs).
|
|
84
|
+
|
|
85
|
+
#### Default Scope Change for Legacy Themes
|
|
86
|
+
|
|
87
|
+
**Important:** If you previously used `canvas.palette.<color>.main` only (without other palette properties)
|
|
88
|
+
to scope-theme your application, the default behavior has changed. In v16:
|
|
89
|
+
|
|
90
|
+
- **Before v16:** Setting only `palette.primary.main` would automatically generate a full color ramp
|
|
91
|
+
(lightest, lighter, light, dark, darkest, contrast) and apply broad `system.color.brand.*` forwarding.
|
|
92
|
+
- **In v16:** Setting only `palette.primary.main` defaults to `'brand'` scope, which applies a narrower
|
|
93
|
+
set of variables (PrimaryButton and selected states only).
|
|
94
|
+
|
|
95
|
+
To restore the previous behavior, explicitly set `themeScope: 'full'`:
|
|
96
|
+
|
|
97
|
+
```jsx
|
|
98
|
+
// v15 behavior (implicit full scope)
|
|
99
|
+
<CanvasProvider theme={{canvas: {palette: {primary: {main: '#FF00FF'}}}}} />
|
|
100
|
+
|
|
101
|
+
// v16 - to get the same behavior as v15
|
|
102
|
+
<CanvasProvider
|
|
103
|
+
theme={{canvas: {palette: {primary: {main: '#FF00FF'}}}}}
|
|
104
|
+
themeScope="full"
|
|
105
|
+
/>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
This change provides more control over theming scope and prevents unintended overrides, but teams
|
|
109
|
+
relying on the auto-generated color ramp need to explicitly opt into `'full'` scope.
|
|
110
|
+
|
|
111
|
+
### Simplified Sana Canvas Setup
|
|
112
|
+
|
|
113
|
+
If you can set `data-theme="sana-canvas"` on `<html>`, you no longer need to pass
|
|
114
|
+
`sanaCanvasProviderTheme` to CanvasProvider. Popups are called out specifically because Canvas Kit
|
|
115
|
+
renders them through React portals under `document.body` — outside the parent component's DOM
|
|
116
|
+
hierarchy — so they inherit CSS variables from `<html>`, not from a nested wrapper.
|
|
117
|
+
|
|
118
|
+
**Before:**
|
|
119
|
+
```tsx
|
|
120
|
+
import {CanvasProvider, sanaCanvasProviderTheme} from '@workday/canvas-kit-react/common';
|
|
121
|
+
|
|
122
|
+
<CanvasProvider theme={sanaCanvasProviderTheme}>
|
|
123
|
+
<App />
|
|
124
|
+
</CanvasProvider>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**After (when you control `<html>`):**
|
|
128
|
+
```tsx
|
|
129
|
+
import {CanvasProvider} from '@workday/canvas-kit-react/common';
|
|
130
|
+
|
|
131
|
+
// <html data-theme="sana-canvas">
|
|
132
|
+
<CanvasProvider>
|
|
133
|
+
<App />
|
|
134
|
+
</CanvasProvider>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Still required — cannot set `data-theme` on `<html>`:** embedded apps, microfrontends, and
|
|
138
|
+
third-party shells often cannot set attributes on the document root. Nested `data-theme` does not
|
|
139
|
+
reach portaled popups (including all Canvas Kit popups such as menus, selects, modals, and toasts).
|
|
140
|
+
Pass both `data-theme="sana-canvas"` (in-tree UI) and `sanaCanvasProviderTheme` (popup forwarding):
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
import {CanvasProvider, sanaCanvasProviderTheme} from '@workday/canvas-kit-react/common';
|
|
144
|
+
|
|
145
|
+
<CanvasProvider theme={sanaCanvasProviderTheme} data-theme="sana-canvas">
|
|
146
|
+
<App />
|
|
147
|
+
</CanvasProvider>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
If you control `<html>` and see a console warning about unnecessary theme usage, you can safely
|
|
151
|
+
remove the theme prop.
|
|
10
152
|
|
|
11
153
|
## Table of Contents
|
|
12
154
|
|
|
155
|
+
- [Sana Canvas Theme](#sana-canvas-theme)
|
|
156
|
+
- [Opting In](#opting-in)
|
|
157
|
+
- [What Changes When You Opt In](#what-changes-when-you-opt-in)
|
|
158
|
+
- [Scoped Theming](#scoped-theming)
|
|
159
|
+
- [Simplified Sana Canvas Setup](#simplified-sana-canvas-setup)
|
|
13
160
|
- [Codemod](#codemod)
|
|
14
161
|
- [Instructions](#instructions)
|
|
15
162
|
- [Codemod Transformations for Icons](#codemod-transformations-for-icons)
|
|
@@ -643,8 +790,6 @@ If you customize `brand.success.base` in your theme, please verify the following
|
|
|
643
790
|
- Prefer a `brand.success.base` value that is dark enough to pair with a light foreground. If your
|
|
644
791
|
brand requires a light success color, you may need to override the component styles so the
|
|
645
792
|
foreground uses a darker, paired contrast color instead of white.
|
|
646
|
-
> **Note:** All visual updates apply to both the Default Canvas theme and new Sana Canvas theme
|
|
647
|
-
> unless specified otherwise.
|
|
648
793
|
|
|
649
794
|
#### Checkbox
|
|
650
795
|
|