@workday/canvas-kit-docs 16.1.0-0545-next.0 → 16.1.0-0569-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 +35 -3
- package/dist/es6/lib/stackblitzFiles/packageJSONFile.js +5 -5
- package/dist/es6/lib/stackblitzFiles/packageJSONFile.ts +5 -5
- package/dist/mdx/preview-react/divider/Divider.mdx +5 -0
- package/dist/mdx/preview-react/divider/examples/Basic.tsx +20 -13
- package/dist/mdx/preview-react/divider/examples/Vertical.tsx +50 -0
- package/dist/mdx/preview-react/status-indicator/StatusIndicator.mdx +119 -6
- package/dist/mdx/preview-react/status-indicator/examples/Icon.tsx +2 -2
- package/dist/mdx/react/dialog/Dialog.mdx +235 -48
- package/dist/mdx/react/form-field/FormField.mdx +174 -45
- package/dist/mdx/react/menu/Menu.mdx +188 -43
- package/dist/mdx/react/modal/Modal.mdx +230 -52
- package/dist/mdx/react/popup/Popup.mdx +297 -11
- package/dist/mdx/react/text-area/TextArea.mdx +134 -30
- package/dist/mdx/react/text-input/TextInput.mdx +193 -34
- package/dist/mdx/react/tooltip/Tooltip.mdx +10 -0
- package/dist/mdx/react/tooltip/examples/AIDisclosure.tsx +38 -0
- package/package.json +6 -6
package/dist/es6/lib/docs.js
CHANGED
|
@@ -44961,7 +44961,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
44961
44961
|
{
|
|
44962
44962
|
"name": "Divider",
|
|
44963
44963
|
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/preview-react/divider/lib/Divider.tsx",
|
|
44964
|
-
"description": "# Divider\nA divider to segment and visually organize content. By default, it renders a semantic `[<hr>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/hr)` element.\n\n[View Docs](https://workday.github.io/canvas-kit/?path=/docs/preview-divider--docs)\n\nThe `space` prop will equally apply
|
|
44964
|
+
"description": "# Divider\nA divider to segment and visually organize content. By default, it renders a semantic `[<hr>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/hr)` element.\n\n[View Docs](https://workday.github.io/canvas-kit/?path=/docs/preview-divider--docs)\n\nThe `space` prop will equally apply margin styles to both ends of the `Divider`.\nIn the example below, `system.gap.xs` (0.5rem), adds `0.25rem` margin to the top and `0.25rem` to the bottom.",
|
|
44965
44965
|
"declarations": [
|
|
44966
44966
|
{
|
|
44967
44967
|
"name": "Divider",
|
|
@@ -44969,7 +44969,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
44969
44969
|
}
|
|
44970
44970
|
],
|
|
44971
44971
|
"tags": {
|
|
44972
|
-
"example": "```tsx\nimport { Divider } from '@workday/canvas-kit-preview-react/divider';\n\n\n<Divider space={system.gap.xs} />\n\n```"
|
|
44972
|
+
"example": "```tsx\nimport { Divider } from '@workday/canvas-kit-preview-react/divider';\n\n\n<Divider space={system.gap.xs} />\n\n// vertical\n<Divider orientation=\"vertical\" />\n\n```"
|
|
44973
44973
|
},
|
|
44974
44974
|
"type": {
|
|
44975
44975
|
"kind": "enhancedComponent",
|
|
@@ -44984,7 +44984,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
44984
44984
|
"kind": "primitive",
|
|
44985
44985
|
"value": "string"
|
|
44986
44986
|
},
|
|
44987
|
-
"description": "Applies
|
|
44987
|
+
"description": "Applies margin evenly to both ends of the `Divider`. It divides the provided value by two and applies half to each end.\nFor a `horizontal` `Divider` this is the top and bottom margin, and for a `vertical` `Divider` it is the left and right margin.\nE.g. `space=\"2rem\"` would apply `1rem` margin to each end.",
|
|
44988
44988
|
"declarations": [
|
|
44989
44989
|
{
|
|
44990
44990
|
"name": "space",
|
|
@@ -45000,6 +45000,38 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
45000
45000
|
"value": "`system.gap.md` (1rem)"
|
|
45001
45001
|
}
|
|
45002
45002
|
},
|
|
45003
|
+
{
|
|
45004
|
+
"kind": "property",
|
|
45005
|
+
"name": "orientation",
|
|
45006
|
+
"required": false,
|
|
45007
|
+
"type": {
|
|
45008
|
+
"kind": "union",
|
|
45009
|
+
"value": [
|
|
45010
|
+
{
|
|
45011
|
+
"kind": "string",
|
|
45012
|
+
"value": "horizontal"
|
|
45013
|
+
},
|
|
45014
|
+
{
|
|
45015
|
+
"kind": "string",
|
|
45016
|
+
"value": "vertical"
|
|
45017
|
+
}
|
|
45018
|
+
]
|
|
45019
|
+
},
|
|
45020
|
+
"description": "Sets the orientation of the `Divider`.\n* `horizontal` - renders a horizontal rule to segment stacked content.\n* `vertical` - renders a vertical rule to segment content laid out in a row. The `Divider` stretches to fill\n the height of its container, so it should be placed inside an element with a defined height (e.g. a flex or\n grid container).",
|
|
45021
|
+
"declarations": [
|
|
45022
|
+
{
|
|
45023
|
+
"name": "orientation",
|
|
45024
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/preview-react/divider/lib/Divider.tsx"
|
|
45025
|
+
}
|
|
45026
|
+
],
|
|
45027
|
+
"tags": {
|
|
45028
|
+
"default": "'horizontal'"
|
|
45029
|
+
},
|
|
45030
|
+
"defaultValue": {
|
|
45031
|
+
"kind": "string",
|
|
45032
|
+
"value": "horizontal"
|
|
45033
|
+
}
|
|
45034
|
+
},
|
|
45003
45035
|
{
|
|
45004
45036
|
"kind": "property",
|
|
45005
45037
|
"name": "cs",
|
|
@@ -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.12",
|
|
22
|
+
"@workday/canvas-kit-preview-react": "16.0.12",
|
|
23
|
+
"@workday/canvas-kit-react": "16.0.12",
|
|
24
|
+
"@workday/canvas-kit-react-fonts": "^16.0.12",
|
|
25
|
+
"@workday/canvas-kit-styling": "16.0.12",
|
|
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.12",
|
|
23
|
+
"@workday/canvas-kit-preview-react": "16.0.12",
|
|
24
|
+
"@workday/canvas-kit-react": "16.0.12",
|
|
25
|
+
"@workday/canvas-kit-react-fonts": "^16.0.12",
|
|
26
|
+
"@workday/canvas-kit-styling": "16.0.12",
|
|
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"
|
|
@@ -2,6 +2,7 @@ import {ExampleCodeBlock, SymbolDoc, Specifications} from '@workday/canvas-kit-d
|
|
|
2
2
|
|
|
3
3
|
import * as Divider from './Divider.stories.ts';
|
|
4
4
|
import Basic from './examples/Basic';
|
|
5
|
+
import Vertical from './examples/Vertical';
|
|
5
6
|
import CustomSpace from './examples/CustomSpace';
|
|
6
7
|
|
|
7
8
|
|
|
@@ -31,6 +32,10 @@ bottom margin.
|
|
|
31
32
|
|
|
32
33
|
<ExampleCodeBlock code={Basic} />
|
|
33
34
|
|
|
35
|
+
### Vertical Example
|
|
36
|
+
|
|
37
|
+
<ExampleCodeBlock code={Vertical} />
|
|
38
|
+
|
|
34
39
|
### Custom Space
|
|
35
40
|
|
|
36
41
|
You might also want to apply custom space to `Divider` where the top and bottom margin are not
|
|
@@ -28,40 +28,39 @@ const maintainerList = [
|
|
|
28
28
|
{
|
|
29
29
|
id: '44883293',
|
|
30
30
|
name: 'Josh Bagwell',
|
|
31
|
-
bio: '
|
|
31
|
+
bio: 'Master of Cocktails and Fast Cars',
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
id: '338257',
|
|
35
35
|
name: 'Nicholas Boll',
|
|
36
|
-
bio: 'Principal
|
|
36
|
+
bio: 'Principal Potato Engineer',
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
id: '7966550',
|
|
40
40
|
name: 'Manuel Carrera',
|
|
41
|
-
bio: 'Sr.
|
|
41
|
+
bio: 'Sr. Rock Climber and Artist',
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
id: '146020',
|
|
45
45
|
name: 'James Fan',
|
|
46
|
-
bio: 'Sr.
|
|
46
|
+
bio: 'Sr. Television Consultant',
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
id: '48605821',
|
|
50
50
|
name: 'Raisa Primerova',
|
|
51
|
-
bio: '
|
|
51
|
+
bio: 'Principal Borscht Connoisseur',
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
id: '4818182',
|
|
55
55
|
name: 'Alan Smith',
|
|
56
|
-
bio: 'Principal
|
|
56
|
+
bio: 'Principal Pizza Tosser',
|
|
57
57
|
},
|
|
58
58
|
];
|
|
59
59
|
|
|
60
60
|
const profileCardStyles = createStyles({
|
|
61
|
-
display: '
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
gridTemplateRows: '1fr 1fr',
|
|
61
|
+
display: 'flex',
|
|
62
|
+
gap: '0.5rem',
|
|
63
|
+
flexDirection: 'row',
|
|
65
64
|
});
|
|
66
65
|
|
|
67
66
|
const profileCardAvatarStyles = createStyles({
|
|
@@ -84,6 +83,12 @@ const profileCardBodyStyles = createStyles({
|
|
|
84
83
|
margin: 0,
|
|
85
84
|
});
|
|
86
85
|
|
|
86
|
+
const profileCardContentStyles = createStyles({
|
|
87
|
+
display: 'flex',
|
|
88
|
+
flexDirection: 'column',
|
|
89
|
+
gap: system.gap.xs,
|
|
90
|
+
});
|
|
91
|
+
|
|
87
92
|
interface ProfileCardProps {
|
|
88
93
|
id: string;
|
|
89
94
|
name: string;
|
|
@@ -93,12 +98,14 @@ interface ProfileCardProps {
|
|
|
93
98
|
const ProfileCard = ({id, name, bio}: ProfileCardProps) => (
|
|
94
99
|
<div className={profileCardStyles}>
|
|
95
100
|
<Avatar
|
|
96
|
-
size="
|
|
101
|
+
size="large"
|
|
97
102
|
url={`https://avatars.githubusercontent.com/u/${id}?v=4`}
|
|
98
103
|
name={`${name}'s avatar`}
|
|
99
104
|
className={profileCardAvatarStyles}
|
|
100
105
|
/>
|
|
101
|
-
<
|
|
102
|
-
|
|
106
|
+
<div className={profileCardContentStyles}>
|
|
107
|
+
<h3 className={profileCardHeadingStyles}>{name}</h3>
|
|
108
|
+
<p className={profileCardBodyStyles}>{bio}</p>
|
|
109
|
+
</div>
|
|
103
110
|
</div>
|
|
104
111
|
);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {Divider} from '@workday/canvas-kit-preview-react/divider';
|
|
2
|
+
import {createStyles} from '@workday/canvas-kit-styling';
|
|
3
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
4
|
+
|
|
5
|
+
const rowStyles = createStyles({
|
|
6
|
+
display: 'flex',
|
|
7
|
+
alignItems: 'center',
|
|
8
|
+
height: system.size.xxl,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const statStyles = createStyles({
|
|
12
|
+
display: 'flex',
|
|
13
|
+
flexDirection: 'column',
|
|
14
|
+
gap: system.gap.none,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const labelStyles = createStyles({
|
|
18
|
+
...system.type.subtext.medium,
|
|
19
|
+
color: system.color.fg.default,
|
|
20
|
+
margin: 0,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const valueStyles = createStyles({
|
|
24
|
+
...system.type.body.large,
|
|
25
|
+
fontWeight: system.fontWeight.bold,
|
|
26
|
+
margin: 0,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export default () => {
|
|
30
|
+
const lastIndex = stats.length - 1;
|
|
31
|
+
return (
|
|
32
|
+
<div className={rowStyles}>
|
|
33
|
+
{stats.map((stat, index) => (
|
|
34
|
+
<>
|
|
35
|
+
<div className={statStyles}>
|
|
36
|
+
<p className={labelStyles}>{stat.label}</p>
|
|
37
|
+
<p className={valueStyles}>{stat.value}</p>
|
|
38
|
+
</div>
|
|
39
|
+
{index !== lastIndex && <Divider orientation="vertical" space={system.gap.md} />}
|
|
40
|
+
</>
|
|
41
|
+
))}
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const stats = [
|
|
47
|
+
{label: 'Components', value: '128'},
|
|
48
|
+
{label: 'Contributors', value: '64'},
|
|
49
|
+
{label: 'Releases', value: '512'},
|
|
50
|
+
];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {ExampleCodeBlock, SymbolDoc} from '@workday/canvas-kit-docs';
|
|
2
2
|
|
|
3
3
|
import Basic from './examples/Basic';
|
|
4
4
|
import Custom from './examples/Custom';
|
|
@@ -46,6 +46,10 @@ position of the icon may be adjusted depending on where you place it in the mark
|
|
|
46
46
|
|
|
47
47
|
<ExampleCodeBlock code={Icon} />
|
|
48
48
|
|
|
49
|
+
> **Accessibility Note**: In this example, the icon is used as a decoration and is intentionally
|
|
50
|
+
> hidden from screen readers. If you're using icons to convey additional information, add
|
|
51
|
+
> `role="img"` and a translated `aria-label` string to `StatusIndicator.Icon`.
|
|
52
|
+
|
|
49
53
|
### Overflow
|
|
50
54
|
|
|
51
55
|
We **strongly** discourage using text in a `StatusIndicator` which will cause it to exceed its
|
|
@@ -61,14 +65,16 @@ of `StatusIndicator` via [style props](/get-started/for-developers/documentation
|
|
|
61
65
|
Set the `variant` prop of `StatusIndicator` to adjust its background color. `variant` accepts the
|
|
62
66
|
following values:
|
|
63
67
|
|
|
64
|
-
- `gray`
|
|
65
|
-
- `orange`
|
|
66
|
-
- `blue`
|
|
67
|
-
- `green`
|
|
68
|
-
- `red`
|
|
68
|
+
- `neutral` (default; `gray` is a deprecated alias)
|
|
69
|
+
- `caution` (`orange` is a deprecated alias)
|
|
70
|
+
- `info` (`blue` is a deprecated alias)
|
|
71
|
+
- `positive` (`green` is a deprecated alias)
|
|
72
|
+
- `critical` (`red` is a deprecated alias)
|
|
69
73
|
- `transparent`
|
|
70
74
|
|
|
71
75
|
The background color dictated by the `variant` will be dark or light based on the `emphasis`.
|
|
76
|
+
`variant` and `emphasis` change color only—they do not change the accessible name. Put the status
|
|
77
|
+
meaning in **`StatusIndicator.Label`**.
|
|
72
78
|
|
|
73
79
|
<ExampleCodeBlock code={Variants} />
|
|
74
80
|
|
|
@@ -84,6 +90,113 @@ Status Indicator and its subcomponents support custom styling via the `cs` prop.
|
|
|
84
90
|
information, check our
|
|
85
91
|
["How To Customize Styles"](https://workday.github.io/canvas-kit/?path=/docs/styling-guides-customizing-styles--docs).
|
|
86
92
|
|
|
93
|
+
## Accessibility
|
|
94
|
+
|
|
95
|
+
`StatusIndicator` is a compact, **non-interactive** status label. The accessibility goal is that
|
|
96
|
+
assistive technology users get the same status meaning as sighted users from
|
|
97
|
+
**`StatusIndicator.Label`** text—not from color, emphasis, or a decorative icon.
|
|
98
|
+
|
|
99
|
+
### Minimum Accessible Structure
|
|
100
|
+
|
|
101
|
+
The following matches the [Basic Example](#basic-example): a container and a visible label. Icon is
|
|
102
|
+
optional.
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
import {StatusIndicator} from '@workday/canvas-kit-preview-react/status-indicator';
|
|
106
|
+
|
|
107
|
+
<StatusIndicator>
|
|
108
|
+
<StatusIndicator.Label>Unpublished</StatusIndicator.Label>
|
|
109
|
+
</StatusIndicator>;
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Always include **`StatusIndicator.Label`** with concise text that names the status. Do not rely on
|
|
113
|
+
**`variant`**, **`emphasis`**, or **`StatusIndicator.Icon`** as the only indicator of meaning.
|
|
114
|
+
|
|
115
|
+
### Built-in Behaviors
|
|
116
|
+
|
|
117
|
+
Canvas Kit applies visual layout and color through `statusIndicatorStencil` when you compose
|
|
118
|
+
**`StatusIndicator`**, **`StatusIndicator.Label`**, and optionally **`StatusIndicator.Icon`**. It
|
|
119
|
+
does **not** apply `role="img"` or an accessible name on the icon. **Do not duplicate them** in
|
|
120
|
+
consuming code. Only add icon ARIA when the informative-icon requirement below applies.
|
|
121
|
+
|
|
122
|
+
**ARIA and DOM** (_applied by subcomponents_):
|
|
123
|
+
|
|
124
|
+
- **`StatusIndicator`**: renders a `div` (override with `as` if needed). Default `maxWidth` is
|
|
125
|
+
`200px`. Default `variant` is `neutral`; default `emphasis` is `low`. No ARIA role is set.
|
|
126
|
+
- **`StatusIndicator.Label`**: renders a `span` with bold subtext, `white-space: nowrap`,
|
|
127
|
+
`overflow: hidden`, and `text-overflow: ellipsis`. Truncation is visual; the full text remains in
|
|
128
|
+
the accessibility tree.
|
|
129
|
+
- **`StatusIndicator.Icon`**: renders `SystemIcon` at size `20`. It does **not** set `role="img"` or
|
|
130
|
+
`aria-label`. If `icon.type` is missing, the icon renders nothing.
|
|
131
|
+
|
|
132
|
+
**Keyboard** (_not a control by default_):
|
|
133
|
+
|
|
134
|
+
- **`StatusIndicator`** is not in the tab order. There is no built-in keyboard behavior.
|
|
135
|
+
|
|
136
|
+
**Screen reader expectations** (_when built-in behaviors are used as intended_):
|
|
137
|
+
|
|
138
|
+
- Assistive technology should announce the **`StatusIndicator.Label`** text as the content of the
|
|
139
|
+
indicator
|
|
140
|
+
- `variant` and `emphasis` are **not** announced
|
|
141
|
+
- A decorative **`StatusIndicator.Icon`** (no `role="img"`) should not add a separate accessible
|
|
142
|
+
name
|
|
143
|
+
- [**OverflowTooltip**](https://workday.github.io/canvas-kit/?path=/docs/components-popups-tooltip--docs#tooltips-on-overflowing-content)
|
|
144
|
+
uses `type="muted"` and does not set `aria-label` on the target—the accessible name stays the
|
|
145
|
+
element's text content
|
|
146
|
+
|
|
147
|
+
### Accessibility Requirements
|
|
148
|
+
|
|
149
|
+
Required in application code for an accessible Status Indicator. Rows marked _(conditional)_ apply
|
|
150
|
+
only when the situation matches—otherwise omit.
|
|
151
|
+
|
|
152
|
+
**If no design spec is provided:** include a visible **`StatusIndicator.Label`**; keep the icon
|
|
153
|
+
decorative (omit `role="img"` and `aria-label`); omit `tabIndex` and **`OverflowTooltip`**. Prefer
|
|
154
|
+
short label text so truncation is unnecessary.
|
|
155
|
+
|
|
156
|
+
| Requirement | How to satisfy |
|
|
157
|
+
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
158
|
+
| Visible status text | **`StatusIndicator.Label`** with translated text that names the status (for example, "Unpublished", not color alone) |
|
|
159
|
+
| Color is not the only indicator | Use **`variant`** / **`emphasis`** only as visual reinforcement of the label. See [Failure of Success Criterion 1.4.1 due to identifying required or error fields using color differences only](https://www.w3.org/WAI/WCAG22/Techniques/failures/F81) |
|
|
160
|
+
| Decorative icon _(conditional)_ | **`StatusIndicator.Icon`** with `icon={...}` and **no** `role="img"` when the icon only supports the label visually |
|
|
161
|
+
| Informative icon _(conditional)_ | On **`StatusIndicator.Icon`**, set `role="img"` and a translated `aria-label` that adds meaning **beyond** the label text |
|
|
162
|
+
| Overflowed label _(conditional)_ | Avoid exceeding the `200px` max width. If truncation cannot be avoided, wrap **`StatusIndicator`** in **`OverflowTooltip`** and set `tabIndex={0}` so keyboard and mouse users can reveal the full text. See the [Overflow example](#overflow) |
|
|
163
|
+
|
|
164
|
+
**Informative icon** _(conditional)_:
|
|
165
|
+
|
|
166
|
+
```tsx
|
|
167
|
+
import {StatusIndicator} from '@workday/canvas-kit-preview-react/status-indicator';
|
|
168
|
+
import {cloudArrowUpIcon} from '@workday/canvas-system-icons-web';
|
|
169
|
+
|
|
170
|
+
<StatusIndicator>
|
|
171
|
+
<StatusIndicator.Icon role="img" aria-label="Waiting to sync" icon={cloudArrowUpIcon} />
|
|
172
|
+
<StatusIndicator.Label>Unpublished</StatusIndicator.Label>
|
|
173
|
+
</StatusIndicator>;
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Summary for code generation:**
|
|
177
|
+
|
|
178
|
+
- **REQUIRED:** visible **`StatusIndicator.Label`** whose text conveys the status
|
|
179
|
+
- **CONDITIONAL:** `role="img"` + translated `aria-label` on **`StatusIndicator.Icon`**,
|
|
180
|
+
**`OverflowTooltip`** + `tabIndex={0}`
|
|
181
|
+
|
|
182
|
+
### Anti-Patterns
|
|
183
|
+
|
|
184
|
+
Do **not** generate code that does the following (see **Accessibility Requirements** above for what
|
|
185
|
+
to supply instead):
|
|
186
|
+
|
|
187
|
+
- Omit **`StatusIndicator.Label`** or use an empty label, relying on `variant`, `emphasis`, or an
|
|
188
|
+
icon for meaning
|
|
189
|
+
- Set `role="img"` on a decorative **`StatusIndicator.Icon`**, or set `role="img"` without a
|
|
190
|
+
translated `aria-label`—that can expose an unnamed image to assistive technology. See **Decorative
|
|
191
|
+
icon** and **Informative icon** in **Accessibility Requirements**
|
|
192
|
+
- Duplicate the label text as `aria-label` on the icon when the icon adds no extra meaning
|
|
193
|
+
- Add `role="status"`, `aria-live`, or `aria-label` on **`StatusIndicator`** by default—Canvas Kit
|
|
194
|
+
does not wire these, and they change how assistive technology treats a static label. If a design
|
|
195
|
+
requires announcing asynchronous updates, see
|
|
196
|
+
[ARIA Live Regions](https://workday.github.io/canvas-kit/?path=/docs/guides-accessibility-aria-live-regions--docs)
|
|
197
|
+
- Truncate label text without **`OverflowTooltip`** and `tabIndex={0}` when keyboard users must read
|
|
198
|
+
the overflow
|
|
199
|
+
|
|
87
200
|
## Component API
|
|
88
201
|
|
|
89
202
|
<SymbolDoc name="StatusIndicator" fileName="/preview-react/" />
|
|
@@ -12,12 +12,12 @@ export default () => {
|
|
|
12
12
|
return (
|
|
13
13
|
<Flex cs={parentContainerStyles}>
|
|
14
14
|
<StatusIndicator>
|
|
15
|
-
<StatusIndicator.Icon
|
|
15
|
+
<StatusIndicator.Icon icon={cloudArrowUpIcon} />
|
|
16
16
|
<StatusIndicator.Label>Unpublished</StatusIndicator.Label>
|
|
17
17
|
</StatusIndicator>
|
|
18
18
|
<StatusIndicator variant="positive">
|
|
19
19
|
<StatusIndicator.Label>published</StatusIndicator.Label>
|
|
20
|
-
<StatusIndicator.Icon
|
|
20
|
+
<StatusIndicator.Icon icon={cloudArrowUpIcon} />
|
|
21
21
|
</StatusIndicator>
|
|
22
22
|
</Flex>
|
|
23
23
|
);
|