@workday/canvas-kit-docs 9.0.0-alpha.411-next.13 → 9.0.0-alpha.413-next.15

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,7 +8,7 @@ any questions.
8
8
  - [New Components](#new-components)
9
9
  - [Table](#table)
10
10
  - [Updated Terms](#updated-terms)
11
- - [Removals](#Removals)
11
+ - [Removals](#removals)
12
12
  - [Drawer](#drawer)
13
13
  - [Layout and Column](#layout-and-column)
14
14
  - [composeModelHooks](#composemodelhook)
@@ -22,6 +22,7 @@ any questions.
22
22
  - [Component Updates](#component-updates)
23
23
  - [Button](#button)
24
24
  - [Toast](#toast)
25
+ - [Collection](#collection)
25
26
  - [Utility Updates](#utility-updates)
26
27
  - [useTheme and getTheme](#usetheme-and-gettheme)
27
28
  - [useThemedRing](#usethemedring)
@@ -90,18 +91,15 @@ export default function App() {
90
91
  <Table.Header>Table Header</Table.Header>
91
92
  <Table.Header>Table Header</Table.Header>
92
93
  </Table.Row>
93
- <Table.Divider />
94
94
  <Table.Row>
95
95
  <Table.Header>Table Header</Table.Header>
96
96
  <Table.Cell>Table Data Cell</Table.Cell>
97
97
  </Table.Row>
98
- <Table.Divider />
99
98
  <Table.Row>
100
99
  <Table.Header>Table Header</Table.Header>
101
100
  <Table.Cell>Table Data Cell</Table.Cell>
102
101
  </Table.Row>
103
102
  </Table.Body>
104
- <Table.Divider />
105
103
  <Table.Footer>
106
104
  <Table.Row>
107
105
  <Table.Header>Table Header</Table.Header>
@@ -287,6 +285,8 @@ return {
287
285
  `as const` instructs Typescript the type is `readonly`. Typescript knows readonly values or objects
288
286
  cannot be changed and will therefore narrow the type for you.
289
287
 
288
+ ---
289
+
290
290
  ## Token Updates
291
291
 
292
292
  ### Depth
@@ -374,6 +374,16 @@ previously used `actionText` or `onActionClick`. The codemod will also update im
374
374
  > **Note:** You will manually need to set `mode` to `alert` if your `Toast` conveys urgent and
375
375
  > important information such as an error.
376
376
 
377
+ ---
378
+
379
+ ### Collection
380
+
381
+ Navigation was updated to use numerical indexes instead of string identifiers. The
382
+ `model.state.cursorId` is left unchanged. The change is to support virtual lists where navigation
383
+ knows where it needs to go, but the identifier may not be loaded yet. The mechanism for navigating
384
+ is private and should not breaking anything. If you created a custom navigation manager, the
385
+ signature has been changed.
386
+
377
387
  ## Utility Updates
378
388
 
379
389
  ### useTheme and getTheme
@@ -0,0 +1,54 @@
1
+ import {SymbolDoc, Specifications} from '@workday/canvas-kit-docs';
2
+
3
+ import {Dialog} from '@workday/canvas-kit-react/dialog';
4
+ import Basic from './examples/Basic';
5
+ import Focus from './examples/Focus';
6
+
7
+
8
+ # Canvas Kit Dialog
9
+
10
+ A Dialog component is a non-modal type of dialog that will not render the rest of the page inert
11
+ while it is active. A Dialog should be used in situations where the task is not critical.
12
+
13
+ ## Installation
14
+
15
+ ```sh
16
+ yarn add @workday/canvas-kit-react
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ### Basic Example
22
+
23
+ [Modal](/components/popups/modal/) and Dialog are very similar: most of the examples from Modal can
24
+ be adapted to Dialog by changing `Modal` to `Dialog` and replacing `Modal.Overlay` with
25
+ `Dialog.Popper`.
26
+
27
+ Unlike Modal, Dialog does _not_ render the rest of the page inert while it is active. Dialog should
28
+ be used in situations where the task does not require immediate attention such as in the example
29
+ below.
30
+
31
+ <ExampleCodeBlock code={Basic} />
32
+
33
+ ### Focus Redirect
34
+
35
+ Since Modal requires immediate attention, it will trap the keyboard focus inside the Modal until an
36
+ action is taken. Dialog manages focus differently, however, since it does not require immediate
37
+ attention.
38
+
39
+ The following example shows how Dialog manages focus in and out of the component.
40
+
41
+ <ExampleCodeBlock code={Focus} />
42
+
43
+ Instead of trapping focus within the Dialog, it is effectively treated as an inline element next to
44
+ its triggering `Dialog.Target` button. Tabbing out of the Dialog will close the popup and move focus
45
+ to the next button.
46
+
47
+ Dialog also adds an `aria-owns` to a `<div>` element which is rendered as a sibling of the
48
+ `Dialog.Target` button. The `aria-owns` references the `Dialog.Card` and allows screen readers which
49
+ [support aria-owns](/components/popups/popup/#focus-redirect) to navigate the Dialog as if it
50
+ weren't portalled to the bottom of the document body.
51
+
52
+ ## Component API
53
+
54
+ <SymbolDoc name="Dialog" fileName="/react/" />
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import {FormField} from '@workday/canvas-kit-react/form-field';
3
+ import {TextInput} from '@workday/canvas-kit-react/text-input';
4
+ import {Flex} from '@workday/canvas-kit-react/layout';
5
+ import {Dialog} from '@workday/canvas-kit-react/dialog';
6
+ import {PrimaryButton} from '@workday/canvas-kit-react/button';
7
+
8
+ export default () => {
9
+ const [value, setValue] = React.useState('');
10
+
11
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
12
+ setValue(event.target.value);
13
+ };
14
+
15
+ const handleEmail = () => {
16
+ console.log('Email Submitted');
17
+ };
18
+ return (
19
+ <Dialog>
20
+ <Dialog.Target as={PrimaryButton}>Open for Offer</Dialog.Target>
21
+ <Dialog.Popper>
22
+ <Dialog.Card>
23
+ <Dialog.CloseIcon aria-label="Close" />
24
+ <Dialog.Heading paddingTop="m">Sign Up for 15% Off Your Next Order</Dialog.Heading>
25
+ <Dialog.Body>
26
+ <FormField label="Email">
27
+ <TextInput onChange={handleChange} value={value} />
28
+ </FormField>
29
+ </Dialog.Body>
30
+ <Flex gap="s" padding="xxs" marginTop="xxs">
31
+ <Dialog.CloseButton as={PrimaryButton} onClick={handleEmail}>
32
+ Submit
33
+ </Dialog.CloseButton>
34
+ <Dialog.CloseButton>Cancel</Dialog.CloseButton>
35
+ </Flex>
36
+ </Dialog.Card>
37
+ </Dialog.Popper>
38
+ </Dialog>
39
+ );
40
+ };
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+
3
+ import {FormField} from '@workday/canvas-kit-react/form-field';
4
+ import {TextInput} from '@workday/canvas-kit-react/text-input';
5
+ import {Flex} from '@workday/canvas-kit-react/layout';
6
+ import {Dialog} from '@workday/canvas-kit-react/dialog';
7
+ import {PrimaryButton} from '@workday/canvas-kit-react/button';
8
+
9
+ export default () => {
10
+ const [value, setValue] = React.useState('');
11
+
12
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
13
+ setValue(event.target.value);
14
+ };
15
+
16
+ const handleEmail = () => {
17
+ console.log('Email Submitted');
18
+ };
19
+ return (
20
+ <Flex gap="m">
21
+ <Dialog>
22
+ <Dialog.Target as={PrimaryButton}>Open for Offer</Dialog.Target>
23
+ <Dialog.Popper>
24
+ <Dialog.Card>
25
+ <Dialog.CloseIcon aria-label="Close" />
26
+ <Dialog.Heading paddingTop="m">Sign Up for 15% Off Your Next Order</Dialog.Heading>
27
+ <Dialog.Body>
28
+ <FormField label="Email">
29
+ <TextInput onChange={handleChange} value={value} />
30
+ </FormField>
31
+ </Dialog.Body>
32
+ <Flex gap="s" padding="xxs" marginTop="xxs">
33
+ <Dialog.CloseButton as={PrimaryButton} onClick={handleEmail}>
34
+ Submit
35
+ </Dialog.CloseButton>
36
+ <Dialog.CloseButton>Cancel</Dialog.CloseButton>
37
+ </Flex>
38
+ </Dialog.Card>
39
+ </Dialog.Popper>
40
+ </Dialog>
41
+ <PrimaryButton>Focus #1</PrimaryButton>
42
+ <PrimaryButton>Focus #2</PrimaryButton>
43
+ </Flex>
44
+ );
45
+ };
@@ -69,7 +69,6 @@ export default () => {
69
69
  addTab
70
70
  );
71
71
  });
72
- model.events.goTo({id: 'add'});
73
72
  }
74
73
  };
75
74
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-docs",
3
- "version": "9.0.0-alpha.411-next.13+45ee94ee",
3
+ "version": "9.0.0-alpha.413-next.15+76b571ed",
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.0-alpha.411-next.13+45ee94ee",
48
- "@workday/canvas-kit-preview-react": "^9.0.0-alpha.411-next.13+45ee94ee",
49
- "@workday/canvas-kit-react": "^9.0.0-alpha.411-next.13+45ee94ee",
47
+ "@workday/canvas-kit-labs-react": "^9.0.0-alpha.413-next.15+76b571ed",
48
+ "@workday/canvas-kit-preview-react": "^9.0.0-alpha.413-next.15+76b571ed",
49
+ "@workday/canvas-kit-react": "^9.0.0-alpha.413-next.15+76b571ed",
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": "45ee94ee899decb70dbf73bc22defa276f05899a"
60
+ "gitHead": "76b571ed215127f6badf7a3834a761709aac303d"
61
61
  }