@workday/canvas-kit-docs 15.0.0-alpha.1303-next.0 → 15.0.0-alpha.1326-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 +8234 -64
- package/dist/es6/lib/stackblitzFiles/packageJSONFile.js +5 -5
- package/dist/es6/lib/stackblitzFiles/packageJSONFile.ts +5 -5
- package/dist/mdx/14.0-UPGRADE-GUIDE.mdx +36 -5
- package/dist/mdx/15.0-UPGRADE-GUIDE.mdx +8 -0
- package/dist/mdx/preview-react/avatar/examples/Decorative.tsx +1 -1
- package/dist/mdx/preview-react/avatar/examples/nicholas-avatar.jpg +0 -0
- package/dist/mdx/react/_examples/mdx/ContextualHelp.mdx +36 -0
- package/dist/mdx/react/_examples/mdx/examples/ContextualHelp/ContextualHelpDialogFocusRedirect.tsx +75 -0
- package/dist/mdx/react/_examples/mdx/examples/ContextualHelp/ContextualHelpDialogFocusTrap.tsx +77 -0
- package/dist/mdx/react/_examples/mdx/examples/ContextualHelp/ContextualHelpTooltip.tsx +42 -0
- package/dist/mdx/react/common/mdx/Theming.mdx +30 -0
- package/package.json +7 -7
- package/dist/mdx/preview-react/avatar/examples/nicholas-avatar.png +0 -0
|
@@ -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.
|
|
22
|
-
"@workday/canvas-kit-preview-react": "14.
|
|
23
|
-
"@workday/canvas-kit-react": "14.
|
|
24
|
-
"@workday/canvas-kit-react-fonts": "^14.
|
|
25
|
-
"@workday/canvas-kit-styling": "14.
|
|
21
|
+
"@workday/canvas-kit-labs-react": "14.1.10",
|
|
22
|
+
"@workday/canvas-kit-preview-react": "14.1.10",
|
|
23
|
+
"@workday/canvas-kit-react": "14.1.10",
|
|
24
|
+
"@workday/canvas-kit-react-fonts": "^14.1.10",
|
|
25
|
+
"@workday/canvas-kit-styling": "14.1.10",
|
|
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.
|
|
22
|
-
"@workday/canvas-kit-preview-react": "14.
|
|
23
|
-
"@workday/canvas-kit-react": "14.
|
|
24
|
-
"@workday/canvas-kit-react-fonts": "^14.
|
|
25
|
-
"@workday/canvas-kit-styling": "14.
|
|
21
|
+
"@workday/canvas-kit-labs-react": "14.1.10",
|
|
22
|
+
"@workday/canvas-kit-preview-react": "14.1.10",
|
|
23
|
+
"@workday/canvas-kit-react": "14.1.10",
|
|
24
|
+
"@workday/canvas-kit-react-fonts": "^14.1.10",
|
|
25
|
+
"@workday/canvas-kit-styling": "14.1.10",
|
|
26
26
|
"@workday/canvas-system-icons-web": "3.0.36",
|
|
27
27
|
"@workday/canvas-tokens-web": "3.1.2"
|
|
28
28
|
},
|
|
@@ -38,6 +38,7 @@ visual reference of what's changed.**
|
|
|
38
38
|
- [Expandable](#expandable)
|
|
39
39
|
- [Hyperlink and External Hyperlink](#hyperlink-and-external-hyperlink)
|
|
40
40
|
- [Loading Dots](#loading-dots)
|
|
41
|
+
- [Modals and Dialogs](#modals-and-dialogs)
|
|
41
42
|
- [Pill (Preview)](#pill-preview)
|
|
42
43
|
- [Search Form (Labs)](#search-form-labs-)
|
|
43
44
|
- [Status Indicator (Preview)](#status-indicator-preview-)
|
|
@@ -55,7 +56,7 @@ visual reference of what's changed.**
|
|
|
55
56
|
- [Deprecated Buttons](#deprecated-buttons)
|
|
56
57
|
- [Input Provider](#input-provider)
|
|
57
58
|
- [Menu (Preview)](#menu-preview)
|
|
58
|
-
- [
|
|
59
|
+
- [readOnlyPillStencil and removeablePillStencil](#readonlypillstencil-and-removeablepillstencil)
|
|
59
60
|
- [Text Area (Labs)](#text-area)
|
|
60
61
|
- [Text Input (Labs)](#text-input)
|
|
61
62
|
- [Troubleshooting](#troubleshooting)
|
|
@@ -629,7 +630,7 @@ provide a value for the `name` prop.
|
|
|
629
630
|
The `Pill` component no longer supports `default` as a value for the `variant` prop. If the
|
|
630
631
|
`variant` prop is not provided, the component will use its default styling.
|
|
631
632
|
|
|
632
|
-
`
|
|
633
|
+
`readOnlyPillStencil` and `removeablePillStencil` have been removed. Please use `pillStencil`
|
|
633
634
|
instead.
|
|
634
635
|
|
|
635
636
|
**Before in v13**
|
|
@@ -650,6 +651,36 @@ instead.
|
|
|
650
651
|
</Pill>
|
|
651
652
|
```
|
|
652
653
|
|
|
654
|
+
### Modals and Dialogs
|
|
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.
|
|
658
|
+
|
|
659
|
+
|
|
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.
|
|
662
|
+
|
|
663
|
+
**Before in v13**
|
|
664
|
+
|
|
665
|
+
```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>
|
|
669
|
+
</CanvasProvider>
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
**After in v14**
|
|
673
|
+
|
|
674
|
+
```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
|
+
}
|
|
679
|
+
|
|
680
|
+
<CanvasProvider>
|
|
681
|
+
<Modal>//... rest of modal code</Modal>
|
|
682
|
+
</CanvasProvider>
|
|
683
|
+
```
|
|
653
684
|
### Search Form (Labs) 🚨
|
|
654
685
|
|
|
655
686
|
**PR:** [#3303](https://github.com/Workday/canvas-kit/pull/3303)
|
|
@@ -908,9 +939,9 @@ const buttonStyles = createStyles({
|
|
|
908
939
|
We've removed `Menu` from `@workday/canvas-kit-preview-react`. Please use
|
|
909
940
|
[Menu](/components/popups/menu/) from `@workday/canvas-kit-react` instead.
|
|
910
941
|
|
|
911
|
-
###
|
|
942
|
+
### readOnlyPillStencil and removeablePillStencil
|
|
912
943
|
|
|
913
|
-
The `
|
|
944
|
+
The `readOnlyPillStencil` and `removeablePillStencil` utilities have been removed from the Pill
|
|
914
945
|
package. Please use `pillStencil` instead.
|
|
915
946
|
|
|
916
947
|
### Text Area (Preview)
|
|
@@ -966,7 +997,7 @@ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
|
|
|
966
997
|
**After in v14**
|
|
967
998
|
|
|
968
999
|
```tsx
|
|
969
|
-
import {TextArea} from '@workday/canvas-kit-react/text-
|
|
1000
|
+
import {TextArea} from '@workday/canvas-kit-react/text-area';
|
|
970
1001
|
import {FormField} from '@workday/canvas-kit-react/form-field';
|
|
971
1002
|
|
|
972
1003
|
<FormField>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Avatar} from '@workday/canvas-kit-preview-react/avatar';
|
|
2
2
|
// @ts-ignore
|
|
3
|
-
import nicholasAvatar from './nicholas-avatar.
|
|
3
|
+
import nicholasAvatar from './nicholas-avatar.jpg';
|
|
4
4
|
import {createStyles} from '@workday/canvas-kit-styling';
|
|
5
5
|
import {Text} from '@workday/canvas-kit-react/text';
|
|
6
6
|
import {system} from '@workday/canvas-tokens-web';
|
|
Binary file
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {ExampleCodeBlock} from '@workday/canvas-kit-docs';
|
|
2
|
+
import ContextualHelpTooltip from './examples/ContextualHelp/ContextualHelpTooltip';
|
|
3
|
+
import ContextualHelpDialogFocusRedirect from './examples/ContextualHelp/ContextualHelpDialogFocusRedirect';
|
|
4
|
+
import ContextualHelpDialogFocusTrap from './examples/ContextualHelp/ContextualHelpDialogFocusTrap';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Contextual Help
|
|
9
|
+
|
|
10
|
+
### Tooltip
|
|
11
|
+
A Canvas Kit `Tooltip` can be used to provide additional information about why an element is disabled.
|
|
12
|
+
We should not, however, put one directly onto a disabled element because disabled elements do not receive focus
|
|
13
|
+
(meaning the tooltip content is not accessible to keyboard users). Instead, we should provide a button next to the disabled
|
|
14
|
+
element and apply the `Tooltip` to the button.
|
|
15
|
+
|
|
16
|
+
**Note: We should avoid passing the `type` prop to the `Tooltip`. The default behavior is to assign an `aria-label` to the button
|
|
17
|
+
(which is what we want)**
|
|
18
|
+
<ExampleCodeBlock code={ContextualHelpTooltip} />
|
|
19
|
+
|
|
20
|
+
### Contextual Help Popup Without Focus Trap
|
|
21
|
+
If one would like to provide a bit more content than a `Tooltip` will allow (such as buttons or links) a popup should be used.
|
|
22
|
+
In this example, a `Dialog` is used in conjunction with the `useFocusRedirect` hook to display some text and a link. It will
|
|
23
|
+
not trap focus; instead, it will close and focus the next element if the user tabs out or clicks away. A `Tooltip` is still
|
|
24
|
+
used on the `Dialog.Target` component so that it remains accessible for screen readers.
|
|
25
|
+
|
|
26
|
+
`Dialog` inserts an invisible `<div>` element right after the button with an `aria-owns` attribute pointing to the
|
|
27
|
+
`Dialog.Card`. This allows screen readers to read the popup contents in a logical order with the target. In other words, the
|
|
28
|
+
screen reader will announce the `Dialog` right after the open button instead of out of order.
|
|
29
|
+
|
|
30
|
+
Additionally, we apply `aria-describedby` to our `Dialog.Target` to associate it with the `FormField.Label`.
|
|
31
|
+
<ExampleCodeBlock code={ContextualHelpDialogFocusRedirect} />
|
|
32
|
+
|
|
33
|
+
### Contextual Help Dialog With Focus Trap
|
|
34
|
+
The `useFocusTrap` hook can be used in contextual help where trapping focus within the `Dialog` is the goal. In this case,
|
|
35
|
+
focus will remain in the `Dialog` until it is closed. This example is otherwise identical to the one above.
|
|
36
|
+
<ExampleCodeBlock code={ContextualHelpDialogFocusTrap} />
|
package/dist/mdx/react/_examples/mdx/examples/ContextualHelp/ContextualHelpDialogFocusRedirect.tsx
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {Hyperlink, TertiaryButton} from '@workday/canvas-kit-react/button';
|
|
2
|
+
import {infoIcon} from '@workday/canvas-system-icons-web';
|
|
3
|
+
import {Tooltip} from '@workday/canvas-kit-react/tooltip';
|
|
4
|
+
import {FormField} from '@workday/canvas-kit-react/form-field';
|
|
5
|
+
import {TextInput} from '@workday/canvas-kit-react/text-input';
|
|
6
|
+
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
7
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
8
|
+
import {createStyles} from '@workday/canvas-kit-styling';
|
|
9
|
+
import {Dialog, useDialogModel} from '@workday/canvas-kit-react/dialog';
|
|
10
|
+
import {
|
|
11
|
+
useCloseOnEscape,
|
|
12
|
+
useCloseOnOutsideClick,
|
|
13
|
+
useFocusRedirect,
|
|
14
|
+
useInitialFocus,
|
|
15
|
+
useReturnFocus,
|
|
16
|
+
} from '@workday/canvas-kit-react/popup';
|
|
17
|
+
import {useUniqueId} from '@workday/canvas-kit-react/common';
|
|
18
|
+
|
|
19
|
+
const containerStyles = createStyles({
|
|
20
|
+
flexDirection: 'row',
|
|
21
|
+
gap: system.space.x2,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const labelStyles = createStyles({
|
|
25
|
+
minWidth: 'unset',
|
|
26
|
+
width: '100%',
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export function ContextualHelpDialogFocusRedirect() {
|
|
30
|
+
const dialogModel = useDialogModel();
|
|
31
|
+
useCloseOnOutsideClick(dialogModel);
|
|
32
|
+
useCloseOnEscape(dialogModel);
|
|
33
|
+
useInitialFocus(dialogModel);
|
|
34
|
+
useFocusRedirect(dialogModel);
|
|
35
|
+
useReturnFocus(dialogModel);
|
|
36
|
+
|
|
37
|
+
const labelId = useUniqueId();
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Flex>
|
|
41
|
+
<FormField>
|
|
42
|
+
<Flex className={containerStyles}>
|
|
43
|
+
<FormField.Label className={labelStyles} id={labelId}>
|
|
44
|
+
Country
|
|
45
|
+
</FormField.Label>
|
|
46
|
+
<Dialog model={dialogModel}>
|
|
47
|
+
<Tooltip title="More Info">
|
|
48
|
+
<Dialog.Target
|
|
49
|
+
as={TertiaryButton}
|
|
50
|
+
size="small"
|
|
51
|
+
icon={infoIcon}
|
|
52
|
+
aria-describedby={labelId}
|
|
53
|
+
/>
|
|
54
|
+
</Tooltip>
|
|
55
|
+
<Dialog.Popper placement="right">
|
|
56
|
+
<Dialog.Card>
|
|
57
|
+
<Dialog.CloseIcon aria-label="Close" />
|
|
58
|
+
<Dialog.Heading paddingTop={system.space.x6}>Information</Dialog.Heading>
|
|
59
|
+
<Dialog.Body>
|
|
60
|
+
This dialog does not trap focus, so tabbing out of it will cause it to close
|
|
61
|
+
</Dialog.Body>
|
|
62
|
+
<Flex gap={system.space.x4} padding={system.space.x2} marginTop={system.space.x2}>
|
|
63
|
+
<Hyperlink href="/">Link</Hyperlink>
|
|
64
|
+
</Flex>
|
|
65
|
+
</Dialog.Card>
|
|
66
|
+
</Dialog.Popper>
|
|
67
|
+
</Dialog>
|
|
68
|
+
</Flex>
|
|
69
|
+
<FormField.Field>
|
|
70
|
+
<FormField.Input as={TextInput} />
|
|
71
|
+
</FormField.Field>
|
|
72
|
+
</FormField>
|
|
73
|
+
</Flex>
|
|
74
|
+
);
|
|
75
|
+
}
|
package/dist/mdx/react/_examples/mdx/examples/ContextualHelp/ContextualHelpDialogFocusTrap.tsx
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {Hyperlink, TertiaryButton} from '@workday/canvas-kit-react/button';
|
|
2
|
+
import {infoIcon} from '@workday/canvas-system-icons-web';
|
|
3
|
+
import {Tooltip} from '@workday/canvas-kit-react/tooltip';
|
|
4
|
+
import {FormField} from '@workday/canvas-kit-react/form-field';
|
|
5
|
+
import {TextInput} from '@workday/canvas-kit-react/text-input';
|
|
6
|
+
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
7
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
8
|
+
import {createStyles} from '@workday/canvas-kit-styling';
|
|
9
|
+
import {
|
|
10
|
+
useCloseOnEscape,
|
|
11
|
+
useCloseOnOutsideClick,
|
|
12
|
+
useFocusTrap,
|
|
13
|
+
useInitialFocus,
|
|
14
|
+
usePopupModel,
|
|
15
|
+
useReturnFocus,
|
|
16
|
+
} from '@workday/canvas-kit-react/popup';
|
|
17
|
+
import {Dialog} from '@workday/canvas-kit-react/dialog';
|
|
18
|
+
import {useUniqueId} from '@workday/canvas-kit-react/common';
|
|
19
|
+
|
|
20
|
+
const containerStyles = createStyles({
|
|
21
|
+
flexDirection: 'row',
|
|
22
|
+
gap: system.space.x2,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const labelStyles = createStyles({
|
|
26
|
+
minWidth: 'unset',
|
|
27
|
+
width: '100%',
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export function ContextualHelpDialogFocusTrap() {
|
|
31
|
+
const dialogModel = usePopupModel();
|
|
32
|
+
useCloseOnOutsideClick(dialogModel);
|
|
33
|
+
useCloseOnEscape(dialogModel);
|
|
34
|
+
useInitialFocus(dialogModel);
|
|
35
|
+
useFocusTrap(dialogModel);
|
|
36
|
+
useReturnFocus(dialogModel);
|
|
37
|
+
|
|
38
|
+
const labelId = useUniqueId();
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Flex>
|
|
42
|
+
<FormField>
|
|
43
|
+
<Flex className={containerStyles}>
|
|
44
|
+
<FormField.Label className={labelStyles} id={labelId}>
|
|
45
|
+
Name
|
|
46
|
+
</FormField.Label>
|
|
47
|
+
<Dialog model={dialogModel}>
|
|
48
|
+
<Tooltip title="More Info">
|
|
49
|
+
<Dialog.Target
|
|
50
|
+
as={TertiaryButton}
|
|
51
|
+
size="small"
|
|
52
|
+
icon={infoIcon}
|
|
53
|
+
aria-describedby={labelId}
|
|
54
|
+
/>
|
|
55
|
+
</Tooltip>
|
|
56
|
+
<Dialog.Popper placement="right">
|
|
57
|
+
<Dialog.Card>
|
|
58
|
+
<Dialog.CloseIcon aria-label="Close" />
|
|
59
|
+
<Dialog.Heading paddingTop={system.space.x6}>Information</Dialog.Heading>
|
|
60
|
+
<Dialog.Body>
|
|
61
|
+
This dialog traps focus. Focus will only return to the rest of the page when the
|
|
62
|
+
dialog is closed
|
|
63
|
+
</Dialog.Body>
|
|
64
|
+
<Flex gap={system.space.x4} padding={system.space.x2} marginTop={system.space.x2}>
|
|
65
|
+
<Hyperlink href="/">Link</Hyperlink>
|
|
66
|
+
</Flex>
|
|
67
|
+
</Dialog.Card>
|
|
68
|
+
</Dialog.Popper>
|
|
69
|
+
</Dialog>
|
|
70
|
+
</Flex>
|
|
71
|
+
<FormField.Field>
|
|
72
|
+
<FormField.Input as={TextInput} />
|
|
73
|
+
</FormField.Field>
|
|
74
|
+
</FormField>
|
|
75
|
+
</Flex>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {PrimaryButton, TertiaryButton} from '@workday/canvas-kit-react/button';
|
|
2
|
+
import {infoIcon} from '@workday/canvas-system-icons-web';
|
|
3
|
+
import {Tooltip} from '@workday/canvas-kit-react/tooltip';
|
|
4
|
+
import {FormField} from '@workday/canvas-kit-react/form-field';
|
|
5
|
+
import {TextInput} from '@workday/canvas-kit-react/text-input';
|
|
6
|
+
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
7
|
+
import {createStyles} from '@workday/canvas-kit-styling';
|
|
8
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
9
|
+
import React from 'react';
|
|
10
|
+
|
|
11
|
+
const outerContainerStyles = createStyles({
|
|
12
|
+
flexDirection: 'column',
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const buttonContainerStyles = createStyles({
|
|
16
|
+
flexDirection: 'row',
|
|
17
|
+
gap: system.space.x1,
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export function ContextualHelpTooltip() {
|
|
22
|
+
const [value, setValue] = React.useState('');
|
|
23
|
+
|
|
24
|
+
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
25
|
+
setValue(event.target.value);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Flex className={outerContainerStyles}>
|
|
30
|
+
<FormField isRequired>
|
|
31
|
+
<FormField.Label>Favorite Food</FormField.Label>
|
|
32
|
+
<FormField.Input as={TextInput} onChange={handleChange}></FormField.Input>
|
|
33
|
+
</FormField>
|
|
34
|
+
<Flex className={buttonContainerStyles}>
|
|
35
|
+
<PrimaryButton disabled={!value}>Submit</PrimaryButton>
|
|
36
|
+
<Tooltip title="All fields must be filled before submitting" placement="right">
|
|
37
|
+
<TertiaryButton icon={infoIcon} size="small" aria-label="Info" disabled={!!value} />
|
|
38
|
+
</Tooltip>
|
|
39
|
+
</Flex>
|
|
40
|
+
</Flex>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
@@ -134,6 +134,36 @@ const themedBrand = createStyles({
|
|
|
134
134
|
</CanvasProvider>
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
+
### Theming Modals and Dialogs
|
|
138
|
+
|
|
139
|
+
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.
|
|
140
|
+
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.
|
|
141
|
+
|
|
142
|
+
> **Important:** Passing a `theme` to the `CanvasProvider` **will not** theme components in Modals
|
|
143
|
+
> and Dialogs. You can either pass a `className` or define CSS variables at the root.
|
|
144
|
+
|
|
145
|
+
**Before in v13**
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
// 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.
|
|
149
|
+
<CanvasProvider theme={{canvas: {palette: {primary: {main: 'blue'}}}}}>
|
|
150
|
+
<Modal>//... rest of modal code</Modal>
|
|
151
|
+
</CanvasProvider>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**After in v14**
|
|
155
|
+
|
|
156
|
+
```tsx
|
|
157
|
+
// 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.
|
|
158
|
+
:root {
|
|
159
|
+
--cnvs-brand-primary-base: blue;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
<CanvasProvider>
|
|
163
|
+
<Modal>//... rest of modal code</Modal>
|
|
164
|
+
</CanvasProvider>
|
|
165
|
+
```
|
|
166
|
+
|
|
137
167
|
## CSS Token Structure
|
|
138
168
|
|
|
139
169
|
Canvas Kit provides three layers of CSS variables.
|
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.1326-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,12 +45,12 @@
|
|
|
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.1326-next.0",
|
|
49
|
+
"@workday/canvas-kit-preview-react": "^15.0.0-alpha.1326-next.0",
|
|
50
|
+
"@workday/canvas-kit-react": "^15.0.0-alpha.1326-next.0",
|
|
51
|
+
"@workday/canvas-kit-styling": "^15.0.0-alpha.1326-next.0",
|
|
52
52
|
"@workday/canvas-system-icons-web": "^3.0.36",
|
|
53
|
-
"@workday/canvas-tokens-web": "
|
|
53
|
+
"@workday/canvas-tokens-web": "4.0.0-alpha.1",
|
|
54
54
|
"markdown-to-jsx": "^7.2.0",
|
|
55
55
|
"react-syntax-highlighter": "^15.5.0",
|
|
56
56
|
"ts-node": "^10.9.1"
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"mkdirp": "^1.0.3",
|
|
62
62
|
"typescript": "5.0"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "9cdfd5792eab2f74d194662da6b9957fdf573654"
|
|
65
65
|
}
|
|
Binary file
|