@workday/canvas-kit-docs 7.3.0-next.0 → 7.3.1
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/commonjs/lib/specs.js +96 -0
- package/dist/es6/lib/specs.js +96 -0
- package/dist/mdx/labs-react/toast/examples/Basic.tsx +16 -0
- package/dist/mdx/labs-react/toast/examples/RTL.tsx +22 -0
- package/dist/mdx/labs-react/toast/examples/ToastAlert.tsx +14 -0
- package/dist/mdx/labs-react/toast/examples/ToastDialog.tsx +15 -0
- package/dist/mdx/labs-react/toast/examples/WithActionLinkAndCloseIcon.tsx +20 -0
- package/dist/mdx/labs-react/toast/examples/WithCloseButton.tsx +19 -0
- package/dist/mdx/labs-react/toast/examples/WithPopper.tsx +35 -0
- package/dist/mdx/labs-react/toast/toast.mdx +185 -0
- package/dist/mdx/react/modal/examples/Basic.tsx +7 -7
- package/dist/mdx/react/modal/examples/BodyOverflow.tsx +2 -3
- package/dist/mdx/react/modal/examples/CustomFocus.tsx +7 -7
- package/dist/mdx/react/modal/examples/FullOverflow.tsx +1 -1
- package/dist/mdx/react/modal/examples/ReturnFocus.tsx +7 -7
- package/dist/mdx/react/modal/examples/WithoutCloseIcon.tsx +7 -7
- package/dist/mdx/react/popup/examples/Basic.tsx +11 -9
- package/dist/mdx/react/popup/examples/FocusRedirect.tsx +6 -4
- package/dist/mdx/react/popup/examples/FocusTrap.tsx +6 -4
- package/dist/mdx/react/popup/examples/InitialFocus.tsx +6 -4
- package/dist/mdx/react/popup/examples/NestedPopups.tsx +20 -18
- package/dist/mdx/react/popup/examples/RTL.tsx +6 -4
- package/package.json +3 -3
|
@@ -6172,6 +6172,102 @@ module.exports = {specifications: [
|
|
|
6172
6172
|
}
|
|
6173
6173
|
]
|
|
6174
6174
|
},
|
|
6175
|
+
{
|
|
6176
|
+
"type": "file",
|
|
6177
|
+
"name": "ToastLabs.spec.ts",
|
|
6178
|
+
"children": [
|
|
6179
|
+
{
|
|
6180
|
+
"type": "describe",
|
|
6181
|
+
"name": "Toast",
|
|
6182
|
+
"children": [
|
|
6183
|
+
{
|
|
6184
|
+
"type": "describe",
|
|
6185
|
+
"name": "given the 'Basic' story is rendered",
|
|
6186
|
+
"children": [
|
|
6187
|
+
{
|
|
6188
|
+
"type": "it",
|
|
6189
|
+
"name": "should not have any axe errors"
|
|
6190
|
+
}
|
|
6191
|
+
]
|
|
6192
|
+
},
|
|
6193
|
+
{
|
|
6194
|
+
"type": "describe",
|
|
6195
|
+
"name": "given the 'Toast Alert' story is rendered",
|
|
6196
|
+
"children": [
|
|
6197
|
+
{
|
|
6198
|
+
"type": "it",
|
|
6199
|
+
"name": "should not have any axe errors"
|
|
6200
|
+
}
|
|
6201
|
+
]
|
|
6202
|
+
},
|
|
6203
|
+
{
|
|
6204
|
+
"type": "describe",
|
|
6205
|
+
"name": "given the 'Toast Dialog' story is rendered",
|
|
6206
|
+
"children": [
|
|
6207
|
+
{
|
|
6208
|
+
"type": "it",
|
|
6209
|
+
"name": "should not have any axe errors"
|
|
6210
|
+
}
|
|
6211
|
+
]
|
|
6212
|
+
},
|
|
6213
|
+
{
|
|
6214
|
+
"type": "describe",
|
|
6215
|
+
"name": "given the toast with no close icon or action button",
|
|
6216
|
+
"children": [
|
|
6217
|
+
{
|
|
6218
|
+
"type": "it",
|
|
6219
|
+
"name": "should have a role of status"
|
|
6220
|
+
},
|
|
6221
|
+
{
|
|
6222
|
+
"type": "it",
|
|
6223
|
+
"name": "should have aria-live set to polite"
|
|
6224
|
+
},
|
|
6225
|
+
{
|
|
6226
|
+
"type": "it",
|
|
6227
|
+
"name": "should have aria-atomic set to true"
|
|
6228
|
+
}
|
|
6229
|
+
]
|
|
6230
|
+
},
|
|
6231
|
+
{
|
|
6232
|
+
"type": "describe",
|
|
6233
|
+
"name": "given the toast with an alert",
|
|
6234
|
+
"children": [
|
|
6235
|
+
{
|
|
6236
|
+
"type": "it",
|
|
6237
|
+
"name": "should have a role of alert"
|
|
6238
|
+
},
|
|
6239
|
+
{
|
|
6240
|
+
"type": "it",
|
|
6241
|
+
"name": "should have aria-live set to assertive"
|
|
6242
|
+
},
|
|
6243
|
+
{
|
|
6244
|
+
"type": "it",
|
|
6245
|
+
"name": "should have aria-atomic set to true"
|
|
6246
|
+
}
|
|
6247
|
+
]
|
|
6248
|
+
},
|
|
6249
|
+
{
|
|
6250
|
+
"type": "describe",
|
|
6251
|
+
"name": "given the toast with a close button and action button",
|
|
6252
|
+
"children": [
|
|
6253
|
+
{
|
|
6254
|
+
"type": "it",
|
|
6255
|
+
"name": "should have a role of dialog"
|
|
6256
|
+
},
|
|
6257
|
+
{
|
|
6258
|
+
"type": "it",
|
|
6259
|
+
"name": "should have aria-label set to notification"
|
|
6260
|
+
},
|
|
6261
|
+
{
|
|
6262
|
+
"type": "it",
|
|
6263
|
+
"name": "should have aria-describedby"
|
|
6264
|
+
}
|
|
6265
|
+
]
|
|
6266
|
+
}
|
|
6267
|
+
]
|
|
6268
|
+
}
|
|
6269
|
+
]
|
|
6270
|
+
},
|
|
6175
6271
|
{
|
|
6176
6272
|
"type": "file",
|
|
6177
6273
|
"name": "Tooltip.spec.ts",
|
package/dist/es6/lib/specs.js
CHANGED
|
@@ -6172,6 +6172,102 @@ module.exports = {specifications: [
|
|
|
6172
6172
|
}
|
|
6173
6173
|
]
|
|
6174
6174
|
},
|
|
6175
|
+
{
|
|
6176
|
+
"type": "file",
|
|
6177
|
+
"name": "ToastLabs.spec.ts",
|
|
6178
|
+
"children": [
|
|
6179
|
+
{
|
|
6180
|
+
"type": "describe",
|
|
6181
|
+
"name": "Toast",
|
|
6182
|
+
"children": [
|
|
6183
|
+
{
|
|
6184
|
+
"type": "describe",
|
|
6185
|
+
"name": "given the 'Basic' story is rendered",
|
|
6186
|
+
"children": [
|
|
6187
|
+
{
|
|
6188
|
+
"type": "it",
|
|
6189
|
+
"name": "should not have any axe errors"
|
|
6190
|
+
}
|
|
6191
|
+
]
|
|
6192
|
+
},
|
|
6193
|
+
{
|
|
6194
|
+
"type": "describe",
|
|
6195
|
+
"name": "given the 'Toast Alert' story is rendered",
|
|
6196
|
+
"children": [
|
|
6197
|
+
{
|
|
6198
|
+
"type": "it",
|
|
6199
|
+
"name": "should not have any axe errors"
|
|
6200
|
+
}
|
|
6201
|
+
]
|
|
6202
|
+
},
|
|
6203
|
+
{
|
|
6204
|
+
"type": "describe",
|
|
6205
|
+
"name": "given the 'Toast Dialog' story is rendered",
|
|
6206
|
+
"children": [
|
|
6207
|
+
{
|
|
6208
|
+
"type": "it",
|
|
6209
|
+
"name": "should not have any axe errors"
|
|
6210
|
+
}
|
|
6211
|
+
]
|
|
6212
|
+
},
|
|
6213
|
+
{
|
|
6214
|
+
"type": "describe",
|
|
6215
|
+
"name": "given the toast with no close icon or action button",
|
|
6216
|
+
"children": [
|
|
6217
|
+
{
|
|
6218
|
+
"type": "it",
|
|
6219
|
+
"name": "should have a role of status"
|
|
6220
|
+
},
|
|
6221
|
+
{
|
|
6222
|
+
"type": "it",
|
|
6223
|
+
"name": "should have aria-live set to polite"
|
|
6224
|
+
},
|
|
6225
|
+
{
|
|
6226
|
+
"type": "it",
|
|
6227
|
+
"name": "should have aria-atomic set to true"
|
|
6228
|
+
}
|
|
6229
|
+
]
|
|
6230
|
+
},
|
|
6231
|
+
{
|
|
6232
|
+
"type": "describe",
|
|
6233
|
+
"name": "given the toast with an alert",
|
|
6234
|
+
"children": [
|
|
6235
|
+
{
|
|
6236
|
+
"type": "it",
|
|
6237
|
+
"name": "should have a role of alert"
|
|
6238
|
+
},
|
|
6239
|
+
{
|
|
6240
|
+
"type": "it",
|
|
6241
|
+
"name": "should have aria-live set to assertive"
|
|
6242
|
+
},
|
|
6243
|
+
{
|
|
6244
|
+
"type": "it",
|
|
6245
|
+
"name": "should have aria-atomic set to true"
|
|
6246
|
+
}
|
|
6247
|
+
]
|
|
6248
|
+
},
|
|
6249
|
+
{
|
|
6250
|
+
"type": "describe",
|
|
6251
|
+
"name": "given the toast with a close button and action button",
|
|
6252
|
+
"children": [
|
|
6253
|
+
{
|
|
6254
|
+
"type": "it",
|
|
6255
|
+
"name": "should have a role of dialog"
|
|
6256
|
+
},
|
|
6257
|
+
{
|
|
6258
|
+
"type": "it",
|
|
6259
|
+
"name": "should have aria-label set to notification"
|
|
6260
|
+
},
|
|
6261
|
+
{
|
|
6262
|
+
"type": "it",
|
|
6263
|
+
"name": "should have aria-describedby"
|
|
6264
|
+
}
|
|
6265
|
+
]
|
|
6266
|
+
}
|
|
6267
|
+
]
|
|
6268
|
+
}
|
|
6269
|
+
]
|
|
6270
|
+
},
|
|
6175
6271
|
{
|
|
6176
6272
|
"type": "file",
|
|
6177
6273
|
"name": "Tooltip.spec.ts",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {Toast} from '@workday/canvas-kit-labs-react/toast';
|
|
4
|
+
import {checkIcon} from '@workday/canvas-system-icons-web';
|
|
5
|
+
import {colors} from '@workday/canvas-kit-react/tokens';
|
|
6
|
+
|
|
7
|
+
export default () => {
|
|
8
|
+
return (
|
|
9
|
+
<Toast>
|
|
10
|
+
<Toast.Icon icon={checkIcon} color={colors.greenApple400} />
|
|
11
|
+
<Toast.Body>
|
|
12
|
+
<Toast.Message>Your workbook was successfully processed.</Toast.Message>
|
|
13
|
+
</Toast.Body>
|
|
14
|
+
</Toast>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {Toast} from '@workday/canvas-kit-labs-react/toast';
|
|
4
|
+
import {checkIcon} from '@workday/canvas-system-icons-web';
|
|
5
|
+
import {colors} from '@workday/canvas-kit-react/tokens';
|
|
6
|
+
import {CanvasProvider, ContentDirection} from '@workday/canvas-kit-react/common';
|
|
7
|
+
|
|
8
|
+
export default () => {
|
|
9
|
+
const handleClose = () => console.log('close button clicked');
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<CanvasProvider theme={{canvas: {direction: ContentDirection.RTL}}}>
|
|
13
|
+
<Toast mode="dialog">
|
|
14
|
+
<Toast.Icon icon={checkIcon} color={colors.greenApple400} />
|
|
15
|
+
<Toast.Body>
|
|
16
|
+
<Toast.Message>Your workbook was successfully processed.</Toast.Message>
|
|
17
|
+
</Toast.Body>
|
|
18
|
+
<Toast.CloseIcon aria-label="Close" onClick={handleClose} />
|
|
19
|
+
</Toast>
|
|
20
|
+
</CanvasProvider>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {Toast} from '@workday/canvas-kit-labs-react/toast';
|
|
4
|
+
import {exclamationCircleIcon} from '@workday/canvas-system-icons-web';
|
|
5
|
+
import {colors} from '@workday/canvas-kit-react/tokens';
|
|
6
|
+
|
|
7
|
+
export default () => (
|
|
8
|
+
<Toast mode="alert">
|
|
9
|
+
<Toast.Icon icon={exclamationCircleIcon} color={colors.cinnamon500} />
|
|
10
|
+
<Toast.Body>
|
|
11
|
+
<Toast.Message>There was an error with your workbook.</Toast.Message>
|
|
12
|
+
</Toast.Body>
|
|
13
|
+
</Toast>
|
|
14
|
+
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {Toast} from '@workday/canvas-kit-labs-react/toast';
|
|
4
|
+
import {checkIcon} from '@workday/canvas-system-icons-web';
|
|
5
|
+
import {colors} from '@workday/canvas-kit-react/tokens';
|
|
6
|
+
|
|
7
|
+
export default () => (
|
|
8
|
+
<Toast mode="dialog">
|
|
9
|
+
<Toast.Icon icon={checkIcon} color={colors.greenApple400} />
|
|
10
|
+
<Toast.Body>
|
|
11
|
+
<Toast.Message>Your workbook was successfully processed.</Toast.Message>
|
|
12
|
+
<Toast.Link href="#hreflink">Custom Link</Toast.Link>
|
|
13
|
+
</Toast.Body>
|
|
14
|
+
</Toast>
|
|
15
|
+
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {Toast} from '@workday/canvas-kit-labs-react/toast';
|
|
4
|
+
import {checkIcon} from '@workday/canvas-system-icons-web';
|
|
5
|
+
import {colors} from '@workday/canvas-kit-react/tokens';
|
|
6
|
+
|
|
7
|
+
export default () => {
|
|
8
|
+
const handleClose = () => console.log('close button clicked');
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<Toast mode="dialog">
|
|
12
|
+
<Toast.Icon icon={checkIcon} color={colors.greenApple400} />
|
|
13
|
+
<Toast.Body>
|
|
14
|
+
<Toast.Message>Your workbook was successfully processed.</Toast.Message>
|
|
15
|
+
<Toast.Link href="#hyperlink">Custom Link</Toast.Link>
|
|
16
|
+
</Toast.Body>
|
|
17
|
+
<Toast.CloseIcon aria-label="Close" onClick={handleClose} />
|
|
18
|
+
</Toast>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {Toast} from '@workday/canvas-kit-labs-react/toast';
|
|
4
|
+
import {checkIcon} from '@workday/canvas-system-icons-web';
|
|
5
|
+
import {colors} from '@workday/canvas-kit-react/tokens';
|
|
6
|
+
|
|
7
|
+
export default () => {
|
|
8
|
+
const handleClose = () => console.log('close button clicked');
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<Toast>
|
|
12
|
+
<Toast.Icon icon={checkIcon} color={colors.greenApple400} />
|
|
13
|
+
<Toast.Body>
|
|
14
|
+
<Toast.Message>Your workbook was successfully processed.</Toast.Message>
|
|
15
|
+
</Toast.Body>
|
|
16
|
+
<Toast.CloseIcon aria-label="Close" onClick={handleClose} />
|
|
17
|
+
</Toast>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {Toast} from '@workday/canvas-kit-labs-react/toast';
|
|
4
|
+
import {checkIcon} from '@workday/canvas-system-icons-web';
|
|
5
|
+
import {colors} from '@workday/canvas-kit-react/tokens';
|
|
6
|
+
|
|
7
|
+
import {Popper, SecondaryButton} from '@workday/canvas-kit-react';
|
|
8
|
+
|
|
9
|
+
export default () => {
|
|
10
|
+
const [open, setOpen] = React.useState(false);
|
|
11
|
+
const containerRef = React.useRef(null);
|
|
12
|
+
|
|
13
|
+
const handleClose = () => {
|
|
14
|
+
setOpen(false);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const handleOpen = () => {
|
|
18
|
+
setOpen(true);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div ref={containerRef}>
|
|
23
|
+
<SecondaryButton onClick={handleOpen}>Show Toast</SecondaryButton>
|
|
24
|
+
<Popper placement="bottom-end" open={open} anchorElement={containerRef}>
|
|
25
|
+
<Toast mode="dialog">
|
|
26
|
+
<Toast.Icon icon={checkIcon} color={colors.greenApple400} />
|
|
27
|
+
<Toast.Body>
|
|
28
|
+
<Toast.Message>Your workbook was successfully processed.</Toast.Message>
|
|
29
|
+
</Toast.Body>
|
|
30
|
+
<Toast.CloseIcon aria-label="Close" onClick={handleClose} />
|
|
31
|
+
</Toast>
|
|
32
|
+
</Popper>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import {Meta} from '@storybook/addon-docs/blocks';
|
|
2
|
+
|
|
3
|
+
import {Toast} from '@workday/canvas-kit-labs-react/toast';
|
|
4
|
+
import Basic from './examples/Basic';
|
|
5
|
+
import ToastAlert from './examples/ToastAlert';
|
|
6
|
+
import WithCloseButton from './examples/WithCloseButton';
|
|
7
|
+
import ToastDialog from './examples/ToastDialog';
|
|
8
|
+
import WithActionLinkAndCloseIcon from './examples/WithActionLinkAndCloseIcon';
|
|
9
|
+
import WithPopper from './examples/WithPopper';
|
|
10
|
+
import RTL from './examples/RTL';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# Canvas Kit Toast
|
|
14
|
+
|
|
15
|
+
`Toast` is a [compound component](/getting-started/for-developers/resources/compound-components/)
|
|
16
|
+
that contains updates or messages about the status of an application's process.
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
yarn add @workday/canvas-kit-labs-react
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
### Basic Example
|
|
27
|
+
|
|
28
|
+
`Toast` includes a container `Toast` component and the following subcomponents: `Toast.Body`,
|
|
29
|
+
`Toast.CloseIcon`, `Toast.Icon`, `Toast.Message`, and `Toast.Link`.
|
|
30
|
+
|
|
31
|
+
`Toast` supports different modes through the `mode` prop: `status`, `alert`, and `dialog`. Each mode
|
|
32
|
+
conveys a different purpose of the message and assigns the necessary ARIA attributes to support that
|
|
33
|
+
purpose and provide an accessible experience.
|
|
34
|
+
|
|
35
|
+
By default, `mode` is set to `status`, which indicates the message contains advisory information
|
|
36
|
+
such as a successful action.
|
|
37
|
+
|
|
38
|
+
<ExampleCodeBlock code={Basic} />
|
|
39
|
+
|
|
40
|
+
A `status` `Toast` will wrap the message within a `polite` ARIA live region with a `role` of
|
|
41
|
+
`status`.
|
|
42
|
+
|
|
43
|
+
Here's a more complete example with a button which triggers a dismissable `Toast`. The `Toast` is
|
|
44
|
+
positioned using `Popper`.
|
|
45
|
+
|
|
46
|
+
<ExampleCodeBlock code={WithPopper} />
|
|
47
|
+
|
|
48
|
+
### Alert
|
|
49
|
+
|
|
50
|
+
Set the `mode` prop to `alert` to convey urgent and important information such as an error.
|
|
51
|
+
|
|
52
|
+
<ExampleCodeBlock code={ToastAlert} />
|
|
53
|
+
|
|
54
|
+
An `alert` `Toast` will wrap the message within an `assertive` ARIA live region with a `role` of
|
|
55
|
+
`alert`.
|
|
56
|
+
|
|
57
|
+
### Dialog
|
|
58
|
+
|
|
59
|
+
Set the `mode` prop to `dialog` to convey the presence of a follow-up action.
|
|
60
|
+
|
|
61
|
+
<ExampleCodeBlock code={ToastDialog} />
|
|
62
|
+
|
|
63
|
+
The `Toast` will be given a role of `dialog` along with an `aria-label` to indicate that it's a
|
|
64
|
+
notification.
|
|
65
|
+
|
|
66
|
+
> **Note**: You must use the `Toast.Message` subcomponent when the `mode` is `dialog` so that `id`
|
|
67
|
+
> is tied to the message for accessibility. You can also pass in a `model` with `useToastModel` to
|
|
68
|
+
> provide a specific `id` for the `Toast.Message`:
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
export const CustomIDToast = () => {
|
|
72
|
+
const model = useToastModel({
|
|
73
|
+
id: '12df5',
|
|
74
|
+
mode: 'dialog',
|
|
75
|
+
});
|
|
76
|
+
return (
|
|
77
|
+
<Toast model={model}>
|
|
78
|
+
<Toast.Icon icon={checkIcon} color={colors.greenApple400} />
|
|
79
|
+
<Toast.Body>
|
|
80
|
+
<Toast.Message>Your workbook was successfully processed.</Toast.Message>
|
|
81
|
+
<Toast.Link href="#href">View More Details</Toast.Link>
|
|
82
|
+
</Toast.Body>
|
|
83
|
+
</Toast>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Close Icon Button
|
|
89
|
+
|
|
90
|
+
Include the `Toast.CloseIcon` subcomponent to display a close button within the Toast.
|
|
91
|
+
|
|
92
|
+
<ExampleCodeBlock code={WithCloseButton} />
|
|
93
|
+
|
|
94
|
+
`Toast.CloseIcon` may be included within a `dialog` `Toast` to create a `Toast` with both an action
|
|
95
|
+
link and a close button.
|
|
96
|
+
|
|
97
|
+
<ExampleCodeBlock code={WithActionLinkAndCloseIcon} />
|
|
98
|
+
|
|
99
|
+
### Right-to-Left (RTL)
|
|
100
|
+
|
|
101
|
+
`Toast` supports right-to-left languages when specified in the `CanvasProvider` `theme`.
|
|
102
|
+
|
|
103
|
+
<ExampleCodeBlock code={RTL} />
|
|
104
|
+
|
|
105
|
+
## Components
|
|
106
|
+
|
|
107
|
+
### Toast
|
|
108
|
+
|
|
109
|
+
#### Usage
|
|
110
|
+
|
|
111
|
+
`Toast` defines a container for all `Toast` subcomponents. `Toast` will render with the appropriate
|
|
112
|
+
ARIA attributes based on which `mode` is selected. It also accepts a `model` if you wish to provide
|
|
113
|
+
a specific `id`.
|
|
114
|
+
|
|
115
|
+
`Toast` renders a `Popup.Card` under the hood.
|
|
116
|
+
|
|
117
|
+
#### Props
|
|
118
|
+
|
|
119
|
+
<ArgsTable of={Toast} />
|
|
120
|
+
|
|
121
|
+
### Toast.Body
|
|
122
|
+
|
|
123
|
+
#### Usage
|
|
124
|
+
|
|
125
|
+
`Toast.Body` defines a container for the contents of the `Toast`, including `Toast.Message` and
|
|
126
|
+
`Toast.Link`.
|
|
127
|
+
|
|
128
|
+
`Toast.Body` renders a `Popup.Body` under the hood.
|
|
129
|
+
|
|
130
|
+
#### Props
|
|
131
|
+
|
|
132
|
+
<ArgsTable of={Toast.Body} />
|
|
133
|
+
|
|
134
|
+
### Toast.Icon
|
|
135
|
+
|
|
136
|
+
#### Usage
|
|
137
|
+
|
|
138
|
+
`Toast.Icon` renders a decorative icon for the `Toast`. When using `Toast.Icon`, be sure to set a
|
|
139
|
+
complementary `mode` to the `Toast`. For example, if the icon conveys an error, set the `mode` to
|
|
140
|
+
`alert`.
|
|
141
|
+
|
|
142
|
+
`Toast.Icon` renders a `SystemIcon` under the hood.
|
|
143
|
+
|
|
144
|
+
#### Props
|
|
145
|
+
|
|
146
|
+
<ArgsTable of={Toast.Icon} />
|
|
147
|
+
|
|
148
|
+
### Toast.Message
|
|
149
|
+
|
|
150
|
+
#### Usage
|
|
151
|
+
|
|
152
|
+
`Toast.Message` defines a container for the message of the `Toast`. It accepts any `React.ReactNode`
|
|
153
|
+
as its children. `Toast.Message` is assigned a unique `id` so that it may be read aloud by screen
|
|
154
|
+
readers when the `Toast` `mode` is set to `dialog`.
|
|
155
|
+
|
|
156
|
+
`Toast.Message` renders a `Box` under the hood.
|
|
157
|
+
|
|
158
|
+
#### Props
|
|
159
|
+
|
|
160
|
+
<ArgsTable of={Toast.Message} />
|
|
161
|
+
|
|
162
|
+
### Toast.Link
|
|
163
|
+
|
|
164
|
+
#### Usage
|
|
165
|
+
|
|
166
|
+
Use `Toast.Link` to provide an action in the `Toast`. `Toast.Link` should always be used in
|
|
167
|
+
conjunction with `dialog` `mode` to provide an accessible experience.
|
|
168
|
+
|
|
169
|
+
`Toast.Link` renders a `Hyperlink` under the hood.
|
|
170
|
+
|
|
171
|
+
#### Props
|
|
172
|
+
|
|
173
|
+
<ArgsTable of={Toast.Link} />
|
|
174
|
+
|
|
175
|
+
### Toast.CloseIcon
|
|
176
|
+
|
|
177
|
+
#### Usage
|
|
178
|
+
|
|
179
|
+
Use `Toast.CloseIcon` to provide a close button to dismiss the `Toast`.
|
|
180
|
+
|
|
181
|
+
`Toast.Link` renders a `Popup.CloseIcon` under the hood.
|
|
182
|
+
|
|
183
|
+
#### Props
|
|
184
|
+
|
|
185
|
+
<ArgsTable of={Toast.CloseIcon} />
|
|
@@ -17,16 +17,16 @@ export default () => {
|
|
|
17
17
|
<Modal.CloseIcon aria-label="Close" />
|
|
18
18
|
<Modal.Heading>Delete Item</Modal.Heading>
|
|
19
19
|
<Modal.Body>
|
|
20
|
-
<Box as="p"
|
|
20
|
+
<Box as="p" marginY="zero">
|
|
21
21
|
Are you sure you want to delete the item?
|
|
22
22
|
</Box>
|
|
23
|
-
<HStack spacing="s">
|
|
24
|
-
<Modal.CloseButton as={DeleteButton} onClick={handleDelete}>
|
|
25
|
-
Delete
|
|
26
|
-
</Modal.CloseButton>
|
|
27
|
-
<Modal.CloseButton>Cancel</Modal.CloseButton>
|
|
28
|
-
</HStack>
|
|
29
23
|
</Modal.Body>
|
|
24
|
+
<HStack spacing="s" padding="xxs" marginTop="xxs">
|
|
25
|
+
<Modal.CloseButton as={DeleteButton} onClick={handleDelete}>
|
|
26
|
+
Delete
|
|
27
|
+
</Modal.CloseButton>
|
|
28
|
+
<Modal.CloseButton>Cancel</Modal.CloseButton>
|
|
29
|
+
</HStack>
|
|
30
30
|
</Modal.Card>
|
|
31
31
|
</Modal.Overlay>
|
|
32
32
|
</Modal>
|
|
@@ -2,8 +2,7 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import {Modal} from '@workday/canvas-kit-react/modal';
|
|
4
4
|
import {DeleteButton} from '@workday/canvas-kit-react/button';
|
|
5
|
-
import {HStack
|
|
6
|
-
import {space} from '@workday/canvas-kit-react/tokens';
|
|
5
|
+
import {HStack} from '@workday/canvas-kit-react/layout';
|
|
7
6
|
|
|
8
7
|
export default () => {
|
|
9
8
|
const handleDelete = () => {
|
|
@@ -43,7 +42,7 @@ export default () => {
|
|
|
43
42
|
<p>Are you sure you want to delete the item?</p>
|
|
44
43
|
<p>Are you sure you want to delete the item?</p>
|
|
45
44
|
</Modal.Body>
|
|
46
|
-
<HStack spacing="s"
|
|
45
|
+
<HStack spacing="s" padding="xxs" marginTop="xxs">
|
|
47
46
|
<Modal.CloseButton as={DeleteButton} onClick={handleDelete}>
|
|
48
47
|
Delete
|
|
49
48
|
</Modal.CloseButton>
|
|
@@ -27,16 +27,16 @@ export default () => {
|
|
|
27
27
|
<Box as="p" marginTop={0} marginBottom="m">
|
|
28
28
|
Enter name to confirm deletion
|
|
29
29
|
</Box>
|
|
30
|
-
<FormField label="Item name">
|
|
30
|
+
<FormField label="Item name" style={{marginBottom: 0}}>
|
|
31
31
|
<TextInput ref={ref} value={value} onChange={e => setValue(e.currentTarget.value)} />
|
|
32
32
|
</FormField>
|
|
33
|
-
<HStack spacing="s">
|
|
34
|
-
<Modal.CloseButton as={DeleteButton} onClick={handleDelete}>
|
|
35
|
-
Delete
|
|
36
|
-
</Modal.CloseButton>
|
|
37
|
-
<Modal.CloseButton>Cancel</Modal.CloseButton>
|
|
38
|
-
</HStack>
|
|
39
33
|
</Modal.Body>
|
|
34
|
+
<HStack spacing="s" padding="xxs" marginTop="xxs">
|
|
35
|
+
<Modal.CloseButton as={DeleteButton} onClick={handleDelete}>
|
|
36
|
+
Delete
|
|
37
|
+
</Modal.CloseButton>
|
|
38
|
+
<Modal.CloseButton>Cancel</Modal.CloseButton>
|
|
39
|
+
</HStack>
|
|
40
40
|
</Modal.Card>
|
|
41
41
|
</Modal.Overlay>
|
|
42
42
|
</Modal>
|
|
@@ -42,7 +42,7 @@ export default () => {
|
|
|
42
42
|
<p>Are you sure you want to delete the item?</p>
|
|
43
43
|
<p>Are you sure you want to delete the item?</p>
|
|
44
44
|
</Modal.Body>
|
|
45
|
-
<HStack spacing="s">
|
|
45
|
+
<HStack spacing="s" padding="xxs" marginTop="xxs">
|
|
46
46
|
<Modal.CloseButton as={DeleteButton} onClick={handleDelete}>
|
|
47
47
|
Delete
|
|
48
48
|
</Modal.CloseButton>
|
|
@@ -39,16 +39,16 @@ export default () => {
|
|
|
39
39
|
<Modal.CloseIcon aria-label="Close" />
|
|
40
40
|
<Modal.Heading>Delete Item</Modal.Heading>
|
|
41
41
|
<Modal.Body>
|
|
42
|
-
<Box as="p"
|
|
42
|
+
<Box as="p" marginY="zero">
|
|
43
43
|
Are you sure you want to delete the item?
|
|
44
44
|
</Box>
|
|
45
|
-
<HStack spacing="s">
|
|
46
|
-
<Modal.CloseButton as={DeleteButton} onClick={handleDelete}>
|
|
47
|
-
Delete
|
|
48
|
-
</Modal.CloseButton>
|
|
49
|
-
<Modal.CloseButton>Cancel</Modal.CloseButton>
|
|
50
|
-
</HStack>
|
|
51
45
|
</Modal.Body>
|
|
46
|
+
<HStack spacing="s" padding="xxs" marginTop="xxs">
|
|
47
|
+
<Modal.CloseButton as={DeleteButton} onClick={handleDelete}>
|
|
48
|
+
Delete
|
|
49
|
+
</Modal.CloseButton>
|
|
50
|
+
<Modal.CloseButton>Cancel</Modal.CloseButton>
|
|
51
|
+
</HStack>
|
|
52
52
|
</Modal.Card>
|
|
53
53
|
</Modal.Overlay>
|
|
54
54
|
</Modal>
|
|
@@ -32,16 +32,16 @@ export default () => {
|
|
|
32
32
|
<Modal.Card>
|
|
33
33
|
<Modal.Heading>Delete Item</Modal.Heading>
|
|
34
34
|
<Modal.Body>
|
|
35
|
-
<Box as="p"
|
|
35
|
+
<Box as="p" marginY="zero">
|
|
36
36
|
Are you sure you want to delete the item?
|
|
37
37
|
</Box>
|
|
38
|
-
<HStack spacing="s">
|
|
39
|
-
<Modal.CloseButton as={DeleteButton} onClick={handleDelete}>
|
|
40
|
-
Delete
|
|
41
|
-
</Modal.CloseButton>
|
|
42
|
-
<Modal.CloseButton>Cancel</Modal.CloseButton>
|
|
43
|
-
</HStack>
|
|
44
38
|
</Modal.Body>
|
|
39
|
+
<HStack spacing="s" padding="xxs" marginTop="xxs">
|
|
40
|
+
<Modal.CloseButton as={DeleteButton} onClick={handleDelete}>
|
|
41
|
+
Delete
|
|
42
|
+
</Modal.CloseButton>
|
|
43
|
+
<Modal.CloseButton>Cancel</Modal.CloseButton>
|
|
44
|
+
</HStack>
|
|
45
45
|
</Modal.Card>
|
|
46
46
|
</Modal.Overlay>
|
|
47
47
|
</Modal>
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
useInitialFocus,
|
|
10
10
|
useReturnFocus,
|
|
11
11
|
} from '@workday/canvas-kit-react/popup';
|
|
12
|
-
import {HStack} from '@workday/canvas-kit-react/layout';
|
|
12
|
+
import {Box, HStack} from '@workday/canvas-kit-react/layout';
|
|
13
13
|
|
|
14
14
|
export default () => {
|
|
15
15
|
const model = usePopupModel();
|
|
@@ -27,18 +27,20 @@ export default () => {
|
|
|
27
27
|
<Popup model={model}>
|
|
28
28
|
<Popup.Target as={DeleteButton}>Delete Item</Popup.Target>
|
|
29
29
|
<Popup.Popper placement="bottom">
|
|
30
|
-
<Popup.Card width={400}
|
|
30
|
+
<Popup.Card width={400}>
|
|
31
31
|
<Popup.CloseIcon aria-label="Close" />
|
|
32
32
|
<Popup.Heading>Delete Item</Popup.Heading>
|
|
33
33
|
<Popup.Body>
|
|
34
|
-
<p
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
Delete
|
|
38
|
-
</Popup.CloseButton>
|
|
39
|
-
<Popup.CloseButton>Cancel</Popup.CloseButton>
|
|
40
|
-
</HStack>
|
|
34
|
+
<Box as="p" marginY="zero">
|
|
35
|
+
Are you sure you'd like to delete the item titled 'My Item'?
|
|
36
|
+
</Box>
|
|
41
37
|
</Popup.Body>
|
|
38
|
+
<HStack spacing="s" padding="xxs" marginTop="xxs">
|
|
39
|
+
<Popup.CloseButton as={DeleteButton} onClick={handleDelete}>
|
|
40
|
+
Delete
|
|
41
|
+
</Popup.CloseButton>
|
|
42
|
+
<Popup.CloseButton>Cancel</Popup.CloseButton>
|
|
43
|
+
</HStack>
|
|
42
44
|
</Popup.Card>
|
|
43
45
|
</Popup.Popper>
|
|
44
46
|
</Popup>
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
useFocusRedirect,
|
|
11
11
|
usePopupModel,
|
|
12
12
|
} from '@workday/canvas-kit-react/popup';
|
|
13
|
-
import {HStack} from '@workday/canvas-kit-react/layout';
|
|
13
|
+
import {Box, HStack} from '@workday/canvas-kit-react/layout';
|
|
14
14
|
|
|
15
15
|
export default () => {
|
|
16
16
|
const model = usePopupModel();
|
|
@@ -39,13 +39,15 @@ export default () => {
|
|
|
39
39
|
<Popup.Target as={DeleteButton}>Delete Item</Popup.Target>
|
|
40
40
|
<div aria-owns={popupId} style={{position: 'absolute'}} />
|
|
41
41
|
<Popup.Popper>
|
|
42
|
-
<Popup.Card width={400}
|
|
42
|
+
<Popup.Card width={400}>
|
|
43
43
|
<Popup.CloseIcon aria-label="Close" />
|
|
44
44
|
<Popup.Heading>Delete Item</Popup.Heading>
|
|
45
45
|
<Popup.Body>
|
|
46
|
-
<p
|
|
46
|
+
<Box as="p" marginY="zero">
|
|
47
|
+
Are you sure you'd like to delete the item titled 'My Item'?
|
|
48
|
+
</Box>
|
|
47
49
|
</Popup.Body>
|
|
48
|
-
<HStack spacing="s">
|
|
50
|
+
<HStack spacing="s" padding="xxs" marginTop="xxs">
|
|
49
51
|
<Popup.CloseButton as={DeleteButton} onClick={handleDelete}>
|
|
50
52
|
Delete
|
|
51
53
|
</Popup.CloseButton>
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
useReturnFocus,
|
|
11
11
|
usePopupModel,
|
|
12
12
|
} from '@workday/canvas-kit-react/popup';
|
|
13
|
-
import {HStack} from '@workday/canvas-kit-react/layout';
|
|
13
|
+
import {Box, HStack} from '@workday/canvas-kit-react/layout';
|
|
14
14
|
|
|
15
15
|
export default () => {
|
|
16
16
|
const model = usePopupModel();
|
|
@@ -39,13 +39,15 @@ export default () => {
|
|
|
39
39
|
<Popup.Target as={DeleteButton}>Delete Item</Popup.Target>
|
|
40
40
|
<div aria-owns={popupId} style={{position: 'absolute'}} />
|
|
41
41
|
<Popup.Popper>
|
|
42
|
-
<Popup.Card width={400}
|
|
42
|
+
<Popup.Card width={400}>
|
|
43
43
|
<Popup.CloseIcon aria-label="Close" />
|
|
44
44
|
<Popup.Heading>Delete Item</Popup.Heading>
|
|
45
45
|
<Popup.Body>
|
|
46
|
-
<p
|
|
46
|
+
<Box as="p" marginY="zero">
|
|
47
|
+
Are you sure you'd like to delete the item titled 'My Item'?
|
|
48
|
+
</Box>
|
|
47
49
|
</Popup.Body>
|
|
48
|
-
<HStack spacing="s">
|
|
50
|
+
<HStack spacing="s" padding="xxs" marginTop="xxs">
|
|
49
51
|
<Popup.CloseButton as={DeleteButton} onClick={handleDelete}>
|
|
50
52
|
Delete
|
|
51
53
|
</Popup.CloseButton>
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
useInitialFocus,
|
|
9
9
|
useReturnFocus,
|
|
10
10
|
} from '@workday/canvas-kit-react/popup';
|
|
11
|
-
import {HStack} from '@workday/canvas-kit-react/layout';
|
|
11
|
+
import {Box, HStack} from '@workday/canvas-kit-react/layout';
|
|
12
12
|
|
|
13
13
|
export default () => {
|
|
14
14
|
const initialFocusRef = React.useRef(null);
|
|
@@ -25,13 +25,15 @@ export default () => {
|
|
|
25
25
|
<Popup model={model}>
|
|
26
26
|
<Popup.Target>Send Message</Popup.Target>
|
|
27
27
|
<Popup.Popper placement={'bottom'}>
|
|
28
|
-
<Popup.Card width={400}
|
|
28
|
+
<Popup.Card width={400}>
|
|
29
29
|
<Popup.CloseIcon aria-label="Close" />
|
|
30
30
|
<Popup.Heading>Confirmation</Popup.Heading>
|
|
31
31
|
<Popup.Body>
|
|
32
|
-
<p id="popup-message">
|
|
32
|
+
<Box as="p" marginY="zero" id="popup-message">
|
|
33
|
+
Your message has been sent!
|
|
34
|
+
</Box>
|
|
33
35
|
</Popup.Body>
|
|
34
|
-
<HStack spacing="s">
|
|
36
|
+
<HStack spacing="s" padding="xxs" marginTop="xxs">
|
|
35
37
|
<Popup.CloseButton ref={initialFocusRef} aria-describedby="popup-message">
|
|
36
38
|
OK
|
|
37
39
|
</Popup.CloseButton>
|
|
@@ -36,25 +36,27 @@ export default () => {
|
|
|
36
36
|
<Popup.Card aria-label="Popup 1">
|
|
37
37
|
<Popup.CloseIcon aria-label="Close" size="small" />
|
|
38
38
|
<Popup.Body>
|
|
39
|
-
<p>Contents of Popup 1</p>
|
|
39
|
+
<p style={{marginTop: 0, marginBottom: 0}}>Contents of Popup 1</p>
|
|
40
40
|
</Popup.Body>
|
|
41
|
-
<
|
|
42
|
-
<Popup
|
|
43
|
-
|
|
44
|
-
<Popup.
|
|
45
|
-
<Popup.
|
|
46
|
-
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
41
|
+
<HStack spacing="s" padding="xxs" marginTop="xxs">
|
|
42
|
+
<Popup model={popup2}>
|
|
43
|
+
<Popup.Target>Open Popup 2</Popup.Target>
|
|
44
|
+
<Popup.Popper>
|
|
45
|
+
<Popup.Card aria-label="Popup 2">
|
|
46
|
+
<Popup.CloseIcon aria-label="Close" size="small" />
|
|
47
|
+
<Popup.Body>
|
|
48
|
+
<p style={{marginTop: 0, marginBottom: 0}}>Contents of Popup 2</p>
|
|
49
|
+
</Popup.Body>
|
|
50
|
+
<HStack spacing="s" padding="xxs" marginTop="xxs">
|
|
51
|
+
<Popup.CloseButton as={Popup.CloseButton} model={popup1}>
|
|
52
|
+
Close Both (as)
|
|
53
|
+
</Popup.CloseButton>
|
|
54
|
+
<SecondaryButton {...closeBothProps}>Close Both (props)</SecondaryButton>
|
|
55
|
+
</HStack>
|
|
56
|
+
</Popup.Card>
|
|
57
|
+
</Popup.Popper>
|
|
58
|
+
</Popup>
|
|
59
|
+
</HStack>
|
|
58
60
|
</Popup.Card>
|
|
59
61
|
</Popup.Popper>
|
|
60
62
|
</Popup>
|
|
@@ -3,18 +3,20 @@ import React from 'react';
|
|
|
3
3
|
import {SecondaryButton, DeleteButton} from '@workday/canvas-kit-react/button';
|
|
4
4
|
import {CanvasProvider, ContentDirection} from '@workday/canvas-kit-react/common';
|
|
5
5
|
import {Popup} from '@workday/canvas-kit-react/popup';
|
|
6
|
-
import {HStack} from '@workday/canvas-kit-react/layout';
|
|
6
|
+
import {Box, HStack} from '@workday/canvas-kit-react/layout';
|
|
7
7
|
|
|
8
8
|
export default () => {
|
|
9
9
|
return (
|
|
10
10
|
<CanvasProvider theme={{canvas: {direction: ContentDirection.RTL}}}>
|
|
11
|
-
<Popup.Card width={400}
|
|
11
|
+
<Popup.Card width={400}>
|
|
12
12
|
<Popup.CloseIcon aria-label="סגור" />
|
|
13
13
|
<Popup.Heading>למחוק פריט</Popup.Heading>
|
|
14
14
|
<Popup.Body>
|
|
15
|
-
<p
|
|
15
|
+
<Box as="p" marginY="zero">
|
|
16
|
+
האם ברצונך למחוק פריט זה
|
|
17
|
+
</Box>
|
|
16
18
|
</Popup.Body>
|
|
17
|
-
<HStack spacing="s">
|
|
19
|
+
<HStack spacing="s" padding="xxs" marginTop="xxs">
|
|
18
20
|
<DeleteButton>לִמְחוֹק</DeleteButton>
|
|
19
21
|
<SecondaryButton>לְבַטֵל</SecondaryButton>
|
|
20
22
|
</HStack>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.1",
|
|
4
4
|
"description": "Documentation components of Canvas Kit components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@storybook/csf": "0.0.1",
|
|
45
|
-
"@workday/canvas-kit-react": "^7.3.
|
|
45
|
+
"@workday/canvas-kit-react": "^7.3.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"fs-extra": "^10.0.0",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"mkdirp": "^1.0.3",
|
|
51
51
|
"typescript": "4.1"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "41e6eb9532da50e341fe07b805becc2516f9d420"
|
|
54
54
|
}
|