@workday/canvas-kit-labs-react 8.0.0-alpha.172-next.1 → 8.0.0-alpha.178-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 (67) hide show
  1. package/dist/commonjs/index.d.ts +1 -0
  2. package/dist/commonjs/index.d.ts.map +1 -1
  3. package/dist/commonjs/index.js +1 -0
  4. package/dist/commonjs/toast/index.d.ts +3 -0
  5. package/dist/commonjs/toast/index.d.ts.map +1 -0
  6. package/dist/commonjs/toast/index.js +14 -0
  7. package/dist/commonjs/toast/lib/Toast.d.ts +36 -0
  8. package/dist/commonjs/toast/lib/Toast.d.ts.map +1 -0
  9. package/dist/commonjs/toast/lib/Toast.js +78 -0
  10. package/dist/commonjs/toast/lib/ToastBody.d.ts +6 -0
  11. package/dist/commonjs/toast/lib/ToastBody.d.ts.map +1 -0
  12. package/dist/commonjs/toast/lib/ToastBody.js +40 -0
  13. package/dist/commonjs/toast/lib/ToastCloseIcon.d.ts +6 -0
  14. package/dist/commonjs/toast/lib/ToastCloseIcon.d.ts.map +1 -0
  15. package/dist/commonjs/toast/lib/ToastCloseIcon.js +43 -0
  16. package/dist/commonjs/toast/lib/ToastIcon.d.ts +5 -0
  17. package/dist/commonjs/toast/lib/ToastIcon.d.ts.map +1 -0
  18. package/dist/commonjs/toast/lib/ToastIcon.js +26 -0
  19. package/dist/commonjs/toast/lib/ToastLink.d.ts +9 -0
  20. package/dist/commonjs/toast/lib/ToastLink.d.ts.map +1 -0
  21. package/dist/commonjs/toast/lib/ToastLink.js +42 -0
  22. package/dist/commonjs/toast/lib/ToastMessage.d.ts +11 -0
  23. package/dist/commonjs/toast/lib/ToastMessage.d.ts.map +1 -0
  24. package/dist/commonjs/toast/lib/ToastMessage.js +43 -0
  25. package/dist/commonjs/toast/lib/hooks/useToastModel.d.ts +65 -0
  26. package/dist/commonjs/toast/lib/hooks/useToastModel.d.ts.map +1 -0
  27. package/dist/commonjs/toast/lib/hooks/useToastModel.js +35 -0
  28. package/dist/es6/index.d.ts +1 -0
  29. package/dist/es6/index.d.ts.map +1 -1
  30. package/dist/es6/index.js +1 -0
  31. package/dist/es6/toast/index.d.ts +3 -0
  32. package/dist/es6/toast/index.d.ts.map +1 -0
  33. package/dist/es6/toast/index.js +2 -0
  34. package/dist/es6/toast/lib/Toast.d.ts +36 -0
  35. package/dist/es6/toast/lib/Toast.d.ts.map +1 -0
  36. package/dist/es6/toast/lib/Toast.js +72 -0
  37. package/dist/es6/toast/lib/ToastBody.d.ts +6 -0
  38. package/dist/es6/toast/lib/ToastBody.d.ts.map +1 -0
  39. package/dist/es6/toast/lib/ToastBody.js +34 -0
  40. package/dist/es6/toast/lib/ToastCloseIcon.d.ts +6 -0
  41. package/dist/es6/toast/lib/ToastCloseIcon.d.ts.map +1 -0
  42. package/dist/es6/toast/lib/ToastCloseIcon.js +37 -0
  43. package/dist/es6/toast/lib/ToastIcon.d.ts +5 -0
  44. package/dist/es6/toast/lib/ToastIcon.d.ts.map +1 -0
  45. package/dist/es6/toast/lib/ToastIcon.js +20 -0
  46. package/dist/es6/toast/lib/ToastLink.d.ts +9 -0
  47. package/dist/es6/toast/lib/ToastLink.d.ts.map +1 -0
  48. package/dist/es6/toast/lib/ToastLink.js +36 -0
  49. package/dist/es6/toast/lib/ToastMessage.d.ts +11 -0
  50. package/dist/es6/toast/lib/ToastMessage.d.ts.map +1 -0
  51. package/dist/es6/toast/lib/ToastMessage.js +37 -0
  52. package/dist/es6/toast/lib/hooks/useToastModel.d.ts +65 -0
  53. package/dist/es6/toast/lib/hooks/useToastModel.d.ts.map +1 -0
  54. package/dist/es6/toast/lib/hooks/useToastModel.js +32 -0
  55. package/index.ts +1 -0
  56. package/package.json +3 -3
  57. package/toast/LICENSE +52 -0
  58. package/toast/README.md +5 -0
  59. package/toast/index.ts +2 -0
  60. package/toast/lib/Toast.tsx +63 -0
  61. package/toast/lib/ToastBody.tsx +34 -0
  62. package/toast/lib/ToastCloseIcon.tsx +18 -0
  63. package/toast/lib/ToastIcon.tsx +24 -0
  64. package/toast/lib/ToastLink.tsx +27 -0
  65. package/toast/lib/ToastMessage.tsx +23 -0
  66. package/toast/lib/hooks/useToastModel.tsx +27 -0
  67. package/toast/package.json +6 -0
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+
3
+ import {createComponent} from '@workday/canvas-kit-react/common';
4
+ import {SystemIcon, SystemIconProps} from '@workday/canvas-kit-react/icon';
5
+
6
+ export interface ToastIconProps extends Omit<SystemIconProps, 'colorHover'> {}
7
+
8
+ export const ToastIcon = createComponent('div')({
9
+ displayName: 'Toast.Icon',
10
+ Component: (elemProps: ToastIconProps, ref, Element) => {
11
+ return (
12
+ <SystemIcon
13
+ colorHover={elemProps.color}
14
+ marginY="s"
15
+ marginInlineEnd="xs"
16
+ marginInlineStart="xs"
17
+ alignSelf="start"
18
+ ref={ref}
19
+ as={Element}
20
+ {...elemProps}
21
+ />
22
+ );
23
+ },
24
+ });
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+
3
+ import {createComponent, styled, StyledType} from '@workday/canvas-kit-react/common';
4
+ import {Hyperlink, HyperlinkProps} from '@workday/canvas-kit-react/button';
5
+ import {space} from '@workday/canvas-kit-react/tokens';
6
+
7
+ export interface ToastLinkProps extends HyperlinkProps {
8
+ /**
9
+ * attribute for the hyperlink URL
10
+ */
11
+ href: string;
12
+ }
13
+
14
+ const StyledHyperLink = styled(Hyperlink)<StyledType>({
15
+ marginTop: space.xxxs,
16
+ });
17
+
18
+ export const ToastLink = createComponent('a')({
19
+ displayName: 'Toast.Link',
20
+ Component: ({children, href, ...elemProps}: ToastLinkProps, ref, Element) => {
21
+ return (
22
+ <StyledHyperLink ref={ref} href={href} as={Element} {...elemProps}>
23
+ {children}
24
+ </StyledHyperLink>
25
+ );
26
+ },
27
+ });
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+
3
+ import {createSubcomponent, styled, StyledType} from '@workday/canvas-kit-react/common';
4
+ import {Flex, FlexProps} from '@workday/canvas-kit-react/layout';
5
+ import {useToastModel} from './hooks/useToastModel';
6
+
7
+ export interface ToastMessageProps extends FlexProps {}
8
+
9
+ const StyledMessage = styled(Flex)<StyledType>({
10
+ wordBreak: 'break-word',
11
+ // TODO: Remove once we officially drop support for IE11
12
+ wordWrap: 'break-word', // Needed for IE11
13
+ });
14
+
15
+ export const ToastMessage = createSubcomponent('div')({
16
+ modelHook: useToastModel,
17
+ })<ToastMessageProps>(({children, ...elemProps}, Element, model) => {
18
+ return (
19
+ <StyledMessage flexDirection="column" id={model.state.id} as={Element} {...elemProps}>
20
+ {children}
21
+ </StyledMessage>
22
+ );
23
+ });
@@ -0,0 +1,27 @@
1
+ import {createModelHook, useUniqueId} from '@workday/canvas-kit-react/common';
2
+ export type AriaRoleMode = 'dialog' | 'status' | 'alert';
3
+
4
+ export const useToastModel = createModelHook({
5
+ defaultConfig: {
6
+ /**
7
+ * Sets the correct aria attributes for the Toast.
8
+ * Alert toasts are used to convey urgency and important information. The `role` is set to `alert`
9
+ * Status toasts are used to convey a message or a successful action. The `role` is set to `status`
10
+ * Dialog toasts are used when there's an action to be taken. The `role` is set to `dialog`
11
+ * @default 'status'
12
+ */
13
+ mode: 'status' as AriaRoleMode,
14
+ /**
15
+ * When the Toast has a `mode="dialog"` this adds a unique id to type the `Toast.Message` to the dialog.
16
+ */
17
+ id: '',
18
+ },
19
+ })(config => {
20
+ const id = useUniqueId(config.id);
21
+ const state = {
22
+ ...config,
23
+ id,
24
+ };
25
+
26
+ return {state, events: {}};
27
+ });
@@ -0,0 +1,6 @@
1
+ {
2
+ "main": "../dist/commonjs/toast",
3
+ "module": "../dist/es6/toast",
4
+ "sideEffects": false,
5
+ "types": "../dist/es6/toast"
6
+ }