@workday/canvas-kit-docs 12.3.6 → 12.4.0-1015-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 +60 -3
- package/dist/mdx/react/_examples/Tooltips.mdx +15 -0
- package/dist/mdx/react/_examples/examples/Tooltips/ListOfUploadedFiles.tsx +38 -0
- package/dist/mdx/react/button/button/Button.mdx +1 -5
- package/dist/mdx/react/button/button/examples/ThemeOverrides.tsx +17 -14
- package/dist/mdx/react/tooltip/Tooltip.mdx +31 -1
- package/dist/mdx/react/tooltip/examples/DescriptionType.tsx +22 -0
- package/package.json +7 -7
package/dist/es6/lib/docs.js
CHANGED
|
@@ -139368,6 +139368,24 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
139368
139368
|
}
|
|
139369
139369
|
],
|
|
139370
139370
|
"tags": {}
|
|
139371
|
+
},
|
|
139372
|
+
{
|
|
139373
|
+
"kind": "property",
|
|
139374
|
+
"name": "action",
|
|
139375
|
+
"required": true,
|
|
139376
|
+
"type": {
|
|
139377
|
+
"kind": "symbol",
|
|
139378
|
+
"name": "CanvasThemePalette",
|
|
139379
|
+
"value": "CanvasThemePalette"
|
|
139380
|
+
},
|
|
139381
|
+
"description": "",
|
|
139382
|
+
"declarations": [
|
|
139383
|
+
{
|
|
139384
|
+
"name": "action",
|
|
139385
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/react/common/lib/theming/types.ts"
|
|
139386
|
+
}
|
|
139387
|
+
],
|
|
139388
|
+
"tags": {}
|
|
139371
139389
|
}
|
|
139372
139390
|
]
|
|
139373
139391
|
},
|
|
@@ -300235,7 +300253,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
300235
300253
|
"name": "ReactNode",
|
|
300236
300254
|
"url": "https://reactjs.org/docs/rendering-elements.html"
|
|
300237
300255
|
},
|
|
300238
|
-
"description": "This should be a string in most cases. HTML is supported, but only text is understood\nby assistive technology. This is true for both `label` and `describe` modes
|
|
300256
|
+
"description": "This should be a string in most cases. HTML is supported, but only text is understood\nby assistive technology. This is true for both `label` and `describe` modes.\n\n**Note:** If you use `description` type and want to pass `jsx`, it **must* be inline and **not** a component to ensure the inner text is properly translated.\n\n```jsx\n// The text will be understood as: You must accept terms and conditions\n<Tooltip type=\"description\" title={<span>You<i>must</i> accept terms and conditions</span>}/>\n\n// This will render a string including the html and will not be properly understood by voice over.\nconst MyComponent = () => <span>You<i>must</i> accept terms and conditions</span>\n<Tooltip type=\"description\" title={MyComponent/>\n```",
|
|
300239
300257
|
"declarations": [
|
|
300240
300258
|
{
|
|
300241
300259
|
"name": "title",
|
|
@@ -300331,10 +300349,14 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
300331
300349
|
{
|
|
300332
300350
|
"kind": "string",
|
|
300333
300351
|
"value": "muted"
|
|
300352
|
+
},
|
|
300353
|
+
{
|
|
300354
|
+
"kind": "string",
|
|
300355
|
+
"value": "description"
|
|
300334
300356
|
}
|
|
300335
300357
|
]
|
|
300336
300358
|
},
|
|
300337
|
-
"description": "Determines the tooltip type for accessibility.\n\n- `label`: Sets the accessible name for the wrapped element. Use for icons or if tooltip\n `title` prop is the same as the text content of the wrapped element. E.g. TertiaryButtons that render an icon or\n Ellipsis tooltips.\n- `describe`: Sets `aria-describedby` of the wrapped element. Use if the tooltip has additional\n information about the target.\n- `muted`: No effort is made to make the tooltip accessible to screen readers. Use if the\n tooltip contents are not useful to a screen reader or if you have handled accessibility of\n the tooltip yourself.\n\n**Note**: Assistive technology may ignore `describe` techniques based on verbosity settings.\nConsider an alternate way to inform a user of additional important information.",
|
|
300359
|
+
"description": "Determines the tooltip type for accessibility.\n\n- `label`: Sets the accessible name for the wrapped element. Use for icons or if tooltip\n `title` prop is the same as the text content of the wrapped element. E.g. TertiaryButtons that render an icon or\n Ellipsis tooltips.\n- **Deprecated: `describe` is deprecated, please use `description`**.`describe`: Sets `aria-describedby` of the wrapped element. Use if the tooltip has additional\n information about the target.\n- `muted`: No effort is made to make the tooltip accessible to screen readers. Use if the\n tooltip contents are not useful to a screen reader or if you have handled accessibility of\n the tooltip yourself.\n\n**Note**: Assistive technology may ignore `describe` techniques based on verbosity settings.\nConsider an alternate way to inform a user of additional important information.",
|
|
300338
300360
|
"declarations": [
|
|
300339
300361
|
{
|
|
300340
300362
|
"name": "type",
|
|
@@ -300840,10 +300862,14 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
300840
300862
|
{
|
|
300841
300863
|
"kind": "string",
|
|
300842
300864
|
"value": "muted"
|
|
300865
|
+
},
|
|
300866
|
+
{
|
|
300867
|
+
"kind": "string",
|
|
300868
|
+
"value": "description"
|
|
300843
300869
|
}
|
|
300844
300870
|
]
|
|
300845
300871
|
},
|
|
300846
|
-
"description": "Determines the tooltip type for accessibility.\n\n- `label`: Sets the accessible name for the wrapped element. Use for icons or if tooltip\n `title` prop is the same as the text content of the wrapped element. E.g. TertiaryButton that renders an icon or\n Ellipsis tooltips.\n- `describe`: Sets `aria-describedby` of the wrapped element. Use if the tooltip has additional
|
|
300872
|
+
"description": "Determines the tooltip type for accessibility.\n\n- `label`: Sets the accessible name for the wrapped element. Use for icons or if tooltip\n `title` prop is the same as the text content of the wrapped element. E.g. TertiaryButton that renders an icon or\n Ellipsis tooltips.\n- **Deprecated: `describe` is deprecated, please use `description`.**`describe`: Sets `aria-describedby` of the wrapped element. Use if the tooltip has additional information about the target\n- `muted`: No effort is made to make the tooltip accessible to screen readers. Use if the\n tooltip contents are not useful to a screen reader or if you have handled accessibility of\n the tooltip yourself.\n- `description`: Sets `aria-description` strings for the wrapped element. Use if the tooltip has additional about the target\n\n**Note**: Assistive technology may ignore `describe` techniques based on verbosity settings.\nConsider an alternate way to inform a user of additional important information.",
|
|
300847
300873
|
"declarations": [
|
|
300848
300874
|
{
|
|
300849
300875
|
"name": "type",
|
|
@@ -300976,6 +301002,37 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
300976
301002
|
],
|
|
300977
301003
|
"tags": {}
|
|
300978
301004
|
},
|
|
301005
|
+
{
|
|
301006
|
+
"kind": "property",
|
|
301007
|
+
"name": "aria-description",
|
|
301008
|
+
"defaultValue": {
|
|
301009
|
+
"kind": "unknown",
|
|
301010
|
+
"value": "unknown",
|
|
301011
|
+
"text": "type === 'description' ? titleText : undefined"
|
|
301012
|
+
},
|
|
301013
|
+
"type": {
|
|
301014
|
+
"kind": "union",
|
|
301015
|
+
"value": [
|
|
301016
|
+
{
|
|
301017
|
+
"kind": "primitive",
|
|
301018
|
+
"value": "string"
|
|
301019
|
+
},
|
|
301020
|
+
{
|
|
301021
|
+
"kind": "primitive",
|
|
301022
|
+
"value": "undefined"
|
|
301023
|
+
}
|
|
301024
|
+
]
|
|
301025
|
+
},
|
|
301026
|
+
"required": false,
|
|
301027
|
+
"description": "",
|
|
301028
|
+
"declarations": [
|
|
301029
|
+
{
|
|
301030
|
+
"name": "aria-description",
|
|
301031
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/react/tooltip/lib/useTooltip.tsx"
|
|
301032
|
+
}
|
|
301033
|
+
],
|
|
301034
|
+
"tags": {}
|
|
301035
|
+
},
|
|
300979
301036
|
{
|
|
300980
301037
|
"kind": "property",
|
|
300981
301038
|
"name": "aria-label",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {Tooltip} from '@workday/canvas-kit-react/tooltip';
|
|
2
|
+
import ListOfUploadedFiles from './examples/Tooltips/ListOfUploadedFiles';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
# Accessible Tooltip Examples
|
|
6
|
+
|
|
7
|
+
## Using descriptive tooltips for repeated text buttons
|
|
8
|
+
|
|
9
|
+
In this example, the "Delete" buttons are used repeatedly to reference the multiple files that have
|
|
10
|
+
been uploaded to the web app. The text buttons already have an accessible name (a.k.a. label)
|
|
11
|
+
derived from the button's inner text. The `describe` tooltip can be useful for providing more
|
|
12
|
+
in-context description for both low vision sighted users and screen reader users without overriding
|
|
13
|
+
the button name "Delete".
|
|
14
|
+
|
|
15
|
+
<ExampleCodeBlock code={ListOfUploadedFiles} />
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {DeleteButton} from '@workday/canvas-kit-react/button';
|
|
4
|
+
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
5
|
+
import {Heading, Text} from '@workday/canvas-kit-react/text';
|
|
6
|
+
import {Tooltip} from '@workday/canvas-kit-react/tooltip';
|
|
7
|
+
import {trashIcon} from '@workday/canvas-system-icons-web';
|
|
8
|
+
|
|
9
|
+
const files = ['Cover Letter.docx', 'Resume.docx', 'Portfolio.pptx', 'Portrait.png'];
|
|
10
|
+
|
|
11
|
+
const listStyles = {
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
width: '35rem',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const deleteBtnStyle = {
|
|
17
|
+
marginLeft: 'auto',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default () => {
|
|
21
|
+
return (
|
|
22
|
+
<>
|
|
23
|
+
<Heading size="medium">Uploaded Files:</Heading>
|
|
24
|
+
<Flex as="ul" gap="1rem" flexDirection="column">
|
|
25
|
+
{files.map(i => (
|
|
26
|
+
<Flex as="li" style={listStyles}>
|
|
27
|
+
<Text>{i}</Text>
|
|
28
|
+
<Tooltip type="description" title={i}>
|
|
29
|
+
<DeleteButton icon={trashIcon} style={deleteBtnStyle}>
|
|
30
|
+
Delete
|
|
31
|
+
</DeleteButton>
|
|
32
|
+
</Tooltip>
|
|
33
|
+
</Flex>
|
|
34
|
+
))}
|
|
35
|
+
</Flex>
|
|
36
|
+
</>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
@@ -94,11 +94,7 @@ or view the example below.
|
|
|
94
94
|
|
|
95
95
|
### Theme Overrides
|
|
96
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
|
-
> **Caution:** Setting `--cnvs-brand-action**` tokens at the `:root` CSS will override all `PrimaryButton` theme colors set at the `CanvasProvider` level.
|
|
100
|
-
|
|
101
|
-
> **Note:** You should **not** individually theme components wrapping them with the `CanvasProvider`, but rather theme at the root level of the application.
|
|
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.**`.
|
|
102
98
|
|
|
103
99
|
<ExampleCodeBlock code={ThemeOverrides} />
|
|
104
100
|
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
caretDownIcon,
|
|
9
9
|
} from '@workday/canvas-system-icons-web';
|
|
10
10
|
import {createStyles} from '@workday/canvas-kit-styling';
|
|
11
|
-
import {
|
|
11
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
12
12
|
import {CanvasProvider} from '@workday/canvas-kit-react/common';
|
|
13
13
|
import {Heading} from '@workday/canvas-kit-react/text';
|
|
14
14
|
|
|
@@ -17,24 +17,17 @@ const parentContainerStyles = createStyles({
|
|
|
17
17
|
padding: system.space.x4,
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
const customActionTheme = createStyles({
|
|
21
|
-
[brand.action.base]: 'teal',
|
|
22
|
-
[brand.action.accent]: 'white',
|
|
23
|
-
[brand.action.dark]: 'hsla(180, 100%, 20%)',
|
|
24
|
-
[brand.action.darkest]: 'hsla(180, 100%, 16%)',
|
|
25
|
-
});
|
|
26
|
-
|
|
27
20
|
export default () => (
|
|
28
21
|
<div>
|
|
29
22
|
<Heading size="medium" as="h3">
|
|
30
|
-
Override Primary Color
|
|
23
|
+
Override Primary Color
|
|
31
24
|
</Heading>
|
|
32
25
|
<CanvasProvider
|
|
33
26
|
theme={{
|
|
34
27
|
canvas: {
|
|
35
28
|
palette: {
|
|
36
|
-
|
|
37
|
-
main: '
|
|
29
|
+
action: {
|
|
30
|
+
main: 'teal',
|
|
38
31
|
},
|
|
39
32
|
},
|
|
40
33
|
},
|
|
@@ -52,9 +45,19 @@ export default () => (
|
|
|
52
45
|
</Flex>
|
|
53
46
|
</CanvasProvider>
|
|
54
47
|
<Heading size="medium" as="h3">
|
|
55
|
-
Override Action Color
|
|
48
|
+
Override Action Color
|
|
56
49
|
</Heading>
|
|
57
|
-
<
|
|
50
|
+
<CanvasProvider
|
|
51
|
+
theme={{
|
|
52
|
+
canvas: {
|
|
53
|
+
palette: {
|
|
54
|
+
primary: {
|
|
55
|
+
main: 'navy',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
}}
|
|
60
|
+
>
|
|
58
61
|
<Flex cs={parentContainerStyles}>
|
|
59
62
|
<PrimaryButton>Primary</PrimaryButton>
|
|
60
63
|
<PrimaryButton icon={plusIcon} iconPosition="start">
|
|
@@ -65,6 +68,6 @@ export default () => (
|
|
|
65
68
|
</PrimaryButton>
|
|
66
69
|
<PrimaryButton aria-label="Related Actions" icon={relatedActionsVerticalIcon} />
|
|
67
70
|
</Flex>
|
|
68
|
-
</
|
|
71
|
+
</CanvasProvider>
|
|
69
72
|
</div>
|
|
70
73
|
);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {ExampleCodeBlock, SymbolDoc, Specifications} from '@workday/canvas-kit-docs';
|
|
1
|
+
import {ExampleCodeBlock, SymbolDoc, Specifications} from '@workday/canvas-kit-docs';
|
|
2
|
+
import {InformationHighlight} from '@workday/canvas-kit-preview-react/information-highlight'
|
|
3
|
+
import {StatusIndicator} from '@workday/canvas-kit-preview-react/status-indicator'import Default from './examples/Default';
|
|
2
4
|
import CustomContent from './examples/CustomContent';
|
|
3
5
|
import DelayedTooltip from './examples/DelayedTooltip';
|
|
6
|
+
import DescriptionType from './examples/DescriptionType';
|
|
4
7
|
import DescribeType from './examples/DescribeType';
|
|
5
8
|
import Muted from './examples/Muted';
|
|
6
9
|
import Placements from './examples/Placements';
|
|
@@ -62,6 +65,14 @@ and focus events.
|
|
|
62
65
|
|
|
63
66
|
### Describing an Element
|
|
64
67
|
|
|
68
|
+
<InformationHighlight variant={'caution'} className='sb-unstyled'>
|
|
69
|
+
<InformationHighlight.Icon />
|
|
70
|
+
<InformationHighlight.Heading> Caution: Describe type has been deprecated </InformationHighlight.Heading>
|
|
71
|
+
<InformationHighlight.Body>
|
|
72
|
+
Assistive technology may ignore <StatusIndicator variant='gray'><StatusIndicator.Label cs={{textTransform: 'lowercase'}}>type="describe"</StatusIndicator.Label></StatusIndicator> techniques based on verbosity settings. Please use <StatusIndicator cs={{textTransform: 'lowercase'}} variant='gray'><StatusIndicator.Label cs={{textTransform: 'lowercase'}}>type="description"</StatusIndicator.Label></StatusIndicator> on Tooltips.
|
|
73
|
+
</InformationHighlight.Body>
|
|
74
|
+
</InformationHighlight>
|
|
75
|
+
|
|
65
76
|
The default mode for a tooltip is to label content via `aria-label`. If a tooltip is meant to
|
|
66
77
|
provide ancillary information, the `type` can be set to `describe`. This will add `aria-describedby`
|
|
67
78
|
to the target element. This will allow screen reader users to hear the name of the control that is
|
|
@@ -69,6 +80,25 @@ being focused and the ancillary tooltip information.
|
|
|
69
80
|
|
|
70
81
|
<ExampleCodeBlock code={DescribeType} />
|
|
71
82
|
|
|
83
|
+
### Description of an Element
|
|
84
|
+
|
|
85
|
+
The default mode for a tooltip is to assign a name to the target element with an `aria-label`
|
|
86
|
+
string. If a tooltip is meant to provide ancillary information, the `type` can be set to `description`.
|
|
87
|
+
This will add `aria-description` strings to the target element instead. This variant is useful on
|
|
88
|
+
text buttons and other components that already have a label or name. Use this type instead of `describe` to ensure proper aria attributes are added to the dom regardless if the tooltip is visible.
|
|
89
|
+
|
|
90
|
+
> **Note:** If you use `description` type and want to pass `jsx`, it **must* be inline and **not** a component to ensure the inner text is properly read by voiceover.
|
|
91
|
+
>
|
|
92
|
+
> ```jsx
|
|
93
|
+
> // The text will be understood as: You must accept terms and conditions
|
|
94
|
+
> <Tooltip type="description" title={<span>You<i>must</i> accept terms and conditions</span>}/>
|
|
95
|
+
>
|
|
96
|
+
> // This will render a string including the html and will not be properly understood by voice over.
|
|
97
|
+
> const MyComponent = () => <span>You<i>must</i> accept terms and conditions</span>
|
|
98
|
+
> <Tool
|
|
99
|
+
|
|
100
|
+
<ExampleCodeBlock code={DescriptionType} />
|
|
101
|
+
|
|
72
102
|
### Muted Tooltips
|
|
73
103
|
|
|
74
104
|
If a tooltip does not need to be visible to screen reader users, or you handle accessibility of the
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {DeleteButton, SecondaryButton, TertiaryButton} from '@workday/canvas-kit-react/button';
|
|
4
|
+
import {Tooltip} from '@workday/canvas-kit-react/tooltip';
|
|
5
|
+
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
6
|
+
import {chartConfigIcon} from '@workday/canvas-system-icons-web';
|
|
7
|
+
|
|
8
|
+
export default () => {
|
|
9
|
+
return (
|
|
10
|
+
<Flex gap="s">
|
|
11
|
+
<Tooltip type="description" title="Search using additional criteria">
|
|
12
|
+
<TertiaryButton icon={chartConfigIcon}>Advanced Search</TertiaryButton>
|
|
13
|
+
</Tooltip>
|
|
14
|
+
<Tooltip type="description" title="Create saved search">
|
|
15
|
+
<SecondaryButton>Save</SecondaryButton>
|
|
16
|
+
</Tooltip>
|
|
17
|
+
<Tooltip type="description" title="The service will restart after this action">
|
|
18
|
+
<DeleteButton>Delete</DeleteButton>
|
|
19
|
+
</Tooltip>
|
|
20
|
+
</Flex>
|
|
21
|
+
);
|
|
22
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.4.0-1015-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": "^12.
|
|
48
|
-
"@workday/canvas-kit-preview-react": "^12.
|
|
49
|
-
"@workday/canvas-kit-react": "^12.
|
|
50
|
-
"@workday/canvas-kit-styling": "^12.
|
|
47
|
+
"@workday/canvas-kit-labs-react": "^12.4.0-1015-next.0",
|
|
48
|
+
"@workday/canvas-kit-preview-react": "^12.4.0-1015-next.0",
|
|
49
|
+
"@workday/canvas-kit-react": "^12.4.0-1015-next.0",
|
|
50
|
+
"@workday/canvas-kit-styling": "^12.4.0-1015-next.0",
|
|
51
51
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
52
|
-
"@workday/canvas-tokens-web": "^2.1.
|
|
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": "d2351f7f9b4ef85afeaaf40ce7100fefb9f2d27b"
|
|
64
64
|
}
|