@workday/canvas-kit-docs 13.0.0-alpha.978-next.0 → 13.0.0-alpha.998-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/index.d.ts +0 -1
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +0 -1
- package/dist/es6/lib/docs.js +2076 -189
- package/dist/es6/mdx/versionsTable.d.ts.map +1 -1
- package/dist/es6/mdx/versionsTable.js +4 -0
- package/dist/mdx/preview-react/InformationHighlight/InformationHighlight.mdx +109 -0
- package/dist/mdx/preview-react/InformationHighlight/examples/Basic.tsx +18 -0
- package/dist/mdx/preview-react/InformationHighlight/examples/Body.tsx +13 -0
- package/dist/mdx/preview-react/InformationHighlight/examples/Caution.tsx +27 -0
- package/dist/mdx/preview-react/InformationHighlight/examples/Critical.tsx +33 -0
- package/dist/mdx/preview-react/InformationHighlight/examples/CustomIconCritical.tsx +28 -0
- package/dist/mdx/preview-react/InformationHighlight/examples/Heading.tsx +11 -0
- package/dist/mdx/preview-react/InformationHighlight/examples/Informational.tsx +27 -0
- package/dist/mdx/preview-react/InformationHighlight/examples/RTL.tsx +42 -0
- package/dist/mdx/react/button/button/Button.mdx +7 -0
- package/dist/mdx/react/button/button/examples/ThemeOverrides.tsx +73 -0
- package/dist/mdx/react/tokens/Tokens.mdx +2 -1
- package/index.ts +0 -1
- package/package.json +7 -7
- package/dist/es6/lib/InformationHighlight/Base.d.ts +0 -5
- package/dist/es6/lib/InformationHighlight/Base.d.ts.map +0 -1
- package/dist/es6/lib/InformationHighlight/Base.js +0 -9
- package/dist/es6/lib/InformationHighlight/Body.d.ts +0 -2
- package/dist/es6/lib/InformationHighlight/Body.d.ts.map +0 -1
- package/dist/es6/lib/InformationHighlight/Body.js +0 -18
- package/dist/es6/lib/InformationHighlight/Heading.d.ts +0 -2
- package/dist/es6/lib/InformationHighlight/Heading.d.ts.map +0 -1
- package/dist/es6/lib/InformationHighlight/Heading.js +0 -17
- package/dist/es6/lib/InformationHighlight/Icon.d.ts +0 -13
- package/dist/es6/lib/InformationHighlight/Icon.d.ts.map +0 -1
- package/dist/es6/lib/InformationHighlight/Icon.js +0 -44
- package/dist/es6/lib/InformationHighlight/Link.d.ts +0 -2
- package/dist/es6/lib/InformationHighlight/Link.d.ts.map +0 -1
- package/dist/es6/lib/InformationHighlight/Link.js +0 -18
- package/dist/es6/lib/InformationHighlight/index.d.ts +0 -25
- package/dist/es6/lib/InformationHighlight/index.d.ts.map +0 -1
- package/dist/es6/lib/InformationHighlight/index.js +0 -44
- package/dist/es6/lib/InformationHighlight/modelHook.d.ts +0 -19
- package/dist/es6/lib/InformationHighlight/modelHook.d.ts.map +0 -1
- package/dist/es6/lib/InformationHighlight/modelHook.js +0 -13
- package/lib/InformationHighlight/Base.tsx +0 -12
- package/lib/InformationHighlight/Body.tsx +0 -21
- package/lib/InformationHighlight/Heading.tsx +0 -20
- package/lib/InformationHighlight/Icon.tsx +0 -65
- package/lib/InformationHighlight/Link.tsx +0 -20
- package/lib/InformationHighlight/index.tsx +0 -62
- package/lib/InformationHighlight/modelHook.ts +0 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versionsTable.d.ts","sourceRoot":"","sources":["../../../mdx/versionsTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"versionsTable.d.ts","sourceRoot":"","sources":["../../../mdx/versionsTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAsE1B,eAAO,MAAM,YAAY,yBAgCxB,CAAC"}
|
|
@@ -9,6 +9,10 @@ const allVersions = [
|
|
|
9
9
|
versionNumber: version,
|
|
10
10
|
documentation: 'https://github.com/Workday/canvas-kit',
|
|
11
11
|
},
|
|
12
|
+
{
|
|
13
|
+
versionNumber: 11,
|
|
14
|
+
documentation: 'https://d2krrudi3mmzzw.cloudfront.net/v11/?path=/docs/welcome--page',
|
|
15
|
+
},
|
|
12
16
|
{
|
|
13
17
|
versionNumber: 10,
|
|
14
18
|
documentation: 'https://d2krrudi3mmzzw.cloudfront.net/v10/?path=/docs/welcome--page',
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ExampleCodeBlock,
|
|
3
|
+
SymbolDoc,
|
|
4
|
+
Specifications,
|
|
5
|
+
} from '@workday/canvas-kit-docs';
|
|
6
|
+
|
|
7
|
+
import * as InformationHighlight from './InformationHighlight.stories.ts';
|
|
8
|
+
import Basic from './examples/Basic';
|
|
9
|
+
import Body from './examples/Body';
|
|
10
|
+
import Heading from './examples/Heading';
|
|
11
|
+
import Informational from './examples/Informational';
|
|
12
|
+
import Caution from './examples/Caution';
|
|
13
|
+
import Critical from './examples/Critical';
|
|
14
|
+
import IconCritical from './examples/CustomIconCritical';
|
|
15
|
+
import RTL from './examples/RTL';
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# Canvas Kit Information Highlight
|
|
19
|
+
|
|
20
|
+
A container to call out important information on a page or a section of a page that the user should be aware of.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
yarn add @workday/canvas-kit-preview-react
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
`InformationHighlight` should be used to call out important information to the user and are paired with a meaningful
|
|
31
|
+
icon and color to differentiate information type. It should not be removed from the interface until some system or admin level action has been taken to do so.
|
|
32
|
+
|
|
33
|
+
You can use an `InformationHighlight` to:
|
|
34
|
+
- Prevent unwanted consequences from destructive actions
|
|
35
|
+
- Reassure users in their next steps
|
|
36
|
+
- Provide detail into information on the page
|
|
37
|
+
- Show changes in page content
|
|
38
|
+
|
|
39
|
+
### When to Consider Something Else
|
|
40
|
+
- Consider a [Banner](https://workday.github.io/canvas-kit/?path=/docs/components-indicators-banner--docs) if the message is about system-wide errors or alerts, or if the message appears in response to user action.
|
|
41
|
+
- Consider a [Dialog](https://workday.github.io/canvas-kit/?path=/docs/components-popups-dialog--docs) if the message is critical and requires user action or decision before proceeding
|
|
42
|
+
- Consider a [Toast](https://workday.github.io/canvas-kit/?path=/docs/components-popups-toast--docs) if the message is timely, such as communicating updates on the process of an application.
|
|
43
|
+
### Basic Example
|
|
44
|
+
<ExampleCodeBlock code={Basic} />
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
## Variants
|
|
48
|
+
`InformationHighlight` has three variants and each `variant` has two types of `emphasis`.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
Variants: `informational`, `caution`, `critical`
|
|
52
|
+
|
|
53
|
+
Emphasis: `low`, `high`
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
The variants have different icons and colors to convey severity and the emphasis changes the background color to have a
|
|
57
|
+
lower or higher contrast. If no `variant` or `emphasis` is selected the layout will default to
|
|
58
|
+
`Variant: informational, Emphasis: low`.
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
The following examples will show the `low` and `high` emphasis of the three variants.
|
|
62
|
+
`low` Emphasis will be shown first and should be used when there is other more important information on the page.
|
|
63
|
+
`high` Emphasis will be shown second, and should be used when the highlight is not competing with other, more important information.
|
|
64
|
+
|
|
65
|
+
### Informational
|
|
66
|
+
The informational variant is for _nice to have_ information, such as related features or opportunities.
|
|
67
|
+
<ExampleCodeBlock code={Informational} />
|
|
68
|
+
|
|
69
|
+
### Caution
|
|
70
|
+
The caution variant is for _important to know_ information, such as the potential consequences of specific actions.
|
|
71
|
+
|
|
72
|
+
<ExampleCodeBlock code={Caution} />
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
### Critical
|
|
76
|
+
The critical variant is for _must know_ information that could otherwise cause failure if the user is unaware
|
|
77
|
+
|
|
78
|
+
<ExampleCodeBlock code={Critical} />
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### RTL Example
|
|
82
|
+
Information Highlight also supports RTL Languages. To enable RTL, add a custom theme with direction set to 'ContentDirection.RTL'
|
|
83
|
+
<ExampleCodeBlock code={RTL} />
|
|
84
|
+
|
|
85
|
+
## Partial and Custom Information Highlights
|
|
86
|
+
|
|
87
|
+
`InformationHighlight` can use custom icons or be designed to only use some of its components.
|
|
88
|
+
|
|
89
|
+
### Custom Icon: Critical
|
|
90
|
+
<ExampleCodeBlock code={IconCritical} />
|
|
91
|
+
|
|
92
|
+
### Body Only Example
|
|
93
|
+
<ExampleCodeBlock code={Body} />
|
|
94
|
+
|
|
95
|
+
### Heading Only Example
|
|
96
|
+
<ExampleCodeBlock code={Heading} />
|
|
97
|
+
|
|
98
|
+
### Accessible Use of the `as` Prop
|
|
99
|
+
Like many of our components, `InformationHighlight` and it's subcomponents accept an `as` prop, which lets you change
|
|
100
|
+
the underlying semantic element. For `InformationHighlight.Heading`, you can change the heading level if you were
|
|
101
|
+
needing to define a different level of importance. This should be done with caution to ensure the best accessibility.
|
|
102
|
+
|
|
103
|
+
## Component API
|
|
104
|
+
|
|
105
|
+
<SymbolDoc name="InformationHighlight" fileName="/preview-react/" />
|
|
106
|
+
|
|
107
|
+
## Specifications
|
|
108
|
+
|
|
109
|
+
<Specifications file="InformationHighlight.spec.tsx" name="InformationHighlight" />
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {InformationHighlight} from '@workday/canvas-kit-preview-react/InformationHighlight';
|
|
4
|
+
|
|
5
|
+
export default () => {
|
|
6
|
+
return (
|
|
7
|
+
<InformationHighlight>
|
|
8
|
+
<InformationHighlight.Icon />
|
|
9
|
+
<InformationHighlight.Heading>Information Highlight</InformationHighlight.Heading>
|
|
10
|
+
<InformationHighlight.Body>
|
|
11
|
+
{' '}
|
|
12
|
+
This is what an information highlight would look like with with the default settings and
|
|
13
|
+
every field filled in{' '}
|
|
14
|
+
</InformationHighlight.Body>
|
|
15
|
+
<InformationHighlight.Link href="#hyperlink">View the Docs</InformationHighlight.Link>
|
|
16
|
+
</InformationHighlight>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {InformationHighlight} from '@workday/canvas-kit-preview-react/InformationHighlight';
|
|
4
|
+
|
|
5
|
+
export default () => {
|
|
6
|
+
return (
|
|
7
|
+
<InformationHighlight>
|
|
8
|
+
<InformationHighlight.Body>
|
|
9
|
+
Only the body of an information highlight
|
|
10
|
+
</InformationHighlight.Body>
|
|
11
|
+
</InformationHighlight>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
3
|
+
import {InformationHighlight} from '@workday/canvas-kit-preview-react/InformationHighlight';
|
|
4
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
5
|
+
|
|
6
|
+
export default () => {
|
|
7
|
+
return (
|
|
8
|
+
<Flex flexDirection={'column'} gap={system.space.x2}>
|
|
9
|
+
<InformationHighlight variant={'caution'}>
|
|
10
|
+
<InformationHighlight.Icon />
|
|
11
|
+
<InformationHighlight.Heading> Caution: Highlight Something </InformationHighlight.Heading>
|
|
12
|
+
<InformationHighlight.Body>
|
|
13
|
+
If you select the link below, nothing will happen
|
|
14
|
+
</InformationHighlight.Body>
|
|
15
|
+
<InformationHighlight.Link href="#hyperlink">View the Docs</InformationHighlight.Link>
|
|
16
|
+
</InformationHighlight>
|
|
17
|
+
<InformationHighlight variant={'caution'} emphasis={'high'}>
|
|
18
|
+
<InformationHighlight.Icon />
|
|
19
|
+
<InformationHighlight.Heading> Caution: Highlight Something </InformationHighlight.Heading>
|
|
20
|
+
<InformationHighlight.Body>
|
|
21
|
+
If you select the link below, nothing will happen
|
|
22
|
+
</InformationHighlight.Body>
|
|
23
|
+
<InformationHighlight.Link href="#hyperlink">View the Docs</InformationHighlight.Link>
|
|
24
|
+
</InformationHighlight>
|
|
25
|
+
</Flex>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
3
|
+
import {InformationHighlight} from '@workday/canvas-kit-preview-react/InformationHighlight';
|
|
4
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
5
|
+
|
|
6
|
+
export default () => {
|
|
7
|
+
return (
|
|
8
|
+
<Flex flexDirection={'column'} gap={system.space.x2}>
|
|
9
|
+
<InformationHighlight variant={'critical'}>
|
|
10
|
+
<InformationHighlight.Icon />
|
|
11
|
+
<InformationHighlight.Heading>
|
|
12
|
+
{' '}
|
|
13
|
+
Attention! Highlight Something{' '}
|
|
14
|
+
</InformationHighlight.Heading>
|
|
15
|
+
<InformationHighlight.Body>
|
|
16
|
+
If you select the link below it will just reroute you back to this page
|
|
17
|
+
</InformationHighlight.Body>
|
|
18
|
+
<InformationHighlight.Link href="#hyperlink">View the Docs</InformationHighlight.Link>
|
|
19
|
+
</InformationHighlight>
|
|
20
|
+
<InformationHighlight variant={'critical'} emphasis={'high'}>
|
|
21
|
+
<InformationHighlight.Icon />
|
|
22
|
+
<InformationHighlight.Heading>
|
|
23
|
+
{' '}
|
|
24
|
+
Attention! Highlight Something{' '}
|
|
25
|
+
</InformationHighlight.Heading>
|
|
26
|
+
<InformationHighlight.Body>
|
|
27
|
+
If you select the link below it will just reroute you back to this page
|
|
28
|
+
</InformationHighlight.Body>
|
|
29
|
+
<InformationHighlight.Link href="#hyperlink">View the Docs</InformationHighlight.Link>
|
|
30
|
+
</InformationHighlight>
|
|
31
|
+
</Flex>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {InformationHighlight} from '@workday/canvas-kit-preview-react/InformationHighlight';
|
|
3
|
+
import {chartIcon} from '@workday/canvas-system-icons-web';
|
|
4
|
+
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
5
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
6
|
+
|
|
7
|
+
export default () => {
|
|
8
|
+
return (
|
|
9
|
+
<Flex flexDirection={'column'} gap={system.space.x2}>
|
|
10
|
+
<InformationHighlight variant={'critical'} emphasis={'low'}>
|
|
11
|
+
<InformationHighlight.Icon icon={chartIcon} />
|
|
12
|
+
<InformationHighlight.Heading> Attention! Custom Highlight </InformationHighlight.Heading>
|
|
13
|
+
<InformationHighlight.Body>
|
|
14
|
+
A custom Icon can be added to the Information Highlight component
|
|
15
|
+
</InformationHighlight.Body>
|
|
16
|
+
<InformationHighlight.Link href="#hyperlink">View the Docs</InformationHighlight.Link>
|
|
17
|
+
</InformationHighlight>
|
|
18
|
+
<InformationHighlight variant={'critical'} emphasis={'high'}>
|
|
19
|
+
<InformationHighlight.Icon icon={chartIcon} />
|
|
20
|
+
<InformationHighlight.Heading> Attention! Custom Highlight </InformationHighlight.Heading>
|
|
21
|
+
<InformationHighlight.Body>
|
|
22
|
+
A custom Icon can be added to the Information Highlight component
|
|
23
|
+
</InformationHighlight.Body>
|
|
24
|
+
<InformationHighlight.Link href="#hyperlink">View the Docs</InformationHighlight.Link>
|
|
25
|
+
</InformationHighlight>
|
|
26
|
+
</Flex>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {InformationHighlight} from '@workday/canvas-kit-preview-react/InformationHighlight';
|
|
4
|
+
|
|
5
|
+
export default () => {
|
|
6
|
+
return (
|
|
7
|
+
<InformationHighlight>
|
|
8
|
+
<InformationHighlight.Heading> Only Heading </InformationHighlight.Heading>
|
|
9
|
+
</InformationHighlight>
|
|
10
|
+
);
|
|
11
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
3
|
+
import {InformationHighlight} from '@workday/canvas-kit-preview-react/InformationHighlight';
|
|
4
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
5
|
+
|
|
6
|
+
export default () => {
|
|
7
|
+
return (
|
|
8
|
+
<Flex flexDirection={'column'} gap={system.space.x2}>
|
|
9
|
+
<InformationHighlight variant={'informational'}>
|
|
10
|
+
<InformationHighlight.Icon />
|
|
11
|
+
<InformationHighlight.Heading> Informational Highlight </InformationHighlight.Heading>
|
|
12
|
+
<InformationHighlight.Body>
|
|
13
|
+
If you select the link below it will just reroute you back to this page
|
|
14
|
+
</InformationHighlight.Body>
|
|
15
|
+
<InformationHighlight.Link href="#hyperlink">View the Docs</InformationHighlight.Link>
|
|
16
|
+
</InformationHighlight>
|
|
17
|
+
<InformationHighlight variant={'informational'} emphasis={'high'}>
|
|
18
|
+
<InformationHighlight.Icon />
|
|
19
|
+
<InformationHighlight.Heading> Informational Highlight </InformationHighlight.Heading>
|
|
20
|
+
<InformationHighlight.Body>
|
|
21
|
+
If you select the link below it will just reroute you back to this page
|
|
22
|
+
</InformationHighlight.Body>
|
|
23
|
+
<InformationHighlight.Link href="#hyperlink">View the Docs</InformationHighlight.Link>
|
|
24
|
+
</InformationHighlight>
|
|
25
|
+
</Flex>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
3
|
+
import {InformationHighlight} from '@workday/canvas-kit-preview-react/InformationHighlight';
|
|
4
|
+
import {CanvasProvider, ContentDirection} from '@workday/canvas-kit-react/common';
|
|
5
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
6
|
+
export default () => {
|
|
7
|
+
const theme = {
|
|
8
|
+
canvas: {
|
|
9
|
+
direction: ContentDirection.RTL,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
return (
|
|
13
|
+
<Flex flexDirection={'column'} gap={system.space.x2}>
|
|
14
|
+
<CanvasProvider theme={theme}>
|
|
15
|
+
<InformationHighlight variant={'caution'} emphasis={'low'}>
|
|
16
|
+
<InformationHighlight.Icon />
|
|
17
|
+
<InformationHighlight.Heading>
|
|
18
|
+
{' '}
|
|
19
|
+
انتباه! من اليمين إلى اليسار{' '}
|
|
20
|
+
</InformationHighlight.Heading>
|
|
21
|
+
<InformationHighlight.Body>
|
|
22
|
+
نحن ندعم اللغات من اليمين إلى اليسار
|
|
23
|
+
</InformationHighlight.Body>
|
|
24
|
+
<InformationHighlight.Link href="#hyperlink">وثائق</InformationHighlight.Link>
|
|
25
|
+
</InformationHighlight>
|
|
26
|
+
</CanvasProvider>
|
|
27
|
+
<CanvasProvider theme={theme}>
|
|
28
|
+
<InformationHighlight variant={'caution'} emphasis={'high'}>
|
|
29
|
+
<InformationHighlight.Icon />
|
|
30
|
+
<InformationHighlight.Heading>
|
|
31
|
+
{' '}
|
|
32
|
+
انتباه! من اليمين إلى اليسار{' '}
|
|
33
|
+
</InformationHighlight.Heading>
|
|
34
|
+
<InformationHighlight.Body>
|
|
35
|
+
نحن ندعم اللغات من اليمين إلى اليسار
|
|
36
|
+
</InformationHighlight.Body>
|
|
37
|
+
<InformationHighlight.Link href="#hyperlink">وثائق</InformationHighlight.Link>
|
|
38
|
+
</InformationHighlight>
|
|
39
|
+
</CanvasProvider>
|
|
40
|
+
</Flex>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
@@ -14,6 +14,7 @@ import TertiaryInverse from './examples/TertiaryInverse';
|
|
|
14
14
|
import Delete from './examples/Delete';
|
|
15
15
|
import Grow from './examples/Grow';
|
|
16
16
|
import CustomStyles from './examples/CustomStyles';
|
|
17
|
+
import ThemeOverrides from './examples/ThemeOverrides';
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
# Canvas Kit Button
|
|
@@ -91,6 +92,12 @@ or view the example below.
|
|
|
91
92
|
|
|
92
93
|
<ExampleCodeBlock code={CustomStyles} />
|
|
93
94
|
|
|
95
|
+
### Theme Overrides
|
|
96
|
+
|
|
97
|
+
The most common way to theme our buttons is to pass a `theme` object at the root level of the application via the `CanvasProvider`. In the example below, our buttons use our `brand.action.**` tokens with the fallback being `brand.primary.**`.
|
|
98
|
+
|
|
99
|
+
<ExampleCodeBlock code={ThemeOverrides} />
|
|
100
|
+
|
|
94
101
|
### Accessible Use of the `as` Prop
|
|
95
102
|
|
|
96
103
|
Like many of our components, Buttons accept an `as` prop, which lets you change the underlying
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {PrimaryButton} from '@workday/canvas-kit-react/button';
|
|
4
|
+
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
5
|
+
import {
|
|
6
|
+
plusIcon,
|
|
7
|
+
relatedActionsVerticalIcon,
|
|
8
|
+
caretDownIcon,
|
|
9
|
+
} from '@workday/canvas-system-icons-web';
|
|
10
|
+
import {createStyles} from '@workday/canvas-kit-styling';
|
|
11
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
12
|
+
import {CanvasProvider} from '@workday/canvas-kit-react/common';
|
|
13
|
+
import {Heading} from '@workday/canvas-kit-react/text';
|
|
14
|
+
|
|
15
|
+
const parentContainerStyles = createStyles({
|
|
16
|
+
gap: system.space.x4,
|
|
17
|
+
padding: system.space.x4,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export default () => (
|
|
21
|
+
<div>
|
|
22
|
+
<Heading size="medium" as="h3">
|
|
23
|
+
Override Primary Color
|
|
24
|
+
</Heading>
|
|
25
|
+
<CanvasProvider
|
|
26
|
+
theme={{
|
|
27
|
+
canvas: {
|
|
28
|
+
palette: {
|
|
29
|
+
action: {
|
|
30
|
+
main: 'teal',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
<Flex cs={parentContainerStyles}>
|
|
37
|
+
<PrimaryButton>Primary</PrimaryButton>
|
|
38
|
+
<PrimaryButton icon={plusIcon} iconPosition="start">
|
|
39
|
+
Primary
|
|
40
|
+
</PrimaryButton>
|
|
41
|
+
<PrimaryButton icon={caretDownIcon} iconPosition="end">
|
|
42
|
+
Primary
|
|
43
|
+
</PrimaryButton>
|
|
44
|
+
<PrimaryButton aria-label="Related Actions" icon={relatedActionsVerticalIcon} />
|
|
45
|
+
</Flex>
|
|
46
|
+
</CanvasProvider>
|
|
47
|
+
<Heading size="medium" as="h3">
|
|
48
|
+
Override Action Color
|
|
49
|
+
</Heading>
|
|
50
|
+
<CanvasProvider
|
|
51
|
+
theme={{
|
|
52
|
+
canvas: {
|
|
53
|
+
palette: {
|
|
54
|
+
primary: {
|
|
55
|
+
main: 'navy',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
}}
|
|
60
|
+
>
|
|
61
|
+
<Flex cs={parentContainerStyles}>
|
|
62
|
+
<PrimaryButton>Primary</PrimaryButton>
|
|
63
|
+
<PrimaryButton icon={plusIcon} iconPosition="start">
|
|
64
|
+
Primary
|
|
65
|
+
</PrimaryButton>
|
|
66
|
+
<PrimaryButton icon={caretDownIcon} iconPosition="end">
|
|
67
|
+
Primary
|
|
68
|
+
</PrimaryButton>
|
|
69
|
+
<PrimaryButton aria-label="Related Actions" icon={relatedActionsVerticalIcon} />
|
|
70
|
+
</Flex>
|
|
71
|
+
</CanvasProvider>
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {ExampleCodeBlock
|
|
1
|
+
import {ExampleCodeBlock} from '@workday/canvas-kit-docs';
|
|
2
|
+
import {InformationHighlight} from '@workday/canvas-kit-preview-react/InformationHighlight';import {BorderRadius, Space, Depth, Colors, Type} from './examples/Tokens';
|
|
2
3
|
import Overview from './examples/Overview';
|
|
3
4
|
|
|
4
5
|
|
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "13.0.0-alpha.
|
|
3
|
+
"version": "13.0.0-alpha.998-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",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@emotion/styled": "^11.6.0",
|
|
46
46
|
"@storybook/csf": "0.0.1",
|
|
47
|
-
"@workday/canvas-kit-labs-react": "^13.0.0-alpha.
|
|
48
|
-
"@workday/canvas-kit-preview-react": "^13.0.0-alpha.
|
|
49
|
-
"@workday/canvas-kit-react": "^13.0.0-alpha.
|
|
50
|
-
"@workday/canvas-kit-styling": "^13.0.0-alpha.
|
|
47
|
+
"@workday/canvas-kit-labs-react": "^13.0.0-alpha.998-next.0",
|
|
48
|
+
"@workday/canvas-kit-preview-react": "^13.0.0-alpha.998-next.0",
|
|
49
|
+
"@workday/canvas-kit-react": "^13.0.0-alpha.998-next.0",
|
|
50
|
+
"@workday/canvas-kit-styling": "^13.0.0-alpha.998-next.0",
|
|
51
51
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
52
|
-
"@workday/canvas-tokens-web": "^2.0
|
|
52
|
+
"@workday/canvas-tokens-web": "^2.1.0",
|
|
53
53
|
"markdown-to-jsx": "^7.2.0",
|
|
54
54
|
"react-syntax-highlighter": "^15.5.0",
|
|
55
55
|
"ts-node": "^10.9.1"
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"mkdirp": "^1.0.3",
|
|
61
61
|
"typescript": "5.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "d95041596e2b948c0a371f4c763746a98c58b2da"
|
|
64
64
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Base.d.ts","sourceRoot":"","sources":["../../../../lib/InformationHighlight/Base.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,OAAO,EAAe,MAAM,6BAA6B,CAAC;AAElE,MAAM,WAAW,SAAU,SAAQ,OAAO;CAAG;AAE7C,eAAO,MAAM,IAAI,+EAKf,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { createComponent } from '@workday/canvas-kit-react/common';
|
|
3
|
-
import { handleCsProp } from '@workday/canvas-kit-styling';
|
|
4
|
-
export const Base = createComponent('div')({
|
|
5
|
-
displayName: 'Base',
|
|
6
|
-
Component: (props, ref, Element) => {
|
|
7
|
-
return React.createElement(Element, { ref: ref, ...handleCsProp(props) });
|
|
8
|
-
},
|
|
9
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Body.d.ts","sourceRoot":"","sources":["../../../../lib/InformationHighlight/Body.tsx"],"names":[],"mappings":"AAeA,eAAO,MAAM,IAAI,2EAKf,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { createComponent } from '@workday/canvas-kit-react/common';
|
|
3
|
-
import { createStyles } from '@workday/canvas-kit-styling';
|
|
4
|
-
import { base, system } from '@workday/canvas-tokens-web';
|
|
5
|
-
import { Base } from './Base';
|
|
6
|
-
const bodyStyles = createStyles({
|
|
7
|
-
...system.type.subtext.large,
|
|
8
|
-
color: base.blackPepper300,
|
|
9
|
-
gridColumn: '2',
|
|
10
|
-
fontWeight: 400,
|
|
11
|
-
margin: 0,
|
|
12
|
-
});
|
|
13
|
-
export const Body = createComponent('p')({
|
|
14
|
-
displayName: 'Body',
|
|
15
|
-
Component: (props, ref, Element) => {
|
|
16
|
-
return React.createElement(Base, { as: Element, ref: ref, cs: bodyStyles, ...props });
|
|
17
|
-
},
|
|
18
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Heading.d.ts","sourceRoot":"","sources":["../../../../lib/InformationHighlight/Heading.tsx"],"names":[],"mappings":"AAcA,eAAO,MAAM,OAAO,6EAKlB,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { createComponent } from '@workday/canvas-kit-react/common';
|
|
3
|
-
import { createStyles } from '@workday/canvas-kit-styling';
|
|
4
|
-
import { base, system } from '@workday/canvas-tokens-web';
|
|
5
|
-
import { Base } from './Base';
|
|
6
|
-
const headingStyles = createStyles({
|
|
7
|
-
...system.type.body.small,
|
|
8
|
-
color: base.blackPepper400,
|
|
9
|
-
gridColumn: '2',
|
|
10
|
-
fontWeight: 700, // should use system.fontWeight.bold
|
|
11
|
-
});
|
|
12
|
-
export const Heading = createComponent('div')({
|
|
13
|
-
displayName: 'Heading',
|
|
14
|
-
Component: (props, ref, Element) => {
|
|
15
|
-
return React.createElement(Base, { as: Element, ref: ref, cs: headingStyles, ...props });
|
|
16
|
-
},
|
|
17
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { SystemIconProps } from '@workday/canvas-kit-react/icon';
|
|
2
|
-
type Variant = 'emphasis' | 'caution' | 'attention';
|
|
3
|
-
export interface IconProps extends SystemIconProps {
|
|
4
|
-
variant: Variant;
|
|
5
|
-
}
|
|
6
|
-
export declare const Icon: import("@workday/canvas-kit-react/common").ElementComponentM<"span", IconProps, {
|
|
7
|
-
state: {
|
|
8
|
-
variant: import("./modelHook").Variant;
|
|
9
|
-
};
|
|
10
|
-
events: {};
|
|
11
|
-
}>;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=Icon.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../../lib/InformationHighlight/Icon.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAY3E,KAAK,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,CAAC;AA6BpD,MAAM,WAAW,SAAU,SAAQ,eAAe;IAChD,OAAO,EAAE,OAAO,CAAC;CAClB;AAQD,eAAO,MAAM,IAAI;;;;;EAYf,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { SystemIcon } from '@workday/canvas-kit-react/icon';
|
|
3
|
-
import { createSubcomponent } from '@workday/canvas-kit-react/common';
|
|
4
|
-
import { cssVar } from '@workday/canvas-kit-styling';
|
|
5
|
-
import { infoIcon, exclamationCircleIcon, exclamationTriangleIcon, } from '@workday/canvas-system-icons-web';
|
|
6
|
-
import { base } from '@workday/canvas-tokens-web';
|
|
7
|
-
import { useInformationHighlightModel } from './modelHook';
|
|
8
|
-
const iconStyles = {
|
|
9
|
-
emphasis: {
|
|
10
|
-
accent: cssVar(base.blueberry400),
|
|
11
|
-
fill: cssVar(base.blueberry400),
|
|
12
|
-
background: 'none',
|
|
13
|
-
accentHover: cssVar(base.blueberry400),
|
|
14
|
-
fillHover: cssVar(base.blueberry400),
|
|
15
|
-
backgroundHover: 'none',
|
|
16
|
-
},
|
|
17
|
-
caution: {
|
|
18
|
-
accent: cssVar(base.blackPepper400),
|
|
19
|
-
fill: cssVar(base.blackPepper400),
|
|
20
|
-
background: 'none',
|
|
21
|
-
accentHover: cssVar(base.blackPepper400),
|
|
22
|
-
fillHover: cssVar(base.blackPepper400),
|
|
23
|
-
backgroundHover: 'none',
|
|
24
|
-
},
|
|
25
|
-
attention: {
|
|
26
|
-
accent: cssVar(base.cinnamon500),
|
|
27
|
-
fill: cssVar(base.cinnamon500),
|
|
28
|
-
background: 'none',
|
|
29
|
-
accentHover: cssVar(base.cinnamon500),
|
|
30
|
-
fillHover: cssVar(base.cinnamon500),
|
|
31
|
-
backgroundHover: 'none',
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
const defaultIcons = {
|
|
35
|
-
emphasis: infoIcon,
|
|
36
|
-
caution: exclamationTriangleIcon,
|
|
37
|
-
attention: exclamationCircleIcon,
|
|
38
|
-
};
|
|
39
|
-
export const Icon = createSubcomponent('span')({
|
|
40
|
-
displayName: 'Icon',
|
|
41
|
-
modelHook: useInformationHighlightModel,
|
|
42
|
-
})(({ icon, ...props }, Element, model) => {
|
|
43
|
-
return (React.createElement(SystemIcon, { as: Element, icon: icon ? icon : defaultIcons[model.state.variant], ...iconStyles[model.state.variant], ...props }));
|
|
44
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../../../lib/InformationHighlight/Link.tsx"],"names":[],"mappings":"AAcA,eAAO,MAAM,IAAI,6EAKf,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ExternalHyperlink } from '@workday/canvas-kit-react/button';
|
|
3
|
-
import { createComponent } from '@workday/canvas-kit-react/common';
|
|
4
|
-
import { createStyles, cssVar } from '@workday/canvas-kit-styling';
|
|
5
|
-
import { base, system } from '@workday/canvas-tokens-web';
|
|
6
|
-
const linkStyles = createStyles({
|
|
7
|
-
...system.type.subtext.large,
|
|
8
|
-
gridColumn: '2',
|
|
9
|
-
justifySelf: 'start',
|
|
10
|
-
color: `${cssVar(base.blueberry500)} !important`,
|
|
11
|
-
fontWeight: 500, // should use system.fontWeight.bold
|
|
12
|
-
});
|
|
13
|
-
export const Link = createComponent('div')({
|
|
14
|
-
displayName: 'Link',
|
|
15
|
-
Component: (props, ref, Element) => {
|
|
16
|
-
return React.createElement(ExternalHyperlink, { as: Element, ref: ref, className: linkStyles, ...props });
|
|
17
|
-
},
|
|
18
|
-
});
|