@workday/canvas-kit-docs 14.2.3 → 14.2.4
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 +1033 -3
- package/dist/es6/lib/stackblitzFiles/packageJSONFile.js +5 -5
- package/dist/es6/lib/stackblitzFiles/packageJSONFile.ts +5 -5
- package/dist/mdx/labs-react/side-panel/SidePanel.mdx +85 -54
- package/dist/mdx/labs-react/side-panel/examples/AlwaysOpen.tsx +3 -3
- package/dist/mdx/labs-react/side-panel/examples/Basic.tsx +17 -37
- package/dist/mdx/labs-react/side-panel/examples/ExternalControl.tsx +6 -20
- package/dist/mdx/labs-react/side-panel/examples/{HiddenName.tsx → Heading.tsx} +4 -3
- package/dist/mdx/labs-react/side-panel/examples/OnStateTransition.tsx +3 -1
- package/dist/mdx/labs-react/side-panel/examples/RightOrigin.tsx +3 -9
- package/dist/mdx/labs-react/side-panel/examples/Variant.tsx +2 -8
- package/dist/mdx/react/layout/Box.mdx +1 -1
- package/package.json +6 -6
|
@@ -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.2.
|
|
22
|
-
"@workday/canvas-kit-preview-react": "14.2.
|
|
23
|
-
"@workday/canvas-kit-react": "14.2.
|
|
24
|
-
"@workday/canvas-kit-react-fonts": "^14.2.
|
|
25
|
-
"@workday/canvas-kit-styling": "14.2.
|
|
21
|
+
"@workday/canvas-kit-labs-react": "14.2.4",
|
|
22
|
+
"@workday/canvas-kit-preview-react": "14.2.4",
|
|
23
|
+
"@workday/canvas-kit-react": "14.2.4",
|
|
24
|
+
"@workday/canvas-kit-react-fonts": "^14.2.4",
|
|
25
|
+
"@workday/canvas-kit-styling": "14.2.4",
|
|
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.2.
|
|
22
|
-
"@workday/canvas-kit-preview-react": "14.2.
|
|
23
|
-
"@workday/canvas-kit-react": "14.2.
|
|
24
|
-
"@workday/canvas-kit-react-fonts": "^14.2.
|
|
25
|
-
"@workday/canvas-kit-styling": "14.2.
|
|
21
|
+
"@workday/canvas-kit-labs-react": "14.2.4",
|
|
22
|
+
"@workday/canvas-kit-preview-react": "14.2.4",
|
|
23
|
+
"@workday/canvas-kit-react": "14.2.4",
|
|
24
|
+
"@workday/canvas-kit-react-fonts": "^14.2.4",
|
|
25
|
+
"@workday/canvas-kit-styling": "14.2.4",
|
|
26
26
|
"@workday/canvas-system-icons-web": "3.0.36",
|
|
27
27
|
"@workday/canvas-tokens-web": "3.1.2"
|
|
28
28
|
},
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ExampleCodeBlock,
|
|
3
|
+
SymbolDoc,
|
|
4
|
+
Specifications,
|
|
5
|
+
StorybookStatusIndicator,
|
|
6
|
+
} from '@workday/canvas-kit-docs';
|
|
2
7
|
import Basic from './examples/Basic';
|
|
3
|
-
import
|
|
8
|
+
import Heading from './examples/Heading';
|
|
4
9
|
import AlternatePanel from './examples/Variant';
|
|
5
10
|
import ExternalControl from './examples/ExternalControl';
|
|
6
11
|
import RightOrigin from './examples/RightOrigin';
|
|
@@ -23,7 +28,8 @@ yarn add @workday/canvas-kit-labs-react
|
|
|
23
28
|
|
|
24
29
|
## Migrating from Preview
|
|
25
30
|
|
|
26
|
-
If you're migrating from `@workday/canvas-kit-preview-react/side-panel`, here are the key API
|
|
31
|
+
If you're migrating from `@workday/canvas-kit-preview-react/side-panel`, here are the key API
|
|
32
|
+
changes:
|
|
27
33
|
|
|
28
34
|
### Import Changes
|
|
29
35
|
|
|
@@ -37,27 +43,27 @@ import {SidePanel, useSidePanelModel} from '@workday/canvas-kit-labs-react/side-
|
|
|
37
43
|
|
|
38
44
|
### Hook API Changes
|
|
39
45
|
|
|
40
|
-
| Preview (`useSidePanel`)
|
|
41
|
-
|
|
42
|
-
| `initialExpanded: boolean`
|
|
43
|
-
| `origin: 'left' \| 'right'`
|
|
44
|
-
| Returns `expanded: boolean`
|
|
45
|
-
| Returns `setExpanded(bool)`
|
|
46
|
-
| Returns `panelProps` to spread
|
|
47
|
-
| Returns `labelProps` to spread
|
|
46
|
+
| Preview (`useSidePanel`) | Labs (`useSidePanelModel`) |
|
|
47
|
+
| -------------------------------- | ------------------------------------------------------- |
|
|
48
|
+
| `initialExpanded: boolean` | `initialTransitionState: 'expanded' \| 'collapsed'` |
|
|
49
|
+
| `origin: 'left' \| 'right'` | `origin: 'start' \| 'end'` |
|
|
50
|
+
| Returns `expanded: boolean` | Returns `model.state.transitionState` |
|
|
51
|
+
| Returns `setExpanded(bool)` | Use `model.events.expand()` / `model.events.collapse()` |
|
|
52
|
+
| Returns `panelProps` to spread | Props applied automatically via `elemPropsHook` |
|
|
53
|
+
| Returns `labelProps` to spread | Use `id={model.state.labelId}` on label element |
|
|
48
54
|
| Returns `controlProps` to spread | Props applied automatically to `SidePanel.ToggleButton` |
|
|
49
55
|
|
|
50
56
|
### Component API Changes
|
|
51
57
|
|
|
52
|
-
| Preview
|
|
53
|
-
|
|
54
|
-
| `<SidePanel {...panelProps}>`
|
|
55
|
-
| `<SidePanel.ToggleButton {...controlProps} />` | `<SidePanel.ToggleButton />`
|
|
56
|
-
| `<Heading {...labelProps}>`
|
|
57
|
-
| `expanded` prop on SidePanel
|
|
58
|
-
| `touched` prop on SidePanel
|
|
59
|
-
| `onExpandedChange` callback
|
|
60
|
-
| `onStateTransition` on component
|
|
58
|
+
| Preview | Labs |
|
|
59
|
+
| ---------------------------------------------- | ------------------------------------------------- |
|
|
60
|
+
| `<SidePanel {...panelProps}>` | `<SidePanel model={model}>` or just `<SidePanel>` |
|
|
61
|
+
| `<SidePanel.ToggleButton {...controlProps} />` | `<SidePanel.ToggleButton />` |
|
|
62
|
+
| `<Heading {...labelProps}>` | `<Heading id={model.state.labelId}>` |
|
|
63
|
+
| `expanded` prop on SidePanel | Managed by model's `transitionState` |
|
|
64
|
+
| `touched` prop on SidePanel | Managed internally |
|
|
65
|
+
| `onExpandedChange` callback | Use `onStateTransition` and derive expanded state |
|
|
66
|
+
| `onStateTransition` on component | `onStateTransition` on model config |
|
|
61
67
|
|
|
62
68
|
### Code Migration Example
|
|
63
69
|
|
|
@@ -67,17 +73,17 @@ const {expanded, panelProps, labelProps, controlProps} = useSidePanel({
|
|
|
67
73
|
initialExpanded: false,
|
|
68
74
|
});
|
|
69
75
|
|
|
70
|
-
<SidePanel {...panelProps} origin="right" onExpandedChange={
|
|
76
|
+
<SidePanel {...panelProps} origin="right" onExpandedChange={exp => console.log(exp)}>
|
|
71
77
|
<SidePanel.ToggleButton {...controlProps} />
|
|
72
78
|
<Heading {...labelProps}>Panel Title</Heading>
|
|
73
79
|
{expanded && <Content />}
|
|
74
|
-
</SidePanel
|
|
80
|
+
</SidePanel>;
|
|
75
81
|
|
|
76
82
|
// After (labs-react)
|
|
77
83
|
const model = useSidePanelModel({
|
|
78
84
|
initialTransitionState: 'collapsed',
|
|
79
85
|
origin: 'end',
|
|
80
|
-
onStateTransition:
|
|
86
|
+
onStateTransition: state => {
|
|
81
87
|
const isExpanded = state === 'expanded' || state === 'expanding';
|
|
82
88
|
console.log(isExpanded);
|
|
83
89
|
},
|
|
@@ -87,21 +93,25 @@ const model = useSidePanelModel({
|
|
|
87
93
|
<SidePanel.ToggleButton />
|
|
88
94
|
<Heading id={model.state.labelId}>Panel Title</Heading>
|
|
89
95
|
{model.state.transitionState === 'expanded' && <Content />}
|
|
90
|
-
</SidePanel
|
|
96
|
+
</SidePanel>;
|
|
91
97
|
```
|
|
92
98
|
|
|
93
99
|
### Checking Expanded State
|
|
94
100
|
|
|
95
101
|
```tsx
|
|
96
102
|
// Before (preview-react)
|
|
97
|
-
if (expanded) {
|
|
103
|
+
if (expanded) {
|
|
104
|
+
/* ... */
|
|
105
|
+
}
|
|
98
106
|
|
|
99
107
|
// After (labs-react) - for exact state
|
|
100
|
-
if (model.state.transitionState === 'expanded') {
|
|
108
|
+
if (model.state.transitionState === 'expanded') {
|
|
109
|
+
/* ... */
|
|
110
|
+
}
|
|
101
111
|
|
|
102
112
|
// After (labs-react) - including animation states
|
|
103
|
-
const isExpanded =
|
|
104
|
-
|
|
113
|
+
const isExpanded =
|
|
114
|
+
model.state.transitionState === 'expanded' || model.state.transitionState === 'expanding';
|
|
105
115
|
```
|
|
106
116
|
|
|
107
117
|
## Usage
|
|
@@ -111,14 +121,9 @@ const isExpanded = model.state.transitionState === 'expanded' ||
|
|
|
111
121
|
`SidePanel` is composed of three parts:
|
|
112
122
|
|
|
113
123
|
- The panel container (with an optional `model` prop)
|
|
114
|
-
-
|
|
124
|
+
- A heading (`SidePanel.Heading`) for the panel that is visually hidden when the panel is collapsed
|
|
115
125
|
- A toggle button (`SidePanel.ToggleButton`) to control the expand / collapse states
|
|
116
126
|
|
|
117
|
-
The component automatically handles:
|
|
118
|
-
- ARIA attributes (`aria-labelledby`, `aria-controls`, `aria-expanded`)
|
|
119
|
-
- Transition states (`expanding`, `expanded`, `collapsing`, `collapsed`)
|
|
120
|
-
- CSS transitions for smooth animations
|
|
121
|
-
|
|
122
127
|
Bidirectional support is built into `SidePanel`. As seen in the example below, CSS Flexbox flips the
|
|
123
128
|
page layout and the panel's contents. `SidePanel` also has logic to flip the position and direction
|
|
124
129
|
of the `ToggleButton` as well as the direction of the expand / collapse animation. If you're using
|
|
@@ -129,13 +134,12 @@ logic or styling for bidirectional support.
|
|
|
129
134
|
|
|
130
135
|
### Hidden Name
|
|
131
136
|
|
|
132
|
-
`SidePanel`
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
for screen readers.
|
|
137
|
+
`SidePanel`'s `<section>` element container should always have an accessible name to help screen
|
|
138
|
+
reader users understand the purpose of the panel. For this reason, we recommend using the
|
|
139
|
+
`SidePanel.Heading` component and setting the `hidden` prop to `true`. This will visually hide the
|
|
140
|
+
heading while keeping it accessible to screen readers.
|
|
137
141
|
|
|
138
|
-
<ExampleCodeBlock code={
|
|
142
|
+
<ExampleCodeBlock code={Heading} />
|
|
139
143
|
|
|
140
144
|
### Alternate Variant
|
|
141
145
|
|
|
@@ -148,8 +152,8 @@ used (this case is covered in the Examples section).
|
|
|
148
152
|
### External Control
|
|
149
153
|
|
|
150
154
|
Sometimes you'll want to control `SidePanel`'s expand / collapse behavior from outside the
|
|
151
|
-
component. You can use the model's events (`model.events.expand()` and `model.events.collapse()`)
|
|
152
|
-
|
|
155
|
+
component. You can use the model's events (`model.events.expand()` and `model.events.collapse()`) to
|
|
156
|
+
programmatically control the panel.
|
|
153
157
|
|
|
154
158
|
#### Notes about accessibility
|
|
155
159
|
|
|
@@ -168,9 +172,9 @@ state and call `model.events.expand()` or `model.events.collapse()` on click.
|
|
|
168
172
|
### Right Origin
|
|
169
173
|
|
|
170
174
|
By default, `SidePanel` uses a `start` origin (left in LTR, right in RTL). This sets the
|
|
171
|
-
`ToggleButton`'s position and direction as well as the direction of the animation. You can set
|
|
172
|
-
|
|
173
|
-
|
|
175
|
+
`ToggleButton`'s position and direction as well as the direction of the animation. You can set the
|
|
176
|
+
origin to `"end"` to flip these. The origin uses logical properties (`start`/`end`) for proper
|
|
177
|
+
bidirectional support.
|
|
174
178
|
|
|
175
179
|
<ExampleCodeBlock code={RightOrigin} />
|
|
176
180
|
|
|
@@ -183,26 +187,53 @@ If you do not need `SidePanel`'s expand / collapse behavior, you can simply omit
|
|
|
183
187
|
### Deriving Expanded State
|
|
184
188
|
|
|
185
189
|
If you need a simple boolean `expanded` state (similar to the preview-react `onExpandedChange`
|
|
186
|
-
callback), you can derive it from the `transitionState` using the `onStateTransition` callback
|
|
187
|
-
|
|
190
|
+
callback), you can derive it from the `transitionState` using the `onStateTransition` callback on
|
|
191
|
+
the model.
|
|
188
192
|
|
|
189
193
|
### onStateTransition
|
|
190
194
|
|
|
191
195
|
The `onStateTransition` callback is called whenever the panel's transition state changes. This
|
|
192
|
-
includes all four states: `expanding`, `expanded`, `collapsing`, and `collapsed`. You can pass
|
|
193
|
-
|
|
196
|
+
includes all four states: `expanding`, `expanded`, `collapsing`, and `collapsed`. You can pass this
|
|
197
|
+
callback directly to the `SidePanel` component or to the `useSidePanelModel` hook.
|
|
194
198
|
|
|
195
199
|
The transition flow is:
|
|
200
|
+
|
|
196
201
|
1. **Collapsing**: `expanded` → `collapsing` → `collapsed`
|
|
197
202
|
2. **Expanding**: `collapsed` → `expanding` → `expanded`
|
|
198
203
|
|
|
199
204
|
This is useful for:
|
|
205
|
+
|
|
200
206
|
- Triggering side effects when the panel state changes
|
|
201
207
|
- Syncing the panel state with external state management
|
|
202
208
|
- Animating child components based on the transition state
|
|
203
209
|
|
|
204
210
|
<ExampleCodeBlock code={OnStateTransition} />
|
|
205
211
|
|
|
212
|
+
### Accessibility
|
|
213
|
+
|
|
214
|
+
`SidePanel` renders a `<section>` element with an accessible name provided by `aria-labelledby`,
|
|
215
|
+
which references the `SidePanel.Heading` component. This ensures screen reader users understand the
|
|
216
|
+
purpose of the panel.
|
|
217
|
+
|
|
218
|
+
#### Panel and Heading
|
|
219
|
+
|
|
220
|
+
- The `SidePanel.Heading` provides the accessible name for the panel via `aria-labelledby`
|
|
221
|
+
- When the panel is collapsed, the heading is automatically hidden visually but remains accessible
|
|
222
|
+
to screen readers
|
|
223
|
+
- Use the `hidden` prop on `SidePanel.Heading` if you want the heading always visually hidden
|
|
224
|
+
|
|
225
|
+
#### Toggle Button
|
|
226
|
+
|
|
227
|
+
- `SidePanel.ToggleButton` automatically includes `aria-controls` (references the panel's `id`),
|
|
228
|
+
`aria-pressed` (indicates current state), and `aria-describedby` (references the panel's heading)
|
|
229
|
+
- Developers must provide a static `aria-label` string on `SidePanel.ToggleButton` to describe the
|
|
230
|
+
button's purpose (e.g., "Collapse View"). Avoid using ambiguous terms like "Toggle" in the label.
|
|
231
|
+
Since `aria-pressed` communicates the state, avoid dynamically updating `aria-label`
|
|
232
|
+
- The button includes a Tooltip with customizable text via `tooltipTextExpand` and
|
|
233
|
+
`tooltipTextCollapse` props (defaults: "Expand View" and "Collapse View")
|
|
234
|
+
- For optimal keyboard navigation, place `SidePanel.ToggleButton` as the first focusable element in
|
|
235
|
+
the panel
|
|
236
|
+
|
|
206
237
|
## Component API
|
|
207
238
|
|
|
208
239
|
<SymbolDoc name="SidePanel" fileName="/labs-react/" />
|
|
@@ -221,17 +252,17 @@ import {useSidePanelModel} from '@workday/canvas-kit-labs-react/side-panel';
|
|
|
221
252
|
const model = useSidePanelModel({
|
|
222
253
|
initialTransitionState: 'collapsed',
|
|
223
254
|
origin: 'end',
|
|
224
|
-
onStateTransition:
|
|
255
|
+
onStateTransition: state => console.log('State:', state),
|
|
225
256
|
});
|
|
226
257
|
|
|
227
258
|
// Access state
|
|
228
259
|
model.state.transitionState; // 'expanded' | 'expanding' | 'collapsed' | 'collapsing'
|
|
229
|
-
model.state.panelId;
|
|
230
|
-
model.state.labelId;
|
|
260
|
+
model.state.panelId; // unique ID for the panel
|
|
261
|
+
model.state.labelId; // unique ID for the label
|
|
231
262
|
|
|
232
263
|
// Trigger events
|
|
233
|
-
model.events.expand();
|
|
234
|
-
model.events.collapse();
|
|
264
|
+
model.events.expand(); // Set to expanded (no animation)
|
|
265
|
+
model.events.collapse(); // Set to collapsed (no animation)
|
|
235
266
|
model.events.handleAnimationStart(); // Start expand/collapse animation
|
|
236
267
|
```
|
|
237
268
|
|
|
@@ -2,7 +2,7 @@ import {AccentIcon} from '@workday/canvas-kit-react/icon';
|
|
|
2
2
|
import {rocketIcon} from '@workday/canvas-accent-icons-web';
|
|
3
3
|
import {SidePanel, useSidePanelModel} from '@workday/canvas-kit-labs-react/side-panel';
|
|
4
4
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
5
|
-
import {
|
|
5
|
+
import {Text} from '@workday/canvas-kit-react/text';
|
|
6
6
|
import {system} from '@workday/canvas-tokens-web';
|
|
7
7
|
import {createStyles, px2rem} from '@workday/canvas-kit-styling';
|
|
8
8
|
|
|
@@ -37,9 +37,9 @@ export default () => {
|
|
|
37
37
|
<SidePanel model={model}>
|
|
38
38
|
<Flex cs={stylesOverride.panelContainer}>
|
|
39
39
|
<AccentIcon icon={rocketIcon} cs={stylesOverride.accentIcon} />
|
|
40
|
-
<Heading size="small" cs={stylesOverride.panelHeading}
|
|
40
|
+
<SidePanel.Heading size="small" cs={stylesOverride.panelHeading}>
|
|
41
41
|
Tasks Panel
|
|
42
|
-
</Heading>
|
|
42
|
+
</SidePanel.Heading>
|
|
43
43
|
</Flex>
|
|
44
44
|
</SidePanel>
|
|
45
45
|
<Flex as="main" cs={stylesOverride.mainContent}>
|
|
@@ -1,54 +1,34 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import {SidePanel, useSidePanelModel} from '@workday/canvas-kit-labs-react/side-panel';
|
|
4
4
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
5
|
-
import {Heading, Text} from '@workday/canvas-kit-react/text';
|
|
6
5
|
import {AccentIcon} from '@workday/canvas-kit-react/icon';
|
|
7
|
-
import {rocketIcon} from '@workday/canvas-accent-icons-web';
|
|
8
6
|
import {createStyles, px2rem} from '@workday/canvas-kit-styling';
|
|
7
|
+
import {rocketIcon} from '@workday/canvas-accent-icons-web';
|
|
9
8
|
import {system} from '@workday/canvas-tokens-web';
|
|
10
9
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
accentIcon: createStyles({
|
|
20
|
-
marginInlineEnd: system.space.x4,
|
|
21
|
-
}),
|
|
22
|
-
mainContent: createStyles({
|
|
23
|
-
alignItems: 'center',
|
|
24
|
-
justifyContent: 'center',
|
|
25
|
-
flexDirection: 'column',
|
|
26
|
-
flex: 1,
|
|
27
|
-
flexBasis: 'auto',
|
|
28
|
-
}),
|
|
29
|
-
};
|
|
10
|
+
const flexHeadingStyles = createStyles({
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
gap: system.space.x2,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const viewPortStyles = createStyles({
|
|
16
|
+
height: px2rem(320),
|
|
17
|
+
});
|
|
30
18
|
|
|
31
19
|
export default () => {
|
|
32
20
|
const model = useSidePanelModel();
|
|
33
21
|
|
|
34
22
|
return (
|
|
35
|
-
<Flex cs={
|
|
23
|
+
<Flex cs={viewPortStyles}>
|
|
36
24
|
<SidePanel model={model}>
|
|
37
|
-
<SidePanel.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<Flex cs={stylesOverride.accentIcon}>
|
|
41
|
-
<AccentIcon icon={rocketIcon} />
|
|
42
|
-
</Flex>
|
|
43
|
-
)}
|
|
44
|
-
<Heading
|
|
45
|
-
size="small"
|
|
46
|
-
id={model.state.labelId}
|
|
47
|
-
hidden={model.state.transitionState === 'collapsed' ? true : undefined}
|
|
48
|
-
>
|
|
25
|
+
<SidePanel.Heading size="small">
|
|
26
|
+
<Flex cs={flexHeadingStyles}>
|
|
27
|
+
<AccentIcon icon={rocketIcon} />
|
|
49
28
|
Tasks Panel
|
|
50
|
-
</
|
|
51
|
-
</
|
|
29
|
+
</Flex>
|
|
30
|
+
</SidePanel.Heading>
|
|
31
|
+
<SidePanel.ToggleButton aria-label="Collapse View" />
|
|
52
32
|
</SidePanel>
|
|
53
33
|
</Flex>
|
|
54
34
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import {SidePanel, useSidePanelModel} from '@workday/canvas-kit-labs-react/side-panel';
|
|
3
3
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
4
|
-
import {
|
|
4
|
+
import {Text} from '@workday/canvas-kit-react/text';
|
|
5
5
|
import {SecondaryButton} from '@workday/canvas-kit-react/button';
|
|
6
6
|
import {createStyles, px2rem} from '@workday/canvas-kit-styling';
|
|
7
7
|
import {system} from '@workday/canvas-tokens-web';
|
|
@@ -26,19 +26,6 @@ const stylesOverride = {
|
|
|
26
26
|
}),
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
/*
|
|
30
|
-
* NOTE TO DEV:
|
|
31
|
-
* Spreading the `controlProps` onto an external control creates serious accessibility issues.
|
|
32
|
-
* - `aria-labelledby` id reference is invalid when the SidePanel is collapsed
|
|
33
|
-
* - `aria-labelledby` will change the name of "Toggle Side Panel" button to "Tasks Panel"
|
|
34
|
-
* - `aria-expanded` won't make sense to screen reader users when the expanded SidePanel content isn't following the control
|
|
35
|
-
* - `aria-controls` is unsupported by screen readers and will not allow users to navigate to the controlled content
|
|
36
|
-
*
|
|
37
|
-
* SOLUTION:
|
|
38
|
-
* - Pass the `controlProps` click handler function down to the external control component.
|
|
39
|
-
* - Add a toggle state to Button components with `aria-pressed` for screen readers,
|
|
40
|
-
* - OR use a similar toggle input like Checkbox or Switch.
|
|
41
|
-
*/
|
|
42
29
|
export default () => {
|
|
43
30
|
const model = useSidePanelModel({
|
|
44
31
|
initialTransitionState: 'collapsed',
|
|
@@ -48,13 +35,12 @@ export default () => {
|
|
|
48
35
|
return (
|
|
49
36
|
<Flex cs={stylesOverride.viewport}>
|
|
50
37
|
<SidePanel model={model}>
|
|
51
|
-
<SidePanel.ToggleButton />
|
|
38
|
+
<SidePanel.ToggleButton aria-label="Collapse View" />
|
|
39
|
+
<SidePanel.Heading size="small" cs={stylesOverride.panelHeading}>
|
|
40
|
+
Task Panel
|
|
41
|
+
</SidePanel.Heading>
|
|
52
42
|
{model.state.transitionState === 'expanded' && (
|
|
53
|
-
<Flex cs={stylesOverride.panel}>
|
|
54
|
-
<Heading size="small" cs={stylesOverride.panelHeading} id={model.state.labelId}>
|
|
55
|
-
Tasks Panel
|
|
56
|
-
</Heading>
|
|
57
|
-
</Flex>
|
|
43
|
+
<Flex cs={stylesOverride.panel}>Contents</Flex>
|
|
58
44
|
)}
|
|
59
45
|
</SidePanel>
|
|
60
46
|
<Flex as="main" cs={stylesOverride.main}>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import {SidePanel, useSidePanelModel} from '@workday/canvas-kit-labs-react/side-panel';
|
|
3
3
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
4
|
-
import {AccessibleHide} from '@workday/canvas-kit-react/common';
|
|
5
4
|
import {Text} from '@workday/canvas-kit-react/text';
|
|
6
5
|
import {createStyles, px2rem} from '@workday/canvas-kit-styling';
|
|
7
6
|
|
|
@@ -28,8 +27,10 @@ export default () => {
|
|
|
28
27
|
return (
|
|
29
28
|
<Flex cs={stylesOverride.viewport}>
|
|
30
29
|
<SidePanel model={model}>
|
|
31
|
-
<SidePanel.ToggleButton />
|
|
32
|
-
<
|
|
30
|
+
<SidePanel.ToggleButton aria-label="Collapse View" />
|
|
31
|
+
<SidePanel.Heading hidden size="small">
|
|
32
|
+
Tasks Panel
|
|
33
|
+
</SidePanel.Heading>
|
|
33
34
|
</SidePanel>
|
|
34
35
|
<Flex as="main" cs={stylesOverride.main}>
|
|
35
36
|
<Text as="p" typeLevel="body.large">
|
|
@@ -37,7 +37,9 @@ export default () => {
|
|
|
37
37
|
<Flex cs={stylesOverride.viewport}>
|
|
38
38
|
<SidePanel model={model}>
|
|
39
39
|
<SidePanel.ToggleButton />
|
|
40
|
-
<
|
|
40
|
+
<SidePanel.Heading hidden size="small">
|
|
41
|
+
Hidden Title
|
|
42
|
+
</SidePanel.Heading>
|
|
41
43
|
</SidePanel>
|
|
42
44
|
<Flex as="main" cs={stylesOverride.main}>
|
|
43
45
|
<Text as="p" typeLevel="body.large">
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {SecondaryButton} from '@workday/canvas-kit-react/button';
|
|
2
2
|
import {SidePanel, useSidePanelModel} from '@workday/canvas-kit-labs-react/side-panel';
|
|
3
3
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
4
|
-
import {
|
|
4
|
+
import {Text} from '@workday/canvas-kit-react/text';
|
|
5
5
|
import {CanvasProvider} from '@workday/canvas-kit-react/common';
|
|
6
6
|
import {createStyles, px2rem} from '@workday/canvas-kit-styling';
|
|
7
7
|
import {system} from '@workday/canvas-tokens-web';
|
|
@@ -37,15 +37,9 @@ const RightPanel = () => {
|
|
|
37
37
|
|
|
38
38
|
return (
|
|
39
39
|
<SidePanel model={model} className={stylesOverride.panelContainer}>
|
|
40
|
-
<SidePanel.ToggleButton />
|
|
40
|
+
<SidePanel.ToggleButton aria-label="Collapse View" />
|
|
41
41
|
<Flex cs={stylesOverride.panel}>
|
|
42
|
-
<Heading
|
|
43
|
-
size="small"
|
|
44
|
-
hidden={model.state.transitionState === 'collapsed' ? true : undefined}
|
|
45
|
-
id={model.state.labelId}
|
|
46
|
-
>
|
|
47
|
-
Tasks Panel
|
|
48
|
-
</Heading>
|
|
42
|
+
<SidePanel.Heading size="small">Tasks Panel</SidePanel.Heading>
|
|
49
43
|
</Flex>
|
|
50
44
|
</SidePanel>
|
|
51
45
|
);
|
|
@@ -35,15 +35,9 @@ export default () => {
|
|
|
35
35
|
<CanvasProvider dir={direction}>
|
|
36
36
|
<Flex cs={stylesOverride.viewport}>
|
|
37
37
|
<SidePanel model={model} variant="alternate">
|
|
38
|
-
<SidePanel.ToggleButton />
|
|
38
|
+
<SidePanel.ToggleButton aria-label="Collapse View" />
|
|
39
39
|
<Flex cs={stylesOverride.panel}>
|
|
40
|
-
<Heading
|
|
41
|
-
size="small"
|
|
42
|
-
hidden={model.state.transitionState === 'collapsed' ? true : undefined}
|
|
43
|
-
id={model.state.labelId}
|
|
44
|
-
>
|
|
45
|
-
Alternate Panel
|
|
46
|
-
</Heading>
|
|
40
|
+
<SidePanel.Heading size="small">Alternate Panel</SidePanel.Heading>
|
|
47
41
|
</Flex>
|
|
48
42
|
</SidePanel>
|
|
49
43
|
<Flex as="main" cs={stylesOverride.main}>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "14.2.
|
|
3
|
+
"version": "14.2.4",
|
|
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,10 +45,10 @@
|
|
|
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": "^14.2.
|
|
49
|
-
"@workday/canvas-kit-preview-react": "^14.2.
|
|
50
|
-
"@workday/canvas-kit-react": "^14.2.
|
|
51
|
-
"@workday/canvas-kit-styling": "^14.2.
|
|
48
|
+
"@workday/canvas-kit-labs-react": "^14.2.4",
|
|
49
|
+
"@workday/canvas-kit-preview-react": "^14.2.4",
|
|
50
|
+
"@workday/canvas-kit-react": "^14.2.4",
|
|
51
|
+
"@workday/canvas-kit-styling": "^14.2.4",
|
|
52
52
|
"@workday/canvas-system-icons-web": "^3.0.36",
|
|
53
53
|
"@workday/canvas-tokens-web": "^3.1.1",
|
|
54
54
|
"markdown-to-jsx": "^7.2.0",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"mkdirp": "^1.0.3",
|
|
62
62
|
"typescript": "5.0"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "039da83fef34eac26de361fc512d548760ec1ee8"
|
|
65
65
|
}
|