@workday/canvas-kit-docs 13.0.0-alpha.942-next.0 → 13.0.0-alpha.948-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.
@@ -8,10 +8,14 @@ const items = ['Cheese', 'Olives', 'Onions', 'Pepperoni', 'Peppers'];
8
8
  export default () => {
9
9
  return (
10
10
  <>
11
- <MultiSelect items={items}>
11
+ <MultiSelect items={items} initialSelectedIds={['Olives', 'Onions', 'Pepperoni']}>
12
12
  <FormField orientation="horizontal">
13
13
  <FormField.Label>Toppings</FormField.Label>
14
- <FormField.Input as={MultiSelect.Input} placeholder="Select Multiple" />
14
+ <FormField.Input
15
+ as={MultiSelect.Input}
16
+ placeholder="Select Multiple"
17
+ removeLabel="Remove"
18
+ />
15
19
  <MultiSelect.Popper>
16
20
  <MultiSelect.Card>
17
21
  <MultiSelect.List>
@@ -39,6 +39,7 @@ export default () => {
39
39
  <FormField.Input
40
40
  as={MultiSelect.Input}
41
41
  placeholder="Select Multiple"
42
+ removeLabel="Remove"
42
43
  name="toppings"
43
44
  onChange={e => {
44
45
  const value = e.currentTarget.value;
@@ -46,6 +46,7 @@ export default () => {
46
46
  <FormField.Input
47
47
  as={MultiSelect.Input}
48
48
  placeholder="Select Multiple"
49
+ removeLabel="Remove"
49
50
  name="toppings"
50
51
  onChange={handleOnChange}
51
52
  value={value}
@@ -23,7 +23,11 @@ export default () => {
23
23
  <MultiSelect items={items}>
24
24
  <FormField orientation="horizontal">
25
25
  <FormField.Label>Controls</FormField.Label>
26
- <FormField.Input as={MultiSelect.Input} placeholder="Select Multiple" />
26
+ <FormField.Input
27
+ as={MultiSelect.Input}
28
+ placeholder="Select Multiple"
29
+ removeLabel="Remove"
30
+ />
27
31
  <MultiSelect.Popper>
28
32
  <MultiSelect.Card>
29
33
  <MultiSelect.List>
@@ -88,6 +88,7 @@ export default () => {
88
88
  <FormField.Input
89
89
  as={MultiSelect.SearchInput}
90
90
  placeholder="Search"
91
+ removeLabel="Remove"
91
92
  name="toppings"
92
93
  onChange={e => {
93
94
  setValue(e.currentTarget.value);
@@ -13,6 +13,7 @@ import Selection from './examples/Selection';
13
13
  import MultiSelection from './examples/MultiSelection';
14
14
  import BasicGrid from './examples/BasicGrid';
15
15
  import WrappingGrid from './examples/WrappingGrid';
16
+ import OverflowVerticalList from './examples/OverflowVerticalList';
16
17
 
17
18
 
18
19
  # Canvas Kit Collection API
@@ -167,6 +168,16 @@ cursor wraps around columns and rows when an edge of a column or row is encounte
167
168
 
168
169
  <ExampleCodeBlock code={WrappingGrid} />
169
170
 
171
+ ### Overflow Vertical List
172
+
173
+ A List can overflow vertically or horizontally to account for responsive resizing or an overflow of
174
+ items. Using multiple hooks from the Collection system like `useOverflowListModel` and ensuring that
175
+ `orientation`is set to`vertical`, you can achieve vertical overflow lists. In the example below,
176
+ when the window is resized vertically, items in the Sidebar will overflow into the "More Actions"
177
+ button.
178
+
179
+ <ExampleCodeBlock code={OverflowVerticalList} />
180
+
170
181
  ## Component API
171
182
 
172
183
  ### ListBox
@@ -0,0 +1,73 @@
1
+ import React from 'react';
2
+ import {ActionBar, useActionBarModel} from '@workday/canvas-kit-react/action-bar';
3
+ import {PrimaryButton} from '@workday/canvas-kit-react/button';
4
+ import {Box} from '@workday/canvas-kit-react/layout';
5
+ import styled from '@emotion/styled';
6
+ import {StyledType} from '@workday/canvas-kit-react/common';
7
+
8
+ type MyActionItem = {
9
+ id: string;
10
+ text: React.ReactNode;
11
+ };
12
+
13
+ const StyledActionbarList = styled(ActionBar.List)<StyledType>({
14
+ '> *': {
15
+ flex: '0 0 auto',
16
+ },
17
+ });
18
+
19
+ export default () => {
20
+ const [items] = React.useState<MyActionItem[]>([
21
+ {id: 'first', text: 'First Action'},
22
+ {id: 'second', text: 'Second Action'},
23
+ {id: 'third', text: 'Third Action'},
24
+ {id: 'fourth', text: 'Fourth Action'},
25
+ {id: 'fifth', text: 'Fifth Action'},
26
+ {id: 'sixth', text: 'Sixth Action'},
27
+ {id: 'seventh', text: 'Seventh Action'},
28
+ ]);
29
+
30
+ const model = useActionBarModel({items, orientation: 'vertical', maximumVisible: 4});
31
+
32
+ return (
33
+ <>
34
+ <Box marginBottom="xl" height="50vh">
35
+ <ActionBar model={model}>
36
+ <StyledActionbarList
37
+ position="relative"
38
+ as="section"
39
+ aria-label="Overflow example actions"
40
+ flexDirection="column"
41
+ height="100%"
42
+ overflowButton={
43
+ <ActionBar.OverflowButton
44
+ cs={{overflow: 'visible', flex: 0}}
45
+ aria-label="More actions"
46
+ />
47
+ }
48
+ >
49
+ {(item: MyActionItem, index) => (
50
+ <ActionBar.Item
51
+ as={index === 0 ? PrimaryButton : undefined}
52
+ onClick={() => console.log(item.id)}
53
+ >
54
+ {item.text}
55
+ </ActionBar.Item>
56
+ )}
57
+ </StyledActionbarList>
58
+ <ActionBar.Menu.Popper>
59
+ <ActionBar.Menu.Card maxWidth={300} maxHeight={200}>
60
+ <ActionBar.Menu.List>
61
+ {(item: MyActionItem) => (
62
+ <ActionBar.Menu.Item onClick={() => console.log(item.id)}>
63
+ {item.text}
64
+ </ActionBar.Menu.Item>
65
+ )}
66
+ </ActionBar.Menu.List>
67
+ </ActionBar.Menu.Card>
68
+ </ActionBar.Menu.Popper>
69
+ </ActionBar>
70
+ </Box>
71
+ </>
72
+ );
73
+ };
@@ -36,7 +36,12 @@ export default () => {
36
36
  <FormField.Label>Contact</FormField.Label>
37
37
  <FormField.Field>
38
38
  <Select items={options} getId={item => item.serverId} getTextValue={item => item.label}>
39
- <FormField.Input as={Select.Input} onChange={handleChange} value={value} />
39
+ <FormField.Input
40
+ as={Select.Input}
41
+ onChange={handleChange}
42
+ value={value}
43
+ name="contact"
44
+ />
40
45
  <Select.Popper>
41
46
  <Select.Card>
42
47
  <Select.List>{item => <Select.Item>{item.label}</Select.Item>}</Select.List>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-docs",
3
- "version": "13.0.0-alpha.942-next.0",
3
+ "version": "13.0.0-alpha.948-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": "^13.0.0-alpha.942-next.0",
48
- "@workday/canvas-kit-preview-react": "^13.0.0-alpha.942-next.0",
49
- "@workday/canvas-kit-react": "^13.0.0-alpha.942-next.0",
50
- "@workday/canvas-kit-styling": "^13.0.0-alpha.942-next.0",
47
+ "@workday/canvas-kit-labs-react": "^13.0.0-alpha.948-next.0",
48
+ "@workday/canvas-kit-preview-react": "^13.0.0-alpha.948-next.0",
49
+ "@workday/canvas-kit-react": "^13.0.0-alpha.948-next.0",
50
+ "@workday/canvas-kit-styling": "^13.0.0-alpha.948-next.0",
51
51
  "@workday/canvas-system-icons-web": "^3.0.0",
52
52
  "@workday/canvas-tokens-web": "^2.0.1",
53
53
  "markdown-to-jsx": "^7.2.0",
@@ -60,5 +60,5 @@
60
60
  "mkdirp": "^1.0.3",
61
61
  "typescript": "5.0"
62
62
  },
63
- "gitHead": "7b32735713e6952e8c630e80f906ecfac21009eb"
63
+ "gitHead": "cbfbb06dd0be8cd5feca6ee2114cd2b039da66db"
64
64
  }