@workday/canvas-kit-docs 16.1.0-0569-next.0 → 16.1.0-0572-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 +66 -10
- package/dist/es6/lib/stackblitzFiles/packageJSONFile.js +5 -5
- package/dist/es6/lib/stackblitzFiles/packageJSONFile.ts +5 -5
- package/dist/mdx/16.0-UPGRADE-GUIDE.mdx +15 -0
- package/dist/mdx/react/common/mdx/Theming.mdx +5 -3
- package/dist/mdx/react/common/mdx/examples/SimplifiedSanaSetup.tsx +16 -6
- package/package.json +6 -6
package/dist/es6/lib/docs.js
CHANGED
|
@@ -228051,6 +228051,22 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
228051
228051
|
"properties": []
|
|
228052
228052
|
}
|
|
228053
228053
|
},
|
|
228054
|
+
{
|
|
228055
|
+
"name": "CanvasThemeAttributeContext",
|
|
228056
|
+
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/react/common/lib/CanvasProvider.tsx",
|
|
228057
|
+
"description": "Context for providing the `data-theme` value to popup containers.\n\nToken stylesheets scope their variables to an attribute selector (e.g. Sana's\n`[data-theme=\"sana-canvas\"]` block defines ~300 variables — palette, shape, depth, type).\nPortaled popups render under `document.body`, outside the `CanvasProvider` wrapper, so they\nnever inherit a nested `data-theme` and none of those variables resolve. Forwarding the\nattribute itself lets the popup container match the same selector, so the whole theme applies\nthrough normal cascade — rather than trying to mirror every variable as an inline style.",
|
|
228058
|
+
"declarations": [
|
|
228059
|
+
{
|
|
228060
|
+
"name": "CanvasThemeAttributeContext",
|
|
228061
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/react/common/lib/CanvasProvider.tsx"
|
|
228062
|
+
}
|
|
228063
|
+
],
|
|
228064
|
+
"tags": {},
|
|
228065
|
+
"type": {
|
|
228066
|
+
"kind": "object",
|
|
228067
|
+
"properties": []
|
|
228068
|
+
}
|
|
228069
|
+
},
|
|
228054
228070
|
{
|
|
228055
228071
|
"name": "CanvasProviderProps",
|
|
228056
228072
|
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/react/common/lib/CanvasProvider.tsx",
|
|
@@ -230899,7 +230915,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
230899
230915
|
{
|
|
230900
230916
|
"kind": "symbol",
|
|
230901
230917
|
"name": "CanvasBrandRamp",
|
|
230902
|
-
"value": "Partial<Record<\"25\" | \"50\" | \"100\" | \"200\" | \"300\" | \"400\" | \"500\" | \"600\" | \"700\" | \"800\" | \"900\" | \"950\" | \"975\" | \"A25\" | \"A50\" | \"A100\" | \"A200\", string>>"
|
|
230918
|
+
"value": "Partial<Record<\"25\" | \"50\" | \"100\" | \"200\" | \"300\" | \"400\" | \"500\" | \"600\" | \"700\" | \"800\" | \"900\" | \"950\" | \"975\" | \"A25\" | \"A50\" | \"A100\" | \"A200\" | \"A300\", string>>"
|
|
230903
230919
|
},
|
|
230904
230920
|
{
|
|
230905
230921
|
"kind": "symbol",
|
|
@@ -232812,7 +232828,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
232812
232828
|
{
|
|
232813
232829
|
"name": "sanaCanvasNumericalTheme",
|
|
232814
232830
|
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/react/common/lib/theming/sanaTheme.ts",
|
|
232815
|
-
"description": "Sana Canvas brand tokens for scoped `CanvasProvider` / popup forwarding.\nValues are `var()` references to Sana brand variables — not merged from `defaultCanvasTheme
|
|
232831
|
+
"description": "Sana Canvas brand tokens for scoped `CanvasProvider` / popup forwarding.\nValues are `var()` references to Sana brand variables — not merged from `defaultCanvasTheme`.\n\nMirrors only what Sana's stylesheet itself defines: the `neutral` ramp, the `A300` step of\n`primary`/`critical`/`caution`/`positive` (the one step Sana redefines for those families — a\nstronger alpha wash on the matching hue), and the four `system.color.brand.*` tokens Sana\noverrides. Every other key is intentionally omitted — Sana does not define a distinct value\nfor it, so writing it here would only reference the very variable being written (a `var()`\ncycle that resolves to invalid, leaking the classic-theme fallback color instead of Sana's).\n\n`action.*` and `selected.*` are deliberately **not** set. Sana's stylesheet does not define\n`--cnvs-brand-action-*` or `--cnvs-sys-color-brand-fg-selected`/`-surface-selected`; those are\nderived downstream from the root theme. Forcing them here would pin values the root is meant\nto own.\n\nRamp values must reference `base.*` (the underlying palette), never `brand.*` of the same\nname — CanvasProvider writes each entry onto the identically-named `--cnvs-brand-*` CSS\nvariable, so referencing `brand.*` here would create that same self-reference cycle. The\n`system.color.brand.*` overrides are the exception: they target *different* CSS variables\n(`--cnvs-sys-color-brand-*`) than the `brand.*` values they reference, so no cycle.\n\nNote this preset only covers brand tokens. The rest of Sana (shape, depth, type, non-brand\nsystem colors) comes from the stylesheet's `[data-theme=\"sana-canvas\"]` block — pass\n`data-theme` to `CanvasProvider` alongside this preset and it is forwarded to portaled popups\nso the full theme applies there too.",
|
|
232816
232832
|
"declarations": [
|
|
232817
232833
|
{
|
|
232818
232834
|
"name": "sanaCanvasNumericalTheme",
|
|
@@ -232829,7 +232845,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
232829
232845
|
{
|
|
232830
232846
|
"name": "sanaCanvasProviderTheme",
|
|
232831
232847
|
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/react/common/lib/theming/sanaTheme.ts",
|
|
232832
|
-
"description": "Pass to root `CanvasProvider` to forward Sana brand CSS variables onto popup containers\n(menus, selects, modals, tooltips).\n\n**When to use it**\n- **Required** when you cannot set `data-theme=\"sana-canvas\"` on `<html>` (embedded apps,\n microfrontends, third-party shells). Popups portal to `document.body` and will not inherit\n a nested `data-theme` — this preset copies Sana brand vars onto the popup stack container.\n- Also useful in tests without global Sana CSS, or custom popup hosts outside normal cascade.\n\n**When you can skip it**\n- Prefer setting `data-theme=\"sana-canvas\"` on `<html>` with Sana CSS imported. Popups then\n inherit brand variables from the document and no `theme` prop is needed.",
|
|
232848
|
+
"description": "Pass to root `CanvasProvider` to forward Sana brand CSS variables onto popup containers\n(menus, selects, modals, tooltips).\n\n**When to use it**\n- **Required** when you cannot set `data-theme=\"sana-canvas\"` on `<html>` (embedded apps,\n microfrontends, third-party shells). Popups portal to `document.body` and will not inherit\n a nested `data-theme` — this preset copies Sana brand vars onto the popup stack container.\n- Also useful in tests without global Sana CSS, or custom popup hosts outside normal cascade.\n\n**When you can skip it**\n- Prefer setting `data-theme=\"sana-canvas\"` on `<html>` with Sana CSS imported. Popups then\n inherit brand variables from the document and no `theme` prop is needed.\n\nPass `data-theme=\"sana-canvas\"` alongside it. That attribute is forwarded to popup stack\ncontainers, so the rest of Sana (shape, depth, type, non-brand system colors) applies to\nportaled content through the stylesheet's own `[data-theme=\"sana-canvas\"]` block — this preset\ncovers brand tokens, the attribute covers everything else.\n\n`action.*` and selected-state tokens are not set by this preset — Sana does not define them,\nand they resolve from the root theme.",
|
|
232833
232849
|
"declarations": [
|
|
232834
232850
|
{
|
|
232835
232851
|
"name": "sanaCanvasProviderTheme",
|
|
@@ -232837,7 +232853,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
232837
232853
|
}
|
|
232838
232854
|
],
|
|
232839
232855
|
"tags": {
|
|
232840
|
-
"example": "```tsx\n// Preferred — control <html>\nimport '@workday/canvas-tokens-web/css/sana/_variables.css';\n// <html data-theme=\"sana-canvas\">\n<CanvasProvider><App /></CanvasProvider>\n\n// No access to <html> —
|
|
232856
|
+
"example": "```tsx\n// Preferred — control <html>\nimport '@workday/canvas-tokens-web/css/sana/_variables.css';\n// <html data-theme=\"sana-canvas\">\n<CanvasProvider><App /></CanvasProvider>\n\n// No access to <html> — pass both for full parity, including portaled popups\n<CanvasProvider theme={sanaCanvasProviderTheme} data-theme=\"sana-canvas\">\n <App />\n</CanvasProvider>\n```"
|
|
232841
232857
|
},
|
|
232842
232858
|
"type": {
|
|
232843
232859
|
"kind": "symbol",
|
|
@@ -233906,6 +233922,10 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
233906
233922
|
{
|
|
233907
233923
|
"kind": "string",
|
|
233908
233924
|
"value": "A200"
|
|
233925
|
+
},
|
|
233926
|
+
{
|
|
233927
|
+
"kind": "string",
|
|
233928
|
+
"value": "A300"
|
|
233909
233929
|
}
|
|
233910
233930
|
]
|
|
233911
233931
|
},
|
|
@@ -233923,7 +233943,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
233923
233943
|
{
|
|
233924
233944
|
"name": "CanvasNeutralBrandRamp",
|
|
233925
233945
|
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/react/common/lib/theming/types.ts",
|
|
233926
|
-
"description": "Neutral brand ramp — includes Sana-only steps (`150` / `850` / `A150`) that
|
|
233946
|
+
"description": "Neutral brand ramp — includes Sana-only steps (`150` / `850` / `A150` / `A850`), plus the\nextended alpha steps (`A400`–`A975`) that only the neutral family exposes.",
|
|
233927
233947
|
"declarations": [
|
|
233928
233948
|
{
|
|
233929
233949
|
"name": "CanvasNeutralBrandRamp",
|
|
@@ -233940,7 +233960,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
233940
233960
|
{
|
|
233941
233961
|
"kind": "symbol",
|
|
233942
233962
|
"name": "CanvasBrandRamp",
|
|
233943
|
-
"value": "Partial<Record<\"25\" | \"50\" | \"100\" | \"200\" | \"300\" | \"400\" | \"500\" | \"600\" | \"700\" | \"800\" | \"900\" | \"950\" | \"975\" | \"A25\" | \"A50\" | \"A100\" | \"A200\", string>>"
|
|
233963
|
+
"value": "Partial<Record<\"25\" | \"50\" | \"100\" | \"200\" | \"300\" | \"400\" | \"500\" | \"600\" | \"700\" | \"800\" | \"900\" | \"950\" | \"975\" | \"A25\" | \"A50\" | \"A100\" | \"A200\" | \"A300\", string>>"
|
|
233944
233964
|
},
|
|
233945
233965
|
{
|
|
233946
233966
|
"kind": "symbol",
|
|
@@ -233965,6 +233985,42 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
233965
233985
|
{
|
|
233966
233986
|
"kind": "string",
|
|
233967
233987
|
"value": "A150"
|
|
233988
|
+
},
|
|
233989
|
+
{
|
|
233990
|
+
"kind": "string",
|
|
233991
|
+
"value": "A400"
|
|
233992
|
+
},
|
|
233993
|
+
{
|
|
233994
|
+
"kind": "string",
|
|
233995
|
+
"value": "A500"
|
|
233996
|
+
},
|
|
233997
|
+
{
|
|
233998
|
+
"kind": "string",
|
|
233999
|
+
"value": "A600"
|
|
234000
|
+
},
|
|
234001
|
+
{
|
|
234002
|
+
"kind": "string",
|
|
234003
|
+
"value": "A700"
|
|
234004
|
+
},
|
|
234005
|
+
{
|
|
234006
|
+
"kind": "string",
|
|
234007
|
+
"value": "A800"
|
|
234008
|
+
},
|
|
234009
|
+
{
|
|
234010
|
+
"kind": "string",
|
|
234011
|
+
"value": "A850"
|
|
234012
|
+
},
|
|
234013
|
+
{
|
|
234014
|
+
"kind": "string",
|
|
234015
|
+
"value": "A900"
|
|
234016
|
+
},
|
|
234017
|
+
{
|
|
234018
|
+
"kind": "string",
|
|
234019
|
+
"value": "A950"
|
|
234020
|
+
},
|
|
234021
|
+
{
|
|
234022
|
+
"kind": "string",
|
|
234023
|
+
"value": "A975"
|
|
233968
234024
|
}
|
|
233969
234025
|
]
|
|
233970
234026
|
},
|
|
@@ -234112,7 +234168,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
234112
234168
|
"type": {
|
|
234113
234169
|
"kind": "symbol",
|
|
234114
234170
|
"name": "CanvasBrandRamp",
|
|
234115
|
-
"value": "Partial<Record<\"25\" | \"50\" | \"100\" | \"200\" | \"300\" | \"400\" | \"500\" | \"600\" | \"700\" | \"800\" | \"900\" | \"950\" | \"975\" | \"A25\" | \"A50\" | \"A100\" | \"A200\", string>>"
|
|
234171
|
+
"value": "Partial<Record<\"25\" | \"50\" | \"100\" | \"200\" | \"300\" | \"400\" | \"500\" | \"600\" | \"700\" | \"800\" | \"900\" | \"950\" | \"975\" | \"A25\" | \"A50\" | \"A100\" | \"A200\" | \"A300\", string>>"
|
|
234116
234172
|
},
|
|
234117
234173
|
"description": "Primary brand ramp (`--cnvs-brand-primary-*`).\n\n**Shortcut (brand scope only):** when `'600'` is the only key under `primary`,\nalso sets:\n- `PrimaryButton` — `brand.action.base`, `accent.primary`, `accent.action`\n- Selected `Menu.Item` — `system.color.brand.fg.selected`, `surface.selected`\n\nDoes **not** set focus rings — use {@link CanvasNumericalBrandTheme.focus }\nor legacy `canvas.palette.common.focusOutline`.\n\n| Key | CSS variable | Typical consumers |\n|-----|--------------|-------------------|\n| `'600'` | `--cnvs-brand-primary-600` | PrimaryButton, brand links, accent.primary |\n| `'700'` | `--cnvs-brand-primary-700` | Strong primary fg, selected text |\n| `'500'` | `--cnvs-brand-primary-500` | Mid primary ramp only (not focus) |\n| `'A50'` | `--cnvs-brand-primary-A50` | Selected/hover surfaces |",
|
|
234118
234174
|
"declarations": [
|
|
@@ -234148,7 +234204,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
234148
234204
|
"type": {
|
|
234149
234205
|
"kind": "symbol",
|
|
234150
234206
|
"name": "CanvasBrandRamp",
|
|
234151
|
-
"value": "Partial<Record<\"25\" | \"50\" | \"100\" | \"200\" | \"300\" | \"400\" | \"500\" | \"600\" | \"700\" | \"800\" | \"900\" | \"950\" | \"975\" | \"A25\" | \"A50\" | \"A100\" | \"A200\", string>>"
|
|
234207
|
+
"value": "Partial<Record<\"25\" | \"50\" | \"100\" | \"200\" | \"300\" | \"400\" | \"500\" | \"600\" | \"700\" | \"800\" | \"900\" | \"950\" | \"975\" | \"A25\" | \"A50\" | \"A100\" | \"A200\" | \"A300\", string>>"
|
|
234152
234208
|
},
|
|
234153
234209
|
"description": "Critical/error ramp (`--cnvs-brand-critical-*`).\n\n| Key | Typical consumers |\n|-----|-------------------|\n| `'600'` | TextInput error, DeleteButton, critical fg |\n| `'500'` | Critical focus ring, error border |\n| `'A25'` / `'A50'` | Error surface tints |",
|
|
234154
234210
|
"declarations": [
|
|
@@ -234166,7 +234222,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
234166
234222
|
"type": {
|
|
234167
234223
|
"kind": "symbol",
|
|
234168
234224
|
"name": "CanvasBrandRamp",
|
|
234169
|
-
"value": "Partial<Record<\"25\" | \"50\" | \"100\" | \"200\" | \"300\" | \"400\" | \"500\" | \"600\" | \"700\" | \"800\" | \"900\" | \"950\" | \"975\" | \"A25\" | \"A50\" | \"A100\" | \"A200\", string>>"
|
|
234225
|
+
"value": "Partial<Record<\"25\" | \"50\" | \"100\" | \"200\" | \"300\" | \"400\" | \"500\" | \"600\" | \"700\" | \"800\" | \"900\" | \"950\" | \"975\" | \"A25\" | \"A50\" | \"A100\" | \"A200\" | \"A300\", string>>"
|
|
234170
234226
|
},
|
|
234171
234227
|
"description": "Caution/warning ramp (`--cnvs-brand-caution-*`).\n\n| Key | Typical consumers |\n|-----|-------------------|\n| `'400'` | Caution accent, TextInput caution |\n| `'500'` | Caution focus outer, caution border |\n| `'A25'` / `'A50'` | Caution surface tints |",
|
|
234172
234228
|
"declarations": [
|
|
@@ -234184,7 +234240,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
234184
234240
|
"type": {
|
|
234185
234241
|
"kind": "symbol",
|
|
234186
234242
|
"name": "CanvasBrandRamp",
|
|
234187
|
-
"value": "Partial<Record<\"25\" | \"50\" | \"100\" | \"200\" | \"300\" | \"400\" | \"500\" | \"600\" | \"700\" | \"800\" | \"900\" | \"950\" | \"975\" | \"A25\" | \"A50\" | \"A100\" | \"A200\", string>>"
|
|
234243
|
+
"value": "Partial<Record<\"25\" | \"50\" | \"100\" | \"200\" | \"300\" | \"400\" | \"500\" | \"600\" | \"700\" | \"800\" | \"900\" | \"950\" | \"975\" | \"A25\" | \"A50\" | \"A100\" | \"A200\" | \"A300\", string>>"
|
|
234188
234244
|
},
|
|
234189
234245
|
"description": "Positive/success ramp (`--cnvs-brand-positive-*`).\n\n| Key | Typical consumers |\n|-----|-------------------|\n| `'600'` | Checkbox/Radio checked, success fg |\n| `'A25'` / `'A50'` | Success surface tints |",
|
|
234190
234246
|
"declarations": [
|
|
@@ -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": "16.0.
|
|
22
|
-
"@workday/canvas-kit-preview-react": "16.0.
|
|
23
|
-
"@workday/canvas-kit-react": "16.0.
|
|
24
|
-
"@workday/canvas-kit-react-fonts": "^16.0.
|
|
25
|
-
"@workday/canvas-kit-styling": "16.0.
|
|
21
|
+
"@workday/canvas-kit-labs-react": "16.0.13",
|
|
22
|
+
"@workday/canvas-kit-preview-react": "16.0.13",
|
|
23
|
+
"@workday/canvas-kit-react": "16.0.13",
|
|
24
|
+
"@workday/canvas-kit-react-fonts": "^16.0.13",
|
|
25
|
+
"@workday/canvas-kit-styling": "16.0.13",
|
|
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": "16.0.
|
|
23
|
-
"@workday/canvas-kit-preview-react": "16.0.
|
|
24
|
-
"@workday/canvas-kit-react": "16.0.
|
|
25
|
-
"@workday/canvas-kit-react-fonts": "^16.0.
|
|
26
|
-
"@workday/canvas-kit-styling": "16.0.
|
|
22
|
+
"@workday/canvas-kit-labs-react": "16.0.13",
|
|
23
|
+
"@workday/canvas-kit-preview-react": "16.0.13",
|
|
24
|
+
"@workday/canvas-kit-react": "16.0.13",
|
|
25
|
+
"@workday/canvas-kit-react-fonts": "^16.0.13",
|
|
26
|
+
"@workday/canvas-kit-styling": "16.0.13",
|
|
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"
|
|
@@ -70,6 +70,21 @@ parent component's DOM hierarchy, and only inherit theme from `<html>`, or from
|
|
|
70
70
|
> `[data-theme="sana-canvas"]` overrides, so removing the attribute is how you get classic Canvas —
|
|
71
71
|
> there's nothing to undo it with.
|
|
72
72
|
|
|
73
|
+
**Scoped / no document-root control:** if you cannot set `data-theme` on `<html>` (embedded apps,
|
|
74
|
+
microfrontends, third-party shells), pass both `data-theme="sana-canvas"` and
|
|
75
|
+
`sanaCanvasProviderTheme` to `CanvasProvider`. The preset supplies Sana's brand variables, and
|
|
76
|
+
Canvas Kit forwards the `data-theme` attribute onto the popup stack container — so portaled
|
|
77
|
+
menus, modals, and dialogs match the same `[data-theme="sana-canvas"]` selector and pick up the
|
|
78
|
+
rest of the theme (shape, depth, type, non-brand system colors) through normal cascade:
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
import {CanvasProvider, sanaCanvasProviderTheme} from '@workday/canvas-kit-react/common';
|
|
82
|
+
|
|
83
|
+
<CanvasProvider theme={sanaCanvasProviderTheme} data-theme="sana-canvas">
|
|
84
|
+
<App />
|
|
85
|
+
</CanvasProvider>
|
|
86
|
+
```
|
|
87
|
+
|
|
73
88
|
### What Changes When You Opt In
|
|
74
89
|
|
|
75
90
|
Things that change are primary brand consumers and Sana's neutral color scale
|
|
@@ -116,9 +116,11 @@ import {CanvasProvider} from '@workday/canvas-kit-react/common';
|
|
|
116
116
|
```
|
|
117
117
|
|
|
118
118
|
**Scoped / no document-root control:** if you cannot set `data-theme` on `<html>` (embedded apps,
|
|
119
|
-
microfrontends, third-party shells),
|
|
120
|
-
|
|
121
|
-
Canvas Kit forwards
|
|
119
|
+
microfrontends, third-party shells), pass both `data-theme="sana-canvas"` and
|
|
120
|
+
`sanaCanvasProviderTheme` to `CanvasProvider`. The preset supplies Sana's brand variables, and
|
|
121
|
+
Canvas Kit forwards the `data-theme` attribute onto the popup stack container — so portaled
|
|
122
|
+
menus, modals, and dialogs match the same `[data-theme="sana-canvas"]` selector and pick up the
|
|
123
|
+
rest of the theme (shape, depth, type, non-brand system colors) through normal cascade:
|
|
122
124
|
|
|
123
125
|
```tsx
|
|
124
126
|
import {CanvasProvider, sanaCanvasProviderTheme} from '@workday/canvas-kit-react/common';
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {PrimaryButton
|
|
3
|
+
import {PrimaryButton} from '@workday/canvas-kit-react/button';
|
|
4
4
|
import {CanvasProvider, sanaCanvasProviderTheme} from '@workday/canvas-kit-react/common';
|
|
5
|
+
import {FormField} from '@workday/canvas-kit-react/form-field';
|
|
5
6
|
import {Menu} from '@workday/canvas-kit-react/menu';
|
|
6
7
|
import {Popup, useCloseOnOutsideClick, usePopupModel} from '@workday/canvas-kit-react/popup';
|
|
8
|
+
import {TextInput} from '@workday/canvas-kit-react/text-input';
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* Scoped Sana setup for popup parity: `data-theme` themes the in-tree UI, and
|
|
@@ -16,17 +18,25 @@ export default () => {
|
|
|
16
18
|
return (
|
|
17
19
|
<CanvasProvider theme={sanaCanvasProviderTheme} data-theme="sana-canvas">
|
|
18
20
|
<Popup model={myModel}>
|
|
19
|
-
<Popup.Target as={
|
|
21
|
+
<Popup.Target as={PrimaryButton}>Open Menu</Popup.Target>
|
|
20
22
|
<Popup.Popper>
|
|
21
23
|
<Popup.Card>
|
|
22
24
|
<Popup.Body>
|
|
23
|
-
<Menu>
|
|
24
|
-
<Menu.
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
<Menu initialSelectedIds={['selected']}>
|
|
26
|
+
<Menu.List role="listbox">
|
|
27
|
+
<Menu.Option data-id="selected">Option 1</Menu.Option>
|
|
28
|
+
<Menu.Option>Option 2</Menu.Option>
|
|
29
|
+
<Menu.Option>Option 3</Menu.Option>
|
|
30
|
+
</Menu.List>
|
|
27
31
|
</Menu>
|
|
28
32
|
<PrimaryButton>Hello World</PrimaryButton>
|
|
29
33
|
</Popup.Body>
|
|
34
|
+
<FormField>
|
|
35
|
+
<FormField.Label>Example text input</FormField.Label>
|
|
36
|
+
<FormField.Field>
|
|
37
|
+
<FormField.Input as={TextInput} />
|
|
38
|
+
</FormField.Field>
|
|
39
|
+
</FormField>
|
|
30
40
|
</Popup.Card>
|
|
31
41
|
</Popup.Popper>
|
|
32
42
|
</Popup>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "16.1.0-
|
|
3
|
+
"version": "16.1.0-0572-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",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"@stackblitz/sdk": "^1.11.0",
|
|
48
48
|
"@storybook/csf": "0.0.1",
|
|
49
49
|
"@workday/canvas-expressive-icons-web": "1.0.2",
|
|
50
|
-
"@workday/canvas-kit-labs-react": "^16.1.0-
|
|
51
|
-
"@workday/canvas-kit-preview-react": "^16.1.0-
|
|
52
|
-
"@workday/canvas-kit-react": "^16.1.0-
|
|
53
|
-
"@workday/canvas-kit-styling": "^16.1.0-
|
|
50
|
+
"@workday/canvas-kit-labs-react": "^16.1.0-0572-next.0",
|
|
51
|
+
"@workday/canvas-kit-preview-react": "^16.1.0-0572-next.0",
|
|
52
|
+
"@workday/canvas-kit-react": "^16.1.0-0572-next.0",
|
|
53
|
+
"@workday/canvas-kit-styling": "^16.1.0-0572-next.0",
|
|
54
54
|
"@workday/canvas-system-icons-web": "^5.0.3",
|
|
55
55
|
"@workday/canvas-tokens-web": "^4.4.0",
|
|
56
56
|
"markdown-to-jsx": "^7.2.0",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"mkdirp": "^1.0.3",
|
|
64
64
|
"typescript": "5.0"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "35d59e03767fbedf7211435a15b19031b1b2f42a"
|
|
67
67
|
}
|