@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.
Files changed (64) hide show
  1. package/dist/commonjs/popup/lib/PopupCloseIcon.d.ts.map +1 -1
  2. package/dist/commonjs/popup/lib/PopupCloseIcon.js +2 -7
  3. package/dist/commonjs/toast/index.d.ts +1 -0
  4. package/dist/commonjs/toast/index.d.ts.map +1 -1
  5. package/dist/commonjs/toast/index.js +1 -0
  6. package/dist/commonjs/toast/lib/Toast.d.ts +56 -22
  7. package/dist/commonjs/toast/lib/Toast.d.ts.map +1 -1
  8. package/dist/commonjs/toast/lib/Toast.js +95 -56
  9. package/dist/commonjs/toast/lib/ToastBody.d.ts +6 -0
  10. package/dist/commonjs/toast/lib/ToastBody.d.ts.map +1 -0
  11. package/dist/commonjs/toast/lib/ToastBody.js +38 -0
  12. package/dist/commonjs/toast/lib/ToastCloseIcon.d.ts +6 -0
  13. package/dist/commonjs/toast/lib/ToastCloseIcon.d.ts.map +1 -0
  14. package/dist/commonjs/toast/lib/ToastCloseIcon.js +26 -0
  15. package/dist/commonjs/toast/lib/ToastIcon.d.ts +5 -0
  16. package/dist/commonjs/toast/lib/ToastIcon.d.ts.map +1 -0
  17. package/dist/commonjs/toast/lib/ToastIcon.js +26 -0
  18. package/dist/commonjs/toast/lib/ToastLink.d.ts +5 -0
  19. package/dist/commonjs/toast/lib/ToastLink.d.ts.map +1 -0
  20. package/dist/commonjs/toast/lib/ToastLink.js +38 -0
  21. package/dist/commonjs/toast/lib/ToastMessage.d.ts +12 -0
  22. package/dist/commonjs/toast/lib/ToastMessage.d.ts.map +1 -0
  23. package/dist/commonjs/toast/lib/ToastMessage.js +38 -0
  24. package/dist/commonjs/toast/lib/hooks/useToastModel.d.ts +75 -0
  25. package/dist/commonjs/toast/lib/hooks/useToastModel.d.ts.map +1 -0
  26. package/dist/commonjs/toast/lib/hooks/useToastModel.js +37 -0
  27. package/dist/es6/popup/lib/PopupCloseIcon.d.ts.map +1 -1
  28. package/dist/es6/popup/lib/PopupCloseIcon.js +3 -8
  29. package/dist/es6/toast/index.d.ts +1 -0
  30. package/dist/es6/toast/index.d.ts.map +1 -1
  31. package/dist/es6/toast/index.js +1 -0
  32. package/dist/es6/toast/lib/Toast.d.ts +56 -22
  33. package/dist/es6/toast/lib/Toast.d.ts.map +1 -1
  34. package/dist/es6/toast/lib/Toast.js +92 -37
  35. package/dist/es6/toast/lib/ToastBody.d.ts +6 -0
  36. package/dist/es6/toast/lib/ToastBody.d.ts.map +1 -0
  37. package/dist/es6/toast/lib/ToastBody.js +32 -0
  38. package/dist/es6/toast/lib/ToastCloseIcon.d.ts +6 -0
  39. package/dist/es6/toast/lib/ToastCloseIcon.d.ts.map +1 -0
  40. package/dist/es6/toast/lib/ToastCloseIcon.js +20 -0
  41. package/dist/es6/toast/lib/ToastIcon.d.ts +5 -0
  42. package/dist/es6/toast/lib/ToastIcon.d.ts.map +1 -0
  43. package/dist/es6/toast/lib/ToastIcon.js +20 -0
  44. package/dist/es6/toast/lib/ToastLink.d.ts +5 -0
  45. package/dist/es6/toast/lib/ToastLink.d.ts.map +1 -0
  46. package/dist/es6/toast/lib/ToastLink.js +32 -0
  47. package/dist/es6/toast/lib/ToastMessage.d.ts +12 -0
  48. package/dist/es6/toast/lib/ToastMessage.d.ts.map +1 -0
  49. package/dist/es6/toast/lib/ToastMessage.js +32 -0
  50. package/dist/es6/toast/lib/hooks/useToastModel.d.ts +75 -0
  51. package/dist/es6/toast/lib/hooks/useToastModel.d.ts.map +1 -0
  52. package/dist/es6/toast/lib/hooks/useToastModel.js +34 -0
  53. package/package.json +3 -3
  54. package/popup/lib/PopupCloseIcon.tsx +14 -15
  55. package/toast/LICENSE +1 -0
  56. package/toast/README.md +3 -5
  57. package/toast/index.ts +1 -0
  58. package/toast/lib/Toast.tsx +104 -109
  59. package/toast/lib/ToastBody.tsx +28 -0
  60. package/toast/lib/ToastCloseIcon.tsx +14 -0
  61. package/toast/lib/ToastIcon.tsx +23 -0
  62. package/toast/lib/ToastLink.tsx +17 -0
  63. package/toast/lib/ToastMessage.tsx +24 -0
  64. package/toast/lib/hooks/useToastModel.tsx +29 -0
@@ -0,0 +1,37 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.useToastModel = void 0;
15
+ var common_1 = require("@workday/canvas-kit-react/common");
16
+ exports.useToastModel = common_1.createModelHook({
17
+ defaultConfig: {
18
+ /**
19
+ * Sets the correct aria attributes for the Toast.
20
+ * Alert toasts are used to convey urgency and important information. The `role` is set to `alert`
21
+ * Status toasts are used to convey a message or a successful action. The `role` is set to `status`
22
+ * Dialog toasts are used when there's an action to be taken. The `role` is set to `dialog`.
23
+ * If you use this mode, you must add an aria-label to the main `Toast` component.
24
+ * The aria-label should provide additional information to the contents of the `Toast`.
25
+ * @default 'status'
26
+ */
27
+ mode: 'status',
28
+ /**
29
+ * 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.
30
+ */
31
+ id: '',
32
+ },
33
+ })(function (config) {
34
+ var id = common_1.useUniqueId(config.id);
35
+ var state = __assign(__assign({}, config), { id: id });
36
+ return { state: state, events: {} };
37
+ });
@@ -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,EAIL,YAAY,EACb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,cAAc,EAAC,MAAM,kCAAkC,CAAC;AAMhE,MAAM,WAAW,mBAAoB,SAAQ,YAAY,CAAC,OAAO,cAAc,EAAE,KAAK,CAAC;CAAG;AAQ1F,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;EAMzB,CAAC"}
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"}
@@ -22,20 +22,15 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  };
23
23
  import React from 'react';
24
24
  import { xIcon } from '@workday/canvas-system-icons-web';
25
- import { styled, createSubcomponent, } from '@workday/canvas-kit-react/common';
25
+ import { createSubcomponent } from '@workday/canvas-kit-react/common';
26
26
  import { TertiaryButton } from '@workday/canvas-kit-react/button';
27
+ import { space } from '@workday/canvas-kit-react/tokens';
27
28
  import { usePopupCloseButton, usePopupModel } from './hooks';
28
- var closeIconSpacing = 4;
29
- var StyledCloseIcon = styled(TertiaryButton)({
30
- position: 'absolute',
31
- right: closeIconSpacing,
32
- top: closeIconSpacing,
33
- });
34
29
  export var PopupCloseIcon = createSubcomponent('button')({
35
30
  displayName: 'Popup.CloseIcon',
36
31
  modelHook: usePopupModel,
37
32
  elemPropsHook: usePopupCloseButton,
38
33
  })(function (_a, Element) {
39
34
  var children = _a.children, elemProps = __rest(_a, ["children"]);
40
- return React.createElement(StyledCloseIcon, __assign({ as: Element, size: "medium", icon: xIcon, type: "button" }, elemProps));
35
+ return (React.createElement(TertiaryButton, __assign({ as: Element, size: "medium", icon: xIcon, type: "button", position: "absolute", right: space.xxxs, top: space.xxxs }, elemProps)));
41
36
  });
@@ -1,2 +1,3 @@
1
1
  export * from './lib/Toast';
2
+ export * from './lib/hooks/useToastModel';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -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 +1,2 @@
1
1
  export * from './lib/Toast';
2
+ export * from './lib/hooks/useToastModel';
@@ -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
- export interface ToastProps extends ExtractProps<typeof Popup.Card, never> {
6
- /**
7
- * The icon of the Toast.
8
- * @default checkIcon
9
- */
10
- icon?: CanvasSystemIcon;
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
- * The color of the Toast icon.
13
- * @default colors.greenApple400
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
- iconColor?: CanvasColor | string;
43
+ Body: import("@workday/canvas-kit-react/common").ElementComponent<"div", import("./ToastBody").ToastBodyProps>;
16
44
  /**
17
- * The text of the Toast message.
45
+ * `Toast.CloseIcon` renders a {@link PopupCloseIcon}. You can pass an `onClick` when used with `Popper` to dismiss the `Toast`.
18
46
  */
19
- children: string;
47
+ CloseIcon: import("@workday/canvas-kit-react/common").ElementComponent<"button", import("./ToastCloseIcon").ToastCloseIconProps>;
20
48
  /**
21
- * The function called when the Toast is closed.
49
+ * `ToastIcon` renders a `SystemIcon` where you have access to all styling properties from `SystemIcon`.
22
50
  */
23
- onClose?: () => void;
51
+ Icon: import("@workday/canvas-kit-react/common").ElementComponent<"div", import("./ToastIcon").ToastIconProps>;
24
52
  /**
25
- * The function called when the Toast action is clicked.
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
- onActionClick?: () => void;
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
- * The text of the Toast action.
64
+ * `Toast.Link` renders our `Hyperlink` component. If you need to link to more information, use this component.
30
65
  */
31
- actionText?: string;
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,EAAC,KAAK,EAAC,MAAM,iCAAiC,CAAC;AACtD,OAAO,EAAsB,WAAW,EAAC,MAAM,kCAAkC,CAAC;AAGlF,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAkB,YAAY,EAAqB,MAAM,kCAAkC,CAAC;AAGnG,MAAM,WAAW,UAAW,SAAQ,YAAY,CAAC,OAAO,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;IACxE;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IACjC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAiCD,eAAO,MAAM,KAAK,gFA+ChB,CAAC"}
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"}
@@ -20,44 +20,99 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  }
21
21
  return t;
22
22
  };
23
- import * as React from 'react';
23
+ import React from 'react';
24
+ import { createContainer } from '@workday/canvas-kit-react/common';
25
+ import { Flex } from '@workday/canvas-kit-react/layout';
24
26
  import { Popup } from '@workday/canvas-kit-react/popup';
25
- import { space, colors, type } from '@workday/canvas-kit-react/tokens';
26
- import { SystemIcon } from '@workday/canvas-kit-react/icon';
27
- import { checkIcon, exclamationCircleIcon } from '@workday/canvas-system-icons-web';
28
- import { createComponent, styled } from '@workday/canvas-kit-react/common';
29
- import { Hyperlink } from '@workday/canvas-kit-react/button';
30
- var toastWidth = 360;
31
- var ToastContentContainer = styled('div')(__assign({ display: 'flex', alignItems: 'center' }, type.levels.subtext.large), function (_a) {
32
- var onClose = _a.onClose;
33
- return ({
34
- marginRight: onClose ? space.m : undefined,
35
- });
36
- });
37
- var ToastSystemIcon = styled(SystemIcon)({
38
- marginRight: space.s,
39
- alignSelf: 'start',
40
- });
41
- var _a = type.levels.subtext.large, color = _a.color, subTextLargeStyles = __rest(_a, ["color"]);
42
- var StyledActionButton = styled(Hyperlink)(__assign(__assign({}, subTextLargeStyles), { display: 'block', backgroundColor: 'transparent', border: 'none', marginTop: space.xxxs }));
43
- var Message = styled('div')({
44
- wordBreak: 'break-word',
45
- });
46
- export var Toast = createComponent('div')({
27
+ import { ToastCloseIcon } from './ToastCloseIcon';
28
+ import { ToastIcon } from './ToastIcon';
29
+ import { ToastMessage } from './ToastMessage';
30
+ import { ToastLink } from './ToastLink';
31
+ import { ToastBody } from './ToastBody';
32
+ import { useToastModel } from './hooks/useToastModel';
33
+ /**
34
+ * The function helps set the correct aria attributes based on the mode
35
+ * @param mode Defines what aria attributes will be added to the main container
36
+ * @param id Used to tie the Toast to Toast.Message for screen readers
37
+ */
38
+ var getAriaAttributes = function (mode, id) {
39
+ switch (mode) {
40
+ case 'dialog':
41
+ return {
42
+ 'aria-describedby': id,
43
+ // This is added by Popup.Card, so overwriting to remove it
44
+ 'aria-labelledby': undefined,
45
+ role: 'dialog',
46
+ };
47
+ case 'alert':
48
+ return {
49
+ role: 'alert',
50
+ 'aria-live': 'assertive',
51
+ 'aria-atomic': true,
52
+ };
53
+ case 'status':
54
+ return {
55
+ role: 'status',
56
+ 'aria-live': 'polite',
57
+ 'aria-atomic': true,
58
+ };
59
+ default: {
60
+ return {};
61
+ }
62
+ }
63
+ };
64
+ /**
65
+ * Toast is a compound component that has different modes based on its contents. The modes add the proper aria attributes for accessibility
66
+ *
67
+ * ```tsx
68
+ * import { Toast } from "@workday/canvas-kit-react/toast";
69
+ *
70
+ * const MyToast = (props: CardProps) => (
71
+ * <Toast mode="dialog" aria-label="notifcation">
72
+ * <Toast.Icon icon={checkIcon} color={colors.greenApple400} />
73
+ * <Toast.Body>
74
+ * <Toast.Message>Your workbook was successfully processed.</Toast.Message>
75
+ * <Toast.Link href="#hreflink">Custom Link</Toast.Link>
76
+ * </Toast.Body>
77
+ * <Toast.CloseIcon aria-label="Close" onClick={handleClose} />
78
+ * </Toast>
79
+ * );
80
+ *```
81
+ */
82
+ export var Toast = createContainer('div')({
47
83
  displayName: 'Toast',
48
- Component: function (_a, ref, Element) {
49
- var _b = _a.icon, icon = _b === void 0 ? checkIcon : _b, // needed for TS2742 - https://github.com/microsoft/TypeScript/issues/29808
50
- _c = _a.iconColor, // needed for TS2742 - https://github.com/microsoft/TypeScript/issues/29808
51
- iconColor = _c === void 0 ? colors.greenApple400 : _c, onClose = _a.onClose, onActionClick = _a.onActionClick, actionText = _a.actionText, children = _a.children, elemProps = __rest(_a, ["icon", "iconColor", "onClose", "onActionClick", "actionText", "children"]);
52
- var isInteractive = onClose || onActionClick;
53
- var isError = iconColor === colors.cinnamon500 && icon === exclamationCircleIcon;
54
- return (React.createElement(Popup.Card, __assign({ ref: ref, as: Element, width: toastWidth, depth: 5, role: isInteractive ? 'dialog' : isError ? 'alert' : 'status', "aria-live": isInteractive ? 'off' : isError ? 'assertive' : 'polite', "aria-atomic": !isInteractive, padding: "xxs" }, elemProps),
55
- onClose && React.createElement(Popup.CloseIcon, { "aria-label": "Close", onClick: onClose, size: "small" }),
56
- React.createElement(Popup.Body, null,
57
- React.createElement(ToastContentContainer, { onClose: onClose },
58
- icon && React.createElement(ToastSystemIcon, { color: iconColor, colorHover: iconColor, icon: icon }),
59
- React.createElement(Message, null,
60
- children,
61
- onActionClick && (React.createElement(StyledActionButton, { as: "button", onClick: onActionClick }, actionText)))))));
84
+ modelHook: useToastModel,
85
+ subComponents: {
86
+ /**
87
+ * `Toast.Body` should container `Toast.Message` and `Toast.Link`. This ensures proper styling and spacing between elements.
88
+ *
89
+ * ```tsx
90
+ * <Toast.Body>
91
+ * <Toast.Message>Your workbook was successfully processed.</Toast.Message>
92
+ * <Toast.Link href="#hreflink">Custom Link</Toast.Link>
93
+ * </Toast.Body>
94
+ * ```
95
+ */
96
+ Body: ToastBody,
97
+ /**
98
+ * `Toast.CloseIcon` renders a {@link PopupCloseIcon}. You can pass an `onClick` when used with `Popper` to dismiss the `Toast`.
99
+ */
100
+ CloseIcon: ToastCloseIcon,
101
+ /**
102
+ * `ToastIcon` renders a `SystemIcon` where you have access to all styling properties from `SystemIcon`.
103
+ */
104
+ Icon: ToastIcon,
105
+ /**
106
+ * `Toast.Message` renders our `Subtext` component where you can style however way you'd like with style properties.
107
+ * 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.
108
+ */
109
+ Message: ToastMessage,
110
+ /**
111
+ * `Toast.Link` renders our `Hyperlink` component. If you need to link to more information, use this component.
112
+ */
113
+ Link: ToastLink,
62
114
  },
115
+ })(function (_a, _, model) {
116
+ var children = _a.children, elemProps = __rest(_a, ["children"]);
117
+ return (React.createElement(Popup.Card, __assign({ as: Flex, width: 360, padding: "0" }, getAriaAttributes(model.state.mode, model.state.id), { flexDirection: "row", gap: "xxxs" }, elemProps), children));
63
118
  });
@@ -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,32 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import React from 'react';
24
+ import { createComponent } from '@workday/canvas-kit-react/common';
25
+ import { Flex } from '@workday/canvas-kit-react/layout';
26
+ export var ToastBody = createComponent('div')({
27
+ displayName: 'Toast.Body',
28
+ Component: function (_a, ref, Element) {
29
+ var children = _a.children, elemProps = __rest(_a, ["children"]);
30
+ return (React.createElement(Flex, __assign({ alignItems: "flex-start", flexDirection: "column", justifyContent: "center", paddingY: "s", ref: ref, as: Element, flexGrow: 1, gap: "xxxs" }, elemProps), children));
31
+ },
32
+ });
@@ -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,20 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import React from 'react';
13
+ import { createComponent } from '@workday/canvas-kit-react/common';
14
+ import { Popup } from '@workday/canvas-kit-react/popup';
15
+ export var ToastCloseIcon = createComponent('button')({
16
+ displayName: 'Toast.CloseIcon',
17
+ Component: function (elemProps, ref, Element) {
18
+ return (React.createElement(Popup.CloseIcon, __assign({ as: Element, ref: ref, size: "small", position: "relative" }, elemProps)));
19
+ },
20
+ });
@@ -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,20 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import React from 'react';
13
+ import { createComponent } from '@workday/canvas-kit-react/common';
14
+ import { SystemIcon } from '@workday/canvas-kit-react/icon';
15
+ export var ToastIcon = createComponent('div')({
16
+ displayName: 'Toast.Icon',
17
+ Component: function (elemProps, ref, Element) {
18
+ return (React.createElement(SystemIcon, __assign({ colorHover: elemProps.color, marginY: "s", marginX: "xs", alignSelf: "start", ref: ref, as: Element }, elemProps)));
19
+ },
20
+ });
@@ -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,32 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import React from 'react';
24
+ import { createComponent } from '@workday/canvas-kit-react/common';
25
+ import { Hyperlink } from '@workday/canvas-kit-react/button';
26
+ export var ToastLink = createComponent('a')({
27
+ displayName: 'Toast.Link',
28
+ Component: function (_a, ref, Element) {
29
+ var children = _a.children, href = _a.href, elemProps = __rest(_a, ["children", "href"]);
30
+ return (React.createElement(Hyperlink, __assign({ ref: ref, href: href, as: Element }, elemProps), children));
31
+ },
32
+ });
@@ -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,32 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import React from 'react';
24
+ import { createSubcomponent } from '@workday/canvas-kit-react/common';
25
+ import { useToastModel } from './hooks/useToastModel';
26
+ import { Subtext } from '@workday/canvas-kit-react/text';
27
+ export var ToastMessage = createSubcomponent('p')({
28
+ modelHook: useToastModel,
29
+ })(function (_a, Element, model) {
30
+ var children = _a.children, elemProps = __rest(_a, ["children"]);
31
+ return (React.createElement(Subtext, __assign({ size: "large", wordBreak: "break-word", marginY: "zero", id: model.state.id, as: Element }, elemProps), children));
32
+ });
@@ -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"}