@workday/canvas-kit-docs 11.0.0-alpha.671-next.0 → 11.0.0-alpha.693-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 +2498 -294
- package/dist/es6/lib/specs.js +24 -0
- package/dist/es6/mdx/versionsTable.d.ts +2 -0
- package/dist/es6/mdx/versionsTable.d.ts.map +1 -0
- package/dist/es6/mdx/versionsTable.js +76 -0
- package/dist/mdx/11.0-UPGRADE-GUIDE.mdx +14 -2
- package/dist/mdx/Versions.mdx +8 -0
- package/dist/mdx/preview-react/_examples/TablesAdvanced.mdx +84 -0
- package/dist/mdx/preview-react/_examples/examples/Table/WithExpandableRows.tsx +219 -0
- package/dist/mdx/preview-react/_examples/examples/Table/WithSelectableRows.tsx +156 -0
- package/dist/mdx/preview-react/_examples/examples/Table/WithSortableColumnHeaders.tsx +213 -0
- package/dist/mdx/preview-react/side-panel/examples/Basic.tsx +17 -15
- package/dist/mdx/preview-react/side-panel/examples/RightOrigin.tsx +14 -12
- package/dist/mdx/preview-react/side-panel/examples/Variant.tsx +14 -12
- package/dist/mdx/preview-react/table/Table.mdx +16 -1
- package/dist/mdx/preview-react/table/examples/RightToLeft.tsx +38 -0
- package/dist/mdx/react/select/Select.mdx +82 -7
- package/dist/mdx/react/select/examples/Basic.tsx +1 -1
- package/dist/mdx/react/select/examples/Complex.tsx +11 -16
- package/dist/mdx/react/select/examples/FetchingDynamicItems.tsx +103 -0
- package/dist/mdx/react/select/examples/Grow.tsx +1 -5
- package/dist/mdx/react/select/examples/HoistedModel.tsx +8 -15
- package/dist/mdx/react/select/examples/InitialSelectedItem.tsx +60 -0
- package/dist/mdx/react/select/examples/LabelPosition.tsx +1 -3
- package/dist/mdx/react/select/examples/Placeholder.tsx +41 -0
- package/dist/mdx/react/select/examples/RefForwarding.tsx +1 -0
- package/package.json +6 -6
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {FormField} from '@workday/canvas-kit-react/form-field';
|
|
3
|
+
import {Select, useSelectModel} from '@workday/canvas-kit-react/select';
|
|
4
|
+
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
5
|
+
import {PrimaryButton} from '@workday/canvas-kit-react/button';
|
|
6
|
+
import {useMount} from '@workday/canvas-kit-react/common';
|
|
7
|
+
|
|
8
|
+
const movieListItems = [
|
|
9
|
+
{
|
|
10
|
+
label: 'The Lion King',
|
|
11
|
+
serverId: '123',
|
|
12
|
+
Year: '2019',
|
|
13
|
+
Runtime: '118 min',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
label: 'Mowgli: Legend of the Jungle',
|
|
17
|
+
serverId: '234',
|
|
18
|
+
Year: '2018',
|
|
19
|
+
Runtime: '104 min',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
label: 'Doctor Strange',
|
|
23
|
+
serverId: '345',
|
|
24
|
+
Year: '2016',
|
|
25
|
+
Runtime: '115 min',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
label: 'John Wick',
|
|
29
|
+
Year: '2014',
|
|
30
|
+
serverId: '456',
|
|
31
|
+
Runtime: '101 min',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
label: 'The Notebook',
|
|
35
|
+
serverId: '567',
|
|
36
|
+
Year: '2004',
|
|
37
|
+
Runtime: '123 min',
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
export default () => {
|
|
42
|
+
const [id, setId] = React.useState('456');
|
|
43
|
+
const [value, setValue] = React.useState('');
|
|
44
|
+
const [moviesLists, setMoviesList] = React.useState([]);
|
|
45
|
+
const [loadingStatus, setLoadingStatus] = React.useState<'idle' | 'loading' | 'success'>('idle');
|
|
46
|
+
const loadingRef = React.useRef<ReturnType<typeof setTimeout>>();
|
|
47
|
+
|
|
48
|
+
const model = useSelectModel({
|
|
49
|
+
items: moviesLists,
|
|
50
|
+
getTextValue: item => item.label,
|
|
51
|
+
getId: item => item.serverId,
|
|
52
|
+
initialSelectedIds: [id],
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
function loadItems() {
|
|
56
|
+
setLoadingStatus('loading');
|
|
57
|
+
loadingRef.current = setTimeout(() => {
|
|
58
|
+
setLoadingStatus('success');
|
|
59
|
+
setMoviesList(movieListItems);
|
|
60
|
+
}, 1500);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
useMount(() => {
|
|
64
|
+
return () => {
|
|
65
|
+
clearTimeout(loadingRef.current);
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<Flex flexDirection="column" maxWidth={300}>
|
|
71
|
+
<div id="foo">Foo Bar</div>
|
|
72
|
+
<Select model={model}>
|
|
73
|
+
<FormField label="Choose a Film">
|
|
74
|
+
<Select.Input
|
|
75
|
+
onChange={e => {
|
|
76
|
+
setId(e.target.value);
|
|
77
|
+
setValue(model.navigation.getItem(e.target.value, model).textValue);
|
|
78
|
+
}}
|
|
79
|
+
placeholder={loadingStatus}
|
|
80
|
+
/>
|
|
81
|
+
<Select.Popper>
|
|
82
|
+
<Select.Card>
|
|
83
|
+
<Select.List>
|
|
84
|
+
{item => {
|
|
85
|
+
return <Select.Item>{item.label}</Select.Item>;
|
|
86
|
+
}}
|
|
87
|
+
</Select.List>
|
|
88
|
+
</Select.Card>
|
|
89
|
+
</Select.Popper>
|
|
90
|
+
</FormField>
|
|
91
|
+
</Select>
|
|
92
|
+
<div data-testid="selected-id">Selected Id: {id}</div>
|
|
93
|
+
<div data-testid="selected-value">Selected value: {value}</div>
|
|
94
|
+
<PrimaryButton
|
|
95
|
+
onClick={() => {
|
|
96
|
+
loadItems();
|
|
97
|
+
}}
|
|
98
|
+
>
|
|
99
|
+
Get Items
|
|
100
|
+
</PrimaryButton>
|
|
101
|
+
</Flex>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
@@ -25,11 +25,7 @@ export default () => {
|
|
|
25
25
|
<FormField.Input grow as={Select.Input} />
|
|
26
26
|
<Select.Popper>
|
|
27
27
|
<Select.Card>
|
|
28
|
-
{
|
|
29
|
-
<Select.List scrollMargin="10px">
|
|
30
|
-
{item => <Select.Item>{item}</Select.Item>}
|
|
31
|
-
</Select.List>
|
|
32
|
-
)}
|
|
28
|
+
<Select.List>{item => <Select.Item>{item}</Select.Item>}</Select.List>
|
|
33
29
|
</Select.Card>
|
|
34
30
|
</Select.Popper>
|
|
35
31
|
</FormField>
|
|
@@ -5,18 +5,17 @@ import {Select, useSelectModel} from '@workday/canvas-kit-react/select';
|
|
|
5
5
|
import {BodyText} from '@workday/canvas-kit-react/text';
|
|
6
6
|
|
|
7
7
|
const options = [
|
|
8
|
-
'E-mail',
|
|
9
|
-
'Phone',
|
|
10
|
-
'Fax
|
|
11
|
-
'Mail',
|
|
12
|
-
'Mobile Phone',
|
|
13
|
-
'The Ontologically Anthropocentric Sensory Immersive Simulation',
|
|
8
|
+
{text: 'E-mail', id: 'email-1'},
|
|
9
|
+
{text: 'Phone', id: 'phone-2'},
|
|
10
|
+
{text: 'Fax', id: 'fax-3'},
|
|
11
|
+
{text: 'Mail', id: 'mail-4'},
|
|
12
|
+
{text: 'Mobile Phone', id: 'mobile-phone-5'},
|
|
14
13
|
];
|
|
15
14
|
|
|
16
15
|
export default () => {
|
|
17
16
|
const model = useSelectModel({
|
|
18
17
|
items: options,
|
|
19
|
-
|
|
18
|
+
initialSelectedIds: ['fax-3'],
|
|
20
19
|
});
|
|
21
20
|
|
|
22
21
|
return (
|
|
@@ -27,13 +26,7 @@ export default () => {
|
|
|
27
26
|
<FormField.Input as={Select.Input} />
|
|
28
27
|
<Select.Popper>
|
|
29
28
|
<Select.Card>
|
|
30
|
-
<Select.List>
|
|
31
|
-
{item => (
|
|
32
|
-
<Select.Item aria-disabled={item === 'Fax (disabled)' ? true : undefined}>
|
|
33
|
-
{item}
|
|
34
|
-
</Select.Item>
|
|
35
|
-
)}
|
|
36
|
-
</Select.List>
|
|
29
|
+
<Select.List>{item => <Select.Item>{item.text}</Select.Item>}</Select.List>
|
|
37
30
|
</Select.Card>
|
|
38
31
|
</Select.Popper>
|
|
39
32
|
</FormField>
|
|
@@ -41,7 +34,7 @@ export default () => {
|
|
|
41
34
|
<BodyText size="small">Selected Value: {model.state.selectedIds[0]}</BodyText>
|
|
42
35
|
<SecondaryButton
|
|
43
36
|
onClick={() => {
|
|
44
|
-
model.events.select({id: '
|
|
37
|
+
model.events.select({id: 'phone-2'});
|
|
45
38
|
}}
|
|
46
39
|
>
|
|
47
40
|
Select Phone Item
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {FormField} from '@workday/canvas-kit-react/form-field';
|
|
3
|
+
import {Select} from '@workday/canvas-kit-react/select';
|
|
4
|
+
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
5
|
+
|
|
6
|
+
const options = [
|
|
7
|
+
{
|
|
8
|
+
id: 'b310c757b2d341f99d40d76f4d563c5b',
|
|
9
|
+
descriptor: 'Arabic',
|
|
10
|
+
languageCode: 'ar',
|
|
11
|
+
label: 'Arabic',
|
|
12
|
+
nativeLanguageName: 'العربية',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: 'a675a6b6e22d100017d7fe2a784d1255',
|
|
16
|
+
descriptor: 'Bulgarian (Bulgaria)',
|
|
17
|
+
languageCode: 'bg_BG',
|
|
18
|
+
label: 'Bulgarian (Bulgaria)',
|
|
19
|
+
nativeLanguageName: 'български (Република България)',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: 'da594226446c11de98360015c5e6daf6',
|
|
23
|
+
descriptor: 'English (United States)',
|
|
24
|
+
languageCode: 'en_US',
|
|
25
|
+
label: 'English (United States)',
|
|
26
|
+
nativeLanguageName: 'English',
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
export default () => {
|
|
31
|
+
const [value, setValue] = React.useState('English (United States)');
|
|
32
|
+
const [id, setId] = React.useState('da594226446c11de98360015c5e6daf6');
|
|
33
|
+
|
|
34
|
+
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
35
|
+
setId(event.target.value);
|
|
36
|
+
setValue(options.find(item => item.id === event.target.value).label);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Flex flexDirection="column">
|
|
41
|
+
<Select
|
|
42
|
+
items={options}
|
|
43
|
+
initialSelectedIds={['da594226446c11de98360015c5e6daf6']}
|
|
44
|
+
getId={item => item.id}
|
|
45
|
+
getTextValue={item => item.label}
|
|
46
|
+
>
|
|
47
|
+
<FormField label="Contact">
|
|
48
|
+
<Select.Input onChange={e => handleChange(e)} />
|
|
49
|
+
<Select.Popper>
|
|
50
|
+
<Select.Card>
|
|
51
|
+
<Select.List>{item => <Select.Item>{item.label}</Select.Item>}</Select.List>
|
|
52
|
+
</Select.Card>
|
|
53
|
+
</Select.Popper>
|
|
54
|
+
</FormField>
|
|
55
|
+
</Select>
|
|
56
|
+
<p>Id: {id}</p>
|
|
57
|
+
<p>Value: {value}</p>
|
|
58
|
+
</Flex>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
@@ -25,9 +25,7 @@ export default () => {
|
|
|
25
25
|
<FormField.Input as={Select.Input} />
|
|
26
26
|
<Select.Popper>
|
|
27
27
|
<Select.Card>
|
|
28
|
-
{
|
|
29
|
-
<Select.List>{item => <Select.Item>{item}</Select.Item>}</Select.List>
|
|
30
|
-
)}
|
|
28
|
+
<Select.List>{item => <Select.Item>{item}</Select.Item>}</Select.List>
|
|
31
29
|
</Select.Card>
|
|
32
30
|
</Select.Popper>
|
|
33
31
|
</FormField>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {FormField} from '@workday/canvas-kit-react/form-field';
|
|
3
|
+
import {Select} from '@workday/canvas-kit-react/select';
|
|
4
|
+
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
5
|
+
|
|
6
|
+
const options = [
|
|
7
|
+
'E-mail',
|
|
8
|
+
'Phone',
|
|
9
|
+
'Fax',
|
|
10
|
+
'Mail',
|
|
11
|
+
'Mobile Phone',
|
|
12
|
+
'The Ontologically Anthropocentric Sensory Immersive Simulation',
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
export default () => {
|
|
16
|
+
const [value, setValue] = React.useState('');
|
|
17
|
+
|
|
18
|
+
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
19
|
+
setValue(event.target.value);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Flex flexDirection="column">
|
|
24
|
+
<Select items={options}>
|
|
25
|
+
<FormField label="Contact">
|
|
26
|
+
<Select.Input placeholder="Make a Selection" onChange={e => handleChange(e)} />
|
|
27
|
+
<Select.Popper>
|
|
28
|
+
<Select.Card>
|
|
29
|
+
<Select.List>
|
|
30
|
+
{item => {
|
|
31
|
+
return <Select.Item>{item}</Select.Item>;
|
|
32
|
+
}}
|
|
33
|
+
</Select.List>
|
|
34
|
+
</Select.Card>
|
|
35
|
+
</Select.Popper>
|
|
36
|
+
</FormField>
|
|
37
|
+
</Select>
|
|
38
|
+
Selected Value: {value}
|
|
39
|
+
</Flex>
|
|
40
|
+
);
|
|
41
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "11.0.0-alpha.
|
|
3
|
+
"version": "11.0.0-alpha.693-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,10 +44,10 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@emotion/styled": "^11.6.0",
|
|
46
46
|
"@storybook/csf": "0.0.1",
|
|
47
|
-
"@workday/canvas-kit-labs-react": "^11.0.0-alpha.
|
|
48
|
-
"@workday/canvas-kit-preview-react": "^11.0.0-alpha.
|
|
49
|
-
"@workday/canvas-kit-react": "^11.0.0-alpha.
|
|
50
|
-
"@workday/canvas-kit-styling": "^
|
|
47
|
+
"@workday/canvas-kit-labs-react": "^11.0.0-alpha.693-next.0",
|
|
48
|
+
"@workday/canvas-kit-preview-react": "^11.0.0-alpha.693-next.0",
|
|
49
|
+
"@workday/canvas-kit-react": "^11.0.0-alpha.693-next.0",
|
|
50
|
+
"@workday/canvas-kit-styling": "^11.0.0-alpha.693-next.0",
|
|
51
51
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
52
52
|
"@workday/canvas-tokens-web": "^1.0.2",
|
|
53
53
|
"markdown-to-jsx": "^6.10.3",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"mkdirp": "^1.0.3",
|
|
60
60
|
"typescript": "4.2"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "2ba2e730d7a13e5067afa7f482887539011d742f"
|
|
63
63
|
}
|