@workday/canvas-kit-react 9.0.0-alpha.361-next.1 → 9.0.0-alpha.362-next.2
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/popup/lib/PopupCloseIcon.d.ts.map +1 -1
- package/dist/commonjs/popup/lib/PopupCloseIcon.js +2 -7
- package/dist/commonjs/toast/index.d.ts +1 -0
- package/dist/commonjs/toast/index.d.ts.map +1 -1
- package/dist/commonjs/toast/index.js +1 -0
- package/dist/commonjs/toast/lib/Toast.d.ts +56 -22
- package/dist/commonjs/toast/lib/Toast.d.ts.map +1 -1
- package/dist/commonjs/toast/lib/Toast.js +95 -56
- package/dist/commonjs/toast/lib/ToastBody.d.ts +6 -0
- package/dist/commonjs/toast/lib/ToastBody.d.ts.map +1 -0
- package/dist/commonjs/toast/lib/ToastBody.js +38 -0
- package/dist/commonjs/toast/lib/ToastCloseIcon.d.ts +6 -0
- package/dist/commonjs/toast/lib/ToastCloseIcon.d.ts.map +1 -0
- package/dist/commonjs/toast/lib/ToastCloseIcon.js +26 -0
- package/dist/commonjs/toast/lib/ToastIcon.d.ts +5 -0
- package/dist/commonjs/toast/lib/ToastIcon.d.ts.map +1 -0
- package/dist/commonjs/toast/lib/ToastIcon.js +26 -0
- package/dist/commonjs/toast/lib/ToastLink.d.ts +5 -0
- package/dist/commonjs/toast/lib/ToastLink.d.ts.map +1 -0
- package/dist/commonjs/toast/lib/ToastLink.js +38 -0
- package/dist/commonjs/toast/lib/ToastMessage.d.ts +12 -0
- package/dist/commonjs/toast/lib/ToastMessage.d.ts.map +1 -0
- package/dist/commonjs/toast/lib/ToastMessage.js +38 -0
- package/dist/commonjs/toast/lib/hooks/useToastModel.d.ts +75 -0
- package/dist/commonjs/toast/lib/hooks/useToastModel.d.ts.map +1 -0
- package/dist/commonjs/toast/lib/hooks/useToastModel.js +37 -0
- package/dist/es6/popup/lib/PopupCloseIcon.d.ts.map +1 -1
- package/dist/es6/popup/lib/PopupCloseIcon.js +3 -8
- package/dist/es6/toast/index.d.ts +1 -0
- package/dist/es6/toast/index.d.ts.map +1 -1
- package/dist/es6/toast/index.js +1 -0
- package/dist/es6/toast/lib/Toast.d.ts +56 -22
- package/dist/es6/toast/lib/Toast.d.ts.map +1 -1
- package/dist/es6/toast/lib/Toast.js +92 -37
- package/dist/es6/toast/lib/ToastBody.d.ts +6 -0
- package/dist/es6/toast/lib/ToastBody.d.ts.map +1 -0
- package/dist/es6/toast/lib/ToastBody.js +32 -0
- package/dist/es6/toast/lib/ToastCloseIcon.d.ts +6 -0
- package/dist/es6/toast/lib/ToastCloseIcon.d.ts.map +1 -0
- package/dist/es6/toast/lib/ToastCloseIcon.js +20 -0
- package/dist/es6/toast/lib/ToastIcon.d.ts +5 -0
- package/dist/es6/toast/lib/ToastIcon.d.ts.map +1 -0
- package/dist/es6/toast/lib/ToastIcon.js +20 -0
- package/dist/es6/toast/lib/ToastLink.d.ts +5 -0
- package/dist/es6/toast/lib/ToastLink.d.ts.map +1 -0
- package/dist/es6/toast/lib/ToastLink.js +32 -0
- package/dist/es6/toast/lib/ToastMessage.d.ts +12 -0
- package/dist/es6/toast/lib/ToastMessage.d.ts.map +1 -0
- package/dist/es6/toast/lib/ToastMessage.js +32 -0
- package/dist/es6/toast/lib/hooks/useToastModel.d.ts +75 -0
- package/dist/es6/toast/lib/hooks/useToastModel.d.ts.map +1 -0
- package/dist/es6/toast/lib/hooks/useToastModel.js +34 -0
- package/package.json +3 -3
- package/popup/lib/PopupCloseIcon.tsx +14 -15
- package/toast/LICENSE +1 -0
- package/toast/README.md +3 -5
- package/toast/index.ts +1 -0
- package/toast/lib/Toast.tsx +104 -109
- package/toast/lib/ToastBody.tsx +28 -0
- package/toast/lib/ToastCloseIcon.tsx +14 -0
- package/toast/lib/ToastIcon.tsx +23 -0
- package/toast/lib/ToastLink.tsx +17 -0
- package/toast/lib/ToastMessage.tsx +24 -0
- package/toast/lib/hooks/useToastModel.tsx +29 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupCloseIcon.d.ts","sourceRoot":"","sources":["../../../../popup/lib/PopupCloseIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,
|
|
1
|
+
{"version":3,"file":"PopupCloseIcon.d.ts","sourceRoot":"","sources":["../../../../popup/lib/PopupCloseIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAqB,YAAY,EAAC,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAC,cAAc,EAAC,MAAM,kCAAkC,CAAC;AAKhE,MAAM,WAAW,mBAAoB,SAAQ,YAAY,CAAC,OAAO,cAAc,EAAE,KAAK,CAAC;CAAG;AAE1F,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;EAiBzB,CAAC"}
|
|
@@ -30,18 +30,13 @@ var react_1 = __importDefault(require("react"));
|
|
|
30
30
|
var canvas_system_icons_web_1 = require("@workday/canvas-system-icons-web");
|
|
31
31
|
var common_1 = require("@workday/canvas-kit-react/common");
|
|
32
32
|
var button_1 = require("@workday/canvas-kit-react/button");
|
|
33
|
+
var tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
33
34
|
var hooks_1 = require("./hooks");
|
|
34
|
-
var closeIconSpacing = 4;
|
|
35
|
-
var StyledCloseIcon = common_1.styled(button_1.TertiaryButton)({
|
|
36
|
-
position: 'absolute',
|
|
37
|
-
right: closeIconSpacing,
|
|
38
|
-
top: closeIconSpacing,
|
|
39
|
-
});
|
|
40
35
|
exports.PopupCloseIcon = common_1.createSubcomponent('button')({
|
|
41
36
|
displayName: 'Popup.CloseIcon',
|
|
42
37
|
modelHook: hooks_1.usePopupModel,
|
|
43
38
|
elemPropsHook: hooks_1.usePopupCloseButton,
|
|
44
39
|
})(function (_a, Element) {
|
|
45
40
|
var children = _a.children, elemProps = __rest(_a, ["children"]);
|
|
46
|
-
return react_1.default.createElement(
|
|
41
|
+
return (react_1.default.createElement(button_1.TertiaryButton, __assign({ as: Element, size: "medium", icon: canvas_system_icons_web_1.xIcon, type: "button", position: "absolute", right: tokens_1.space.xxxs, top: tokens_1.space.xxxs }, elemProps)));
|
|
47
42
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../toast/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../toast/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC"}
|
|
@@ -1,34 +1,68 @@
|
|
|
1
|
-
import { Popup } from '@workday/canvas-kit-react/popup';
|
|
2
|
-
import { CanvasColor } from '@workday/canvas-kit-react/tokens';
|
|
3
|
-
import { CanvasSystemIcon } from '@workday/design-assets-types';
|
|
4
1
|
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
import { Popup } from '@workday/canvas-kit-react/popup';
|
|
3
|
+
export interface ToastProps extends Omit<ExtractProps<typeof Popup.Card, never>, 'model'> {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Toast is a compound component that has different modes based on its contents. The modes add the proper aria attributes for accessibility
|
|
7
|
+
*
|
|
8
|
+
* ```tsx
|
|
9
|
+
* import { Toast } from "@workday/canvas-kit-react/toast";
|
|
10
|
+
*
|
|
11
|
+
* const MyToast = (props: CardProps) => (
|
|
12
|
+
* <Toast mode="dialog" aria-label="notifcation">
|
|
13
|
+
* <Toast.Icon icon={checkIcon} color={colors.greenApple400} />
|
|
14
|
+
* <Toast.Body>
|
|
15
|
+
* <Toast.Message>Your workbook was successfully processed.</Toast.Message>
|
|
16
|
+
* <Toast.Link href="#hreflink">Custom Link</Toast.Link>
|
|
17
|
+
* </Toast.Body>
|
|
18
|
+
* <Toast.CloseIcon aria-label="Close" onClick={handleClose} />
|
|
19
|
+
* </Toast>
|
|
20
|
+
* );
|
|
21
|
+
*```
|
|
22
|
+
*/
|
|
23
|
+
export declare const Toast: import("@workday/canvas-kit-react/common").ElementComponentM<"div", ToastProps & Partial<{
|
|
24
|
+
mode: import("./hooks/useToastModel").AriaRoleMode;
|
|
25
|
+
id: string;
|
|
26
|
+
}> & {} & {}, {
|
|
27
|
+
state: {
|
|
28
|
+
id: string;
|
|
29
|
+
mode: import("./hooks/useToastModel").AriaRoleMode;
|
|
30
|
+
};
|
|
31
|
+
events: {};
|
|
32
|
+
}> & {
|
|
11
33
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
34
|
+
* `Toast.Body` should container `Toast.Message` and `Toast.Link`. This ensures proper styling and spacing between elements.
|
|
35
|
+
*
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <Toast.Body>
|
|
38
|
+
* <Toast.Message>Your workbook was successfully processed.</Toast.Message>
|
|
39
|
+
* <Toast.Link href="#hreflink">Custom Link</Toast.Link>
|
|
40
|
+
* </Toast.Body>
|
|
41
|
+
* ```
|
|
14
42
|
*/
|
|
15
|
-
|
|
43
|
+
Body: import("@workday/canvas-kit-react/common").ElementComponent<"div", import("./ToastBody").ToastBodyProps>;
|
|
16
44
|
/**
|
|
17
|
-
*
|
|
45
|
+
* `Toast.CloseIcon` renders a {@link PopupCloseIcon}. You can pass an `onClick` when used with `Popper` to dismiss the `Toast`.
|
|
18
46
|
*/
|
|
19
|
-
|
|
47
|
+
CloseIcon: import("@workday/canvas-kit-react/common").ElementComponent<"button", import("./ToastCloseIcon").ToastCloseIconProps>;
|
|
20
48
|
/**
|
|
21
|
-
*
|
|
49
|
+
* `ToastIcon` renders a `SystemIcon` where you have access to all styling properties from `SystemIcon`.
|
|
22
50
|
*/
|
|
23
|
-
|
|
51
|
+
Icon: import("@workday/canvas-kit-react/common").ElementComponent<"div", import("./ToastIcon").ToastIconProps>;
|
|
24
52
|
/**
|
|
25
|
-
*
|
|
53
|
+
* `Toast.Message` renders our `Subtext` component where you can style however way you'd like with style properties.
|
|
54
|
+
* This component also has an `id` so that when the `Toast` has a prop of `mode="dialog"` the message is read out by screen readers by adding an `aria-describedby` on the main `Toast` component.
|
|
26
55
|
*/
|
|
27
|
-
|
|
56
|
+
Message: import("@workday/canvas-kit-react/common").ElementComponentM<"p", import("./ToastMessage").ToastMessageProps, {
|
|
57
|
+
state: {
|
|
58
|
+
id: string;
|
|
59
|
+
mode: import("./hooks/useToastModel").AriaRoleMode;
|
|
60
|
+
};
|
|
61
|
+
events: {};
|
|
62
|
+
}>;
|
|
28
63
|
/**
|
|
29
|
-
*
|
|
64
|
+
* `Toast.Link` renders our `Hyperlink` component. If you need to link to more information, use this component.
|
|
30
65
|
*/
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
export declare const Toast: import("@workday/canvas-kit-react/common").ElementComponent<"div", ToastProps>;
|
|
66
|
+
Link: import("@workday/canvas-kit-react/common").ElementComponent<"a", import("./ToastLink").ToastLinkProps>;
|
|
67
|
+
};
|
|
34
68
|
//# sourceMappingURL=Toast.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../../toast/lib/Toast.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../../toast/lib/Toast.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAkB,YAAY,EAAC,MAAM,kCAAkC,CAAC;AAE/E,OAAO,EAAC,KAAK,EAAC,MAAM,iCAAiC,CAAC;AAStD,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,YAAY,CAAC,OAAO,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,OAAO,CAAC;CAAG;AAkC5F;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;IAId;;;;;;;;;OASG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;;;;;;;IAEH;;OAEG;;CAiBL,CAAC"}
|
|
@@ -10,25 +10,6 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
-
}) : function(o, v) {
|
|
23
|
-
o["default"] = v;
|
|
24
|
-
});
|
|
25
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
-
if (mod && mod.__esModule) return mod;
|
|
27
|
-
var result = {};
|
|
28
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
-
__setModuleDefault(result, mod);
|
|
30
|
-
return result;
|
|
31
|
-
};
|
|
32
13
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
33
14
|
var t = {};
|
|
34
15
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -40,46 +21,104 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
40
21
|
}
|
|
41
22
|
return t;
|
|
42
23
|
};
|
|
24
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
43
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
28
|
exports.Toast = void 0;
|
|
45
|
-
var
|
|
46
|
-
var popup_1 = require("@workday/canvas-kit-react/popup");
|
|
47
|
-
var tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
48
|
-
var icon_1 = require("@workday/canvas-kit-react/icon");
|
|
49
|
-
var canvas_system_icons_web_1 = require("@workday/canvas-system-icons-web");
|
|
29
|
+
var react_1 = __importDefault(require("react"));
|
|
50
30
|
var common_1 = require("@workday/canvas-kit-react/common");
|
|
51
|
-
var
|
|
52
|
-
var
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
var
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
31
|
+
var layout_1 = require("@workday/canvas-kit-react/layout");
|
|
32
|
+
var popup_1 = require("@workday/canvas-kit-react/popup");
|
|
33
|
+
var ToastCloseIcon_1 = require("./ToastCloseIcon");
|
|
34
|
+
var ToastIcon_1 = require("./ToastIcon");
|
|
35
|
+
var ToastMessage_1 = require("./ToastMessage");
|
|
36
|
+
var ToastLink_1 = require("./ToastLink");
|
|
37
|
+
var ToastBody_1 = require("./ToastBody");
|
|
38
|
+
var useToastModel_1 = require("./hooks/useToastModel");
|
|
39
|
+
/**
|
|
40
|
+
* The function helps set the correct aria attributes based on the mode
|
|
41
|
+
* @param mode Defines what aria attributes will be added to the main container
|
|
42
|
+
* @param id Used to tie the Toast to Toast.Message for screen readers
|
|
43
|
+
*/
|
|
44
|
+
var getAriaAttributes = function (mode, id) {
|
|
45
|
+
switch (mode) {
|
|
46
|
+
case 'dialog':
|
|
47
|
+
return {
|
|
48
|
+
'aria-describedby': id,
|
|
49
|
+
// This is added by Popup.Card, so overwriting to remove it
|
|
50
|
+
'aria-labelledby': undefined,
|
|
51
|
+
role: 'dialog',
|
|
52
|
+
};
|
|
53
|
+
case 'alert':
|
|
54
|
+
return {
|
|
55
|
+
role: 'alert',
|
|
56
|
+
'aria-live': 'assertive',
|
|
57
|
+
'aria-atomic': true,
|
|
58
|
+
};
|
|
59
|
+
case 'status':
|
|
60
|
+
return {
|
|
61
|
+
role: 'status',
|
|
62
|
+
'aria-live': 'polite',
|
|
63
|
+
'aria-atomic': true,
|
|
64
|
+
};
|
|
65
|
+
default: {
|
|
66
|
+
return {};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Toast is a compound component that has different modes based on its contents. The modes add the proper aria attributes for accessibility
|
|
72
|
+
*
|
|
73
|
+
* ```tsx
|
|
74
|
+
* import { Toast } from "@workday/canvas-kit-react/toast";
|
|
75
|
+
*
|
|
76
|
+
* const MyToast = (props: CardProps) => (
|
|
77
|
+
* <Toast mode="dialog" aria-label="notifcation">
|
|
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="#hreflink">Custom Link</Toast.Link>
|
|
82
|
+
* </Toast.Body>
|
|
83
|
+
* <Toast.CloseIcon aria-label="Close" onClick={handleClose} />
|
|
84
|
+
* </Toast>
|
|
85
|
+
* );
|
|
86
|
+
*```
|
|
87
|
+
*/
|
|
88
|
+
exports.Toast = common_1.createContainer('div')({
|
|
69
89
|
displayName: 'Toast',
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
90
|
+
modelHook: useToastModel_1.useToastModel,
|
|
91
|
+
subComponents: {
|
|
92
|
+
/**
|
|
93
|
+
* `Toast.Body` should container `Toast.Message` and `Toast.Link`. This ensures proper styling and spacing between elements.
|
|
94
|
+
*
|
|
95
|
+
* ```tsx
|
|
96
|
+
* <Toast.Body>
|
|
97
|
+
* <Toast.Message>Your workbook was successfully processed.</Toast.Message>
|
|
98
|
+
* <Toast.Link href="#hreflink">Custom Link</Toast.Link>
|
|
99
|
+
* </Toast.Body>
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
Body: ToastBody_1.ToastBody,
|
|
103
|
+
/**
|
|
104
|
+
* `Toast.CloseIcon` renders a {@link PopupCloseIcon}. You can pass an `onClick` when used with `Popper` to dismiss the `Toast`.
|
|
105
|
+
*/
|
|
106
|
+
CloseIcon: ToastCloseIcon_1.ToastCloseIcon,
|
|
107
|
+
/**
|
|
108
|
+
* `ToastIcon` renders a `SystemIcon` where you have access to all styling properties from `SystemIcon`.
|
|
109
|
+
*/
|
|
110
|
+
Icon: ToastIcon_1.ToastIcon,
|
|
111
|
+
/**
|
|
112
|
+
* `Toast.Message` renders our `Subtext` component where you can style however way you'd like with style properties.
|
|
113
|
+
* This component also has an `id` so that when the `Toast` has a prop of `mode="dialog"` the message is read out by screen readers by adding an `aria-describedby` on the main `Toast` component.
|
|
114
|
+
*/
|
|
115
|
+
Message: ToastMessage_1.ToastMessage,
|
|
116
|
+
/**
|
|
117
|
+
* `Toast.Link` renders our `Hyperlink` component. If you need to link to more information, use this component.
|
|
118
|
+
*/
|
|
119
|
+
Link: ToastLink_1.ToastLink,
|
|
84
120
|
},
|
|
121
|
+
})(function (_a, _, model) {
|
|
122
|
+
var children = _a.children, elemProps = __rest(_a, ["children"]);
|
|
123
|
+
return (react_1.default.createElement(popup_1.Popup.Card, __assign({ as: layout_1.Flex, width: 360, padding: "0" }, getAriaAttributes(model.state.mode, model.state.id), { flexDirection: "row", gap: "xxxs" }, elemProps), children));
|
|
85
124
|
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
2
|
+
import { Popup } from '@workday/canvas-kit-react/popup';
|
|
3
|
+
export interface ToastBodyProps extends ExtractProps<typeof Popup.Body> {
|
|
4
|
+
}
|
|
5
|
+
export declare const ToastBody: import("@workday/canvas-kit-react/common").ElementComponent<"div", ToastBodyProps>;
|
|
6
|
+
//# sourceMappingURL=ToastBody.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastBody.d.ts","sourceRoot":"","sources":["../../../../toast/lib/ToastBody.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAkB,YAAY,EAAC,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAC,KAAK,EAAC,MAAM,iCAAiC,CAAC;AAGtD,MAAM,WAAW,cAAe,SAAQ,YAAY,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC;CAAG;AAE1E,eAAO,MAAM,SAAS,oFAmBpB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.ToastBody = void 0;
|
|
29
|
+
var react_1 = __importDefault(require("react"));
|
|
30
|
+
var common_1 = require("@workday/canvas-kit-react/common");
|
|
31
|
+
var layout_1 = require("@workday/canvas-kit-react/layout");
|
|
32
|
+
exports.ToastBody = common_1.createComponent('div')({
|
|
33
|
+
displayName: 'Toast.Body',
|
|
34
|
+
Component: function (_a, ref, Element) {
|
|
35
|
+
var children = _a.children, elemProps = __rest(_a, ["children"]);
|
|
36
|
+
return (react_1.default.createElement(layout_1.Flex, __assign({ alignItems: "flex-start", flexDirection: "column", justifyContent: "center", paddingY: "s", ref: ref, as: Element, flexGrow: 1, gap: "xxxs" }, elemProps), children));
|
|
37
|
+
},
|
|
38
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
2
|
+
import { Popup } from '@workday/canvas-kit-react/popup';
|
|
3
|
+
export interface ToastCloseIconProps extends ExtractProps<typeof Popup.CloseIcon, never> {
|
|
4
|
+
}
|
|
5
|
+
export declare const ToastCloseIcon: import("@workday/canvas-kit-react/common").ElementComponent<"button", ToastCloseIconProps>;
|
|
6
|
+
//# sourceMappingURL=ToastCloseIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastCloseIcon.d.ts","sourceRoot":"","sources":["../../../../toast/lib/ToastCloseIcon.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,YAAY,EAAC,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAC,KAAK,EAAC,MAAM,iCAAiC,CAAC;AAEtD,MAAM,WAAW,mBAAoB,SAAQ,YAAY,CAAC,OAAO,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC;CAAG;AAE3F,eAAO,MAAM,cAAc,4FAOzB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ToastCloseIcon = void 0;
|
|
18
|
+
var react_1 = __importDefault(require("react"));
|
|
19
|
+
var common_1 = require("@workday/canvas-kit-react/common");
|
|
20
|
+
var popup_1 = require("@workday/canvas-kit-react/popup");
|
|
21
|
+
exports.ToastCloseIcon = common_1.createComponent('button')({
|
|
22
|
+
displayName: 'Toast.CloseIcon',
|
|
23
|
+
Component: function (elemProps, ref, Element) {
|
|
24
|
+
return (react_1.default.createElement(popup_1.Popup.CloseIcon, __assign({ as: Element, ref: ref, size: "small", position: "relative" }, elemProps)));
|
|
25
|
+
},
|
|
26
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SystemIconProps } from '@workday/canvas-kit-react/icon';
|
|
2
|
+
export interface ToastIconProps extends Omit<SystemIconProps, 'colorHover'> {
|
|
3
|
+
}
|
|
4
|
+
export declare const ToastIcon: import("@workday/canvas-kit-react/common").ElementComponent<"div", ToastIconProps>;
|
|
5
|
+
//# sourceMappingURL=ToastIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastIcon.d.ts","sourceRoot":"","sources":["../../../../toast/lib/ToastIcon.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAa,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAE3E,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC;CAAG;AAE9E,eAAO,MAAM,SAAS,oFAepB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ToastIcon = void 0;
|
|
18
|
+
var react_1 = __importDefault(require("react"));
|
|
19
|
+
var common_1 = require("@workday/canvas-kit-react/common");
|
|
20
|
+
var icon_1 = require("@workday/canvas-kit-react/icon");
|
|
21
|
+
exports.ToastIcon = common_1.createComponent('div')({
|
|
22
|
+
displayName: 'Toast.Icon',
|
|
23
|
+
Component: function (elemProps, ref, Element) {
|
|
24
|
+
return (react_1.default.createElement(icon_1.SystemIcon, __assign({ colorHover: elemProps.color, marginY: "s", marginX: "xs", alignSelf: "start", ref: ref, as: Element }, elemProps)));
|
|
25
|
+
},
|
|
26
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { HyperlinkProps } from '@workday/canvas-kit-react/button';
|
|
2
|
+
export interface ToastLinkProps extends HyperlinkProps {
|
|
3
|
+
}
|
|
4
|
+
export declare const ToastLink: import("@workday/canvas-kit-react/common").ElementComponent<"a", ToastLinkProps>;
|
|
5
|
+
//# sourceMappingURL=ToastLink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastLink.d.ts","sourceRoot":"","sources":["../../../../toast/lib/ToastLink.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAY,cAAc,EAAC,MAAM,kCAAkC,CAAC;AAE3E,MAAM,WAAW,cAAe,SAAQ,cAAc;CAAG;AAEzD,eAAO,MAAM,SAAS,kFASpB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.ToastLink = void 0;
|
|
29
|
+
var react_1 = __importDefault(require("react"));
|
|
30
|
+
var common_1 = require("@workday/canvas-kit-react/common");
|
|
31
|
+
var button_1 = require("@workday/canvas-kit-react/button");
|
|
32
|
+
exports.ToastLink = common_1.createComponent('a')({
|
|
33
|
+
displayName: 'Toast.Link',
|
|
34
|
+
Component: function (_a, ref, Element) {
|
|
35
|
+
var children = _a.children, href = _a.href, elemProps = __rest(_a, ["children", "href"]);
|
|
36
|
+
return (react_1.default.createElement(button_1.Hyperlink, __assign({ ref: ref, href: href, as: Element }, elemProps), children));
|
|
37
|
+
},
|
|
38
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
2
|
+
import { Subtext } from '@workday/canvas-kit-react/text';
|
|
3
|
+
export interface ToastMessageProps extends Omit<ExtractProps<typeof Subtext>, 'size'> {
|
|
4
|
+
}
|
|
5
|
+
export declare const ToastMessage: import("@workday/canvas-kit-react/common").ElementComponentM<"p", ToastMessageProps, {
|
|
6
|
+
state: {
|
|
7
|
+
id: string;
|
|
8
|
+
mode: import("./hooks/useToastModel").AriaRoleMode;
|
|
9
|
+
};
|
|
10
|
+
events: {};
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=ToastMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastMessage.d.ts","sourceRoot":"","sources":["../../../../toast/lib/ToastMessage.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAqB,YAAY,EAAC,MAAM,kCAAkC,CAAC;AAElF,OAAO,EAAC,OAAO,EAAC,MAAM,gCAAgC,CAAC;AAEvD,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,YAAY,CAAC,OAAO,OAAO,CAAC,EAAE,MAAM,CAAC;CAAG;AAExF,eAAO,MAAM,YAAY;;;;;;EAevB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.ToastMessage = void 0;
|
|
29
|
+
var react_1 = __importDefault(require("react"));
|
|
30
|
+
var common_1 = require("@workday/canvas-kit-react/common");
|
|
31
|
+
var useToastModel_1 = require("./hooks/useToastModel");
|
|
32
|
+
var text_1 = require("@workday/canvas-kit-react/text");
|
|
33
|
+
exports.ToastMessage = common_1.createSubcomponent('p')({
|
|
34
|
+
modelHook: useToastModel_1.useToastModel,
|
|
35
|
+
})(function (_a, Element, model) {
|
|
36
|
+
var children = _a.children, elemProps = __rest(_a, ["children"]);
|
|
37
|
+
return (react_1.default.createElement(text_1.Subtext, __assign({ size: "large", wordBreak: "break-word", marginY: "zero", id: model.state.id, as: Element }, elemProps), children));
|
|
38
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export declare type AriaRoleMode = 'dialog' | 'status' | 'alert';
|
|
2
|
+
export declare const useToastModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
3
|
+
/**
|
|
4
|
+
* Sets the correct aria attributes for the Toast.
|
|
5
|
+
* Alert toasts are used to convey urgency and important information. The `role` is set to `alert`
|
|
6
|
+
* Status toasts are used to convey a message or a successful action. The `role` is set to `status`
|
|
7
|
+
* Dialog toasts are used when there's an action to be taken. The `role` is set to `dialog`.
|
|
8
|
+
* If you use this mode, you must add an aria-label to the main `Toast` component.
|
|
9
|
+
* The aria-label should provide additional information to the contents of the `Toast`.
|
|
10
|
+
* @default 'status'
|
|
11
|
+
*/
|
|
12
|
+
mode: AriaRoleMode;
|
|
13
|
+
/**
|
|
14
|
+
* When the Toast has a `mode="dialog"` this adds a unique id to `Toast.Message` so that the message gets read out for screen readers.
|
|
15
|
+
*/
|
|
16
|
+
id: string;
|
|
17
|
+
}> & {} & {}) | undefined) => {
|
|
18
|
+
state: {
|
|
19
|
+
id: string;
|
|
20
|
+
/**
|
|
21
|
+
* Sets the correct aria attributes for the Toast.
|
|
22
|
+
* Alert toasts are used to convey urgency and important information. The `role` is set to `alert`
|
|
23
|
+
* Status toasts are used to convey a message or a successful action. The `role` is set to `status`
|
|
24
|
+
* Dialog toasts are used when there's an action to be taken. The `role` is set to `dialog`.
|
|
25
|
+
* If you use this mode, you must add an aria-label to the main `Toast` component.
|
|
26
|
+
* The aria-label should provide additional information to the contents of the `Toast`.
|
|
27
|
+
* @default 'status'
|
|
28
|
+
*/
|
|
29
|
+
mode: AriaRoleMode;
|
|
30
|
+
};
|
|
31
|
+
events: {};
|
|
32
|
+
}) & import("@workday/canvas-kit-react/common").ModelExtras<{
|
|
33
|
+
/**
|
|
34
|
+
* Sets the correct aria attributes for the Toast.
|
|
35
|
+
* Alert toasts are used to convey urgency and important information. The `role` is set to `alert`
|
|
36
|
+
* Status toasts are used to convey a message or a successful action. The `role` is set to `status`
|
|
37
|
+
* Dialog toasts are used when there's an action to be taken. The `role` is set to `dialog`.
|
|
38
|
+
* If you use this mode, you must add an aria-label to the main `Toast` component.
|
|
39
|
+
* The aria-label should provide additional information to the contents of the `Toast`.
|
|
40
|
+
* @default 'status'
|
|
41
|
+
*/
|
|
42
|
+
mode: AriaRoleMode;
|
|
43
|
+
/**
|
|
44
|
+
* When the Toast has a `mode="dialog"` this adds a unique id to `Toast.Message` so that the message gets read out for screen readers.
|
|
45
|
+
*/
|
|
46
|
+
id: string;
|
|
47
|
+
}, {}, {
|
|
48
|
+
id: string;
|
|
49
|
+
/**
|
|
50
|
+
* Sets the correct aria attributes for the Toast.
|
|
51
|
+
* Alert toasts are used to convey urgency and important information. The `role` is set to `alert`
|
|
52
|
+
* Status toasts are used to convey a message or a successful action. The `role` is set to `status`
|
|
53
|
+
* Dialog toasts are used when there's an action to be taken. The `role` is set to `dialog`.
|
|
54
|
+
* If you use this mode, you must add an aria-label to the main `Toast` component.
|
|
55
|
+
* The aria-label should provide additional information to the contents of the `Toast`.
|
|
56
|
+
* @default 'status'
|
|
57
|
+
*/
|
|
58
|
+
mode: AriaRoleMode;
|
|
59
|
+
}, {}, {
|
|
60
|
+
state: {
|
|
61
|
+
id: string;
|
|
62
|
+
/**
|
|
63
|
+
* Sets the correct aria attributes for the Toast.
|
|
64
|
+
* Alert toasts are used to convey urgency and important information. The `role` is set to `alert`
|
|
65
|
+
* Status toasts are used to convey a message or a successful action. The `role` is set to `status`
|
|
66
|
+
* Dialog toasts are used when there's an action to be taken. The `role` is set to `dialog`.
|
|
67
|
+
* If you use this mode, you must add an aria-label to the main `Toast` component.
|
|
68
|
+
* The aria-label should provide additional information to the contents of the `Toast`.
|
|
69
|
+
* @default 'status'
|
|
70
|
+
*/
|
|
71
|
+
mode: AriaRoleMode;
|
|
72
|
+
};
|
|
73
|
+
events: {};
|
|
74
|
+
}>;
|
|
75
|
+
//# sourceMappingURL=useToastModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToastModel.d.ts","sourceRoot":"","sources":["../../../../../toast/lib/hooks/useToastModel.tsx"],"names":[],"mappings":"AACA,oBAAY,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEzD,eAAO,MAAM,aAAa;IAEtB;;;;;;;;OAQG;;IAEH;;OAEG;;;;;QAZH;;;;;;;;WAQG;;;;;IARH;;;;;;;;OAQG;;IAEH;;OAEG;;;;IAZH;;;;;;;;OAQG;;;;;QARH;;;;;;;;WAQG;;;;EAeL,CAAC"}
|