@workday/canvas-kit-docs 9.0.2 → 9.1.0-429-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 +46 -0
- package/dist/es6/lib/specs.js +23 -1
- package/dist/mdx/react/action-bar/ActionBar.mdx +6 -0
- package/dist/mdx/react/action-bar/examples/OverflowActionBar.tsx +7 -6
- package/dist/mdx/react/action-bar/examples/OverflowActionBarCustomButtonCount.tsx +40 -0
- package/package.json +5 -5
package/dist/es6/lib/docs.js
CHANGED
|
@@ -31261,6 +31261,29 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
31261
31261
|
],
|
|
31262
31262
|
"tags": {}
|
|
31263
31263
|
},
|
|
31264
|
+
{
|
|
31265
|
+
"kind": "property",
|
|
31266
|
+
"name": "maximumVisible",
|
|
31267
|
+
"defaultValue": {
|
|
31268
|
+
"kind": "number",
|
|
31269
|
+
"value": 3
|
|
31270
|
+
},
|
|
31271
|
+
"type": {
|
|
31272
|
+
"kind": "primitive",
|
|
31273
|
+
"value": "number"
|
|
31274
|
+
},
|
|
31275
|
+
"required": false,
|
|
31276
|
+
"description": "The maximum number of actions that can be visible.\nMust be greater than 1 and less than items.length.",
|
|
31277
|
+
"declarations": [
|
|
31278
|
+
{
|
|
31279
|
+
"name": "maximumVisible",
|
|
31280
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/react/action-bar/lib/useActionBarModel.tsx"
|
|
31281
|
+
}
|
|
31282
|
+
],
|
|
31283
|
+
"tags": {
|
|
31284
|
+
"default": "3"
|
|
31285
|
+
}
|
|
31286
|
+
},
|
|
31264
31287
|
{
|
|
31265
31288
|
"kind": "property",
|
|
31266
31289
|
"name": "initialHiddenIds",
|
|
@@ -33414,6 +33437,29 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
33414
33437
|
],
|
|
33415
33438
|
"tags": {}
|
|
33416
33439
|
},
|
|
33440
|
+
{
|
|
33441
|
+
"kind": "property",
|
|
33442
|
+
"name": "maximumVisible",
|
|
33443
|
+
"defaultValue": {
|
|
33444
|
+
"kind": "number",
|
|
33445
|
+
"value": 3
|
|
33446
|
+
},
|
|
33447
|
+
"type": {
|
|
33448
|
+
"kind": "primitive",
|
|
33449
|
+
"value": "number"
|
|
33450
|
+
},
|
|
33451
|
+
"required": false,
|
|
33452
|
+
"description": "The maximum number of actions that can be visible.\nMust be greater than 1 and less than items.length.",
|
|
33453
|
+
"declarations": [
|
|
33454
|
+
{
|
|
33455
|
+
"name": "maximumVisible",
|
|
33456
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/react/action-bar/lib/useActionBarModel.tsx"
|
|
33457
|
+
}
|
|
33458
|
+
],
|
|
33459
|
+
"tags": {
|
|
33460
|
+
"default": "3"
|
|
33461
|
+
}
|
|
33462
|
+
},
|
|
33417
33463
|
{
|
|
33418
33464
|
"kind": "property",
|
|
33419
33465
|
"name": "initialHiddenIds",
|
package/dist/es6/lib/specs.js
CHANGED
|
@@ -135,7 +135,7 @@ module.exports = {specifications: [
|
|
|
135
135
|
},
|
|
136
136
|
{
|
|
137
137
|
"type": "describe",
|
|
138
|
-
"name": "when action list container is only
|
|
138
|
+
"name": "when action list container is only 420px wide",
|
|
139
139
|
"children": [
|
|
140
140
|
{
|
|
141
141
|
"type": "it",
|
|
@@ -202,6 +202,28 @@ module.exports = {specifications: [
|
|
|
202
202
|
]
|
|
203
203
|
}
|
|
204
204
|
]
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"type": "describe",
|
|
208
|
+
"name": "when [Components/Buttons/Action Bar, Overflow Action Bar Custom Button Count] story is rendered",
|
|
209
|
+
"children": [
|
|
210
|
+
{
|
|
211
|
+
"type": "it",
|
|
212
|
+
"name": "should pass axe checks"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"type": "it",
|
|
216
|
+
"name": "should have 3 visible buttons inside the \"actions\""
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"type": "it",
|
|
220
|
+
"name": "should focus on the \"More\" button"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"type": "it",
|
|
224
|
+
"name": "should have button inside the \"menu\""
|
|
225
|
+
}
|
|
226
|
+
]
|
|
205
227
|
}
|
|
206
228
|
]
|
|
207
229
|
}
|
|
@@ -6,6 +6,7 @@ import Basic from './examples/Basic';
|
|
|
6
6
|
import Icons from './examples/Icons';
|
|
7
7
|
import DeleteAction from './examples/DeleteAction';
|
|
8
8
|
import OverflowActionBar from './examples/OverflowActionBar';
|
|
9
|
+
import OverflowActionBarCustomButtonCount from './examples/OverflowActionBarCustomButtonCount';
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
# Canvas Kit Action Bar
|
|
@@ -67,6 +68,11 @@ should render.
|
|
|
67
68
|
|
|
68
69
|
<ExampleCodeBlock code={OverflowActionBar} />
|
|
69
70
|
|
|
71
|
+
The number of visible buttons can also be adjusted by using the model's `maximumVisible` attribute.
|
|
72
|
+
You can change it from the default of 3 to any number greater than 1 and less than items.length.
|
|
73
|
+
|
|
74
|
+
<ExampleCodeBlock code={OverflowActionBarCustomButtonCount} />
|
|
75
|
+
|
|
70
76
|
## Component API
|
|
71
77
|
|
|
72
78
|
<SymbolDoc name="ActionBar" fileName="/react/" />
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import {breakpoints} from '@workday/canvas-kit-react/common';
|
|
3
3
|
import {ActionBar, useActionBarModel} from '@workday/canvas-kit-react/action-bar';
|
|
4
|
-
import {PrimaryButton
|
|
4
|
+
import {PrimaryButton} from '@workday/canvas-kit-react/button';
|
|
5
5
|
import {SegmentedControl} from '@workday/canvas-kit-preview-react/segmented-control';
|
|
6
6
|
import {Box} from '@workday/canvas-kit-react/layout';
|
|
7
7
|
|
|
@@ -20,11 +20,11 @@ export default () => {
|
|
|
20
20
|
]);
|
|
21
21
|
|
|
22
22
|
const model = useActionBarModel({items});
|
|
23
|
-
const [containerWidth, setContainerWidth] = React.useState('100%');
|
|
23
|
+
const [containerWidth, setContainerWidth] = React.useState<string | number>('100%');
|
|
24
24
|
|
|
25
25
|
return (
|
|
26
26
|
<div>
|
|
27
|
-
<Box
|
|
27
|
+
<Box maxWidth={containerWidth} marginBottom="xl">
|
|
28
28
|
<ActionBar model={model}>
|
|
29
29
|
<ActionBar.List
|
|
30
30
|
position="relative"
|
|
@@ -58,8 +58,9 @@ export default () => {
|
|
|
58
58
|
<SegmentedControl onSelect={data => setContainerWidth(data.id)}>
|
|
59
59
|
<SegmentedControl.List aria-label="container width control" marginBottom="m">
|
|
60
60
|
<SegmentedControl.Item data-id="100%">100%</SegmentedControl.Item>
|
|
61
|
-
<SegmentedControl.Item data-id=
|
|
62
|
-
<SegmentedControl.Item data-id="
|
|
61
|
+
<SegmentedControl.Item data-id={`${breakpoints.m}px`}>Small</SegmentedControl.Item>
|
|
62
|
+
<SegmentedControl.Item data-id="420px">420px</SegmentedControl.Item>
|
|
63
|
+
<SegmentedControl.Item data-id={`${breakpoints.s}px`}>Extra Small</SegmentedControl.Item>
|
|
63
64
|
</SegmentedControl.List>
|
|
64
65
|
</SegmentedControl>
|
|
65
66
|
</div>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {ActionBar} from '@workday/canvas-kit-react/action-bar';
|
|
3
|
+
|
|
4
|
+
type MyActionItem = {
|
|
5
|
+
id: string;
|
|
6
|
+
text: React.ReactNode;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default () => {
|
|
10
|
+
const [items] = React.useState<MyActionItem[]>([
|
|
11
|
+
{id: 'view', text: 'View'},
|
|
12
|
+
{id: 'edit', text: 'Edit'},
|
|
13
|
+
{id: 'delete', text: 'Delete'},
|
|
14
|
+
]);
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<ActionBar items={items} maximumVisible={2}>
|
|
18
|
+
<ActionBar.List
|
|
19
|
+
aria-label="actions"
|
|
20
|
+
position="relative"
|
|
21
|
+
overflowButton={<ActionBar.OverflowButton aria-label="More actions" />}
|
|
22
|
+
>
|
|
23
|
+
{(item: MyActionItem) => (
|
|
24
|
+
<ActionBar.Item onClick={() => console.log(item.id)}>{item.text}</ActionBar.Item>
|
|
25
|
+
)}
|
|
26
|
+
</ActionBar.List>
|
|
27
|
+
<ActionBar.Menu.Popper>
|
|
28
|
+
<ActionBar.Menu.Card>
|
|
29
|
+
<ActionBar.Menu.List>
|
|
30
|
+
{(item: MyActionItem) => (
|
|
31
|
+
<ActionBar.Menu.Item onClick={() => console.log(item.id)}>
|
|
32
|
+
{item.text}
|
|
33
|
+
</ActionBar.Menu.Item>
|
|
34
|
+
)}
|
|
35
|
+
</ActionBar.Menu.List>
|
|
36
|
+
</ActionBar.Menu.Card>
|
|
37
|
+
</ActionBar.Menu.Popper>
|
|
38
|
+
</ActionBar>
|
|
39
|
+
);
|
|
40
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.1.0-429-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,9 +44,9 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@emotion/styled": "^11.6.0",
|
|
46
46
|
"@storybook/csf": "0.0.1",
|
|
47
|
-
"@workday/canvas-kit-labs-react": "^9.0.
|
|
48
|
-
"@workday/canvas-kit-preview-react": "^9.0.
|
|
49
|
-
"@workday/canvas-kit-react": "^9.0.
|
|
47
|
+
"@workday/canvas-kit-labs-react": "^9.1.0-429-next.0",
|
|
48
|
+
"@workday/canvas-kit-preview-react": "^9.1.0-429-next.0",
|
|
49
|
+
"@workday/canvas-kit-react": "^9.1.0-429-next.0",
|
|
50
50
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
51
51
|
"markdown-to-jsx": "^6.10.3",
|
|
52
52
|
"ts-node": "^10.9.1"
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"mkdirp": "^1.0.3",
|
|
58
58
|
"typescript": "4.2"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "41766d8358909bff45263f45f7a2ca9481678329"
|
|
61
61
|
}
|