@zendeskgarden/react-notifications 9.0.0-next.2 → 9.0.0-next.20

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 (68) hide show
  1. package/README.md +6 -4
  2. package/dist/esm/elements/Alert.js +56 -0
  3. package/dist/esm/elements/Notification.js +55 -0
  4. package/dist/esm/elements/Well.js +47 -0
  5. package/dist/esm/elements/content/Close.js +40 -0
  6. package/dist/esm/elements/content/Paragraph.js +28 -0
  7. package/dist/esm/elements/content/Title.js +35 -0
  8. package/dist/esm/elements/global-alert/GlobalAlert.js +78 -0
  9. package/dist/esm/elements/global-alert/GlobalAlertButton.js +47 -0
  10. package/dist/esm/elements/global-alert/GlobalAlertClose.js +43 -0
  11. package/dist/esm/elements/global-alert/GlobalAlertContent.js +30 -0
  12. package/dist/esm/elements/global-alert/GlobalAlertTitle.js +44 -0
  13. package/dist/esm/elements/toaster/Toast.js +62 -0
  14. package/dist/esm/elements/toaster/ToastContext.js +11 -0
  15. package/dist/esm/elements/toaster/ToastProvider.js +51 -0
  16. package/dist/esm/elements/toaster/ToastSlot.js +82 -0
  17. package/dist/esm/elements/toaster/reducer.js +66 -0
  18. package/dist/esm/elements/toaster/styled.js +71 -0
  19. package/dist/esm/elements/toaster/useToast.js +70 -0
  20. package/dist/esm/index.js +15 -0
  21. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/alert-error-stroke.svg.js +37 -0
  22. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/alert-warning-stroke.svg.js +32 -0
  23. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/check-circle-stroke.svg.js +33 -0
  24. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/info-stroke.svg.js +37 -0
  25. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/x-stroke.svg.js +26 -0
  26. package/dist/esm/styled/StyledAlert.js +51 -0
  27. package/dist/esm/styled/StyledBase.js +92 -0
  28. package/dist/esm/styled/StyledIcon.js +61 -0
  29. package/dist/esm/styled/StyledNotification.js +56 -0
  30. package/dist/esm/styled/StyledWell.js +47 -0
  31. package/dist/esm/styled/content/StyledClose.js +70 -0
  32. package/dist/esm/styled/content/StyledParagraph.js +22 -0
  33. package/dist/esm/styled/content/StyledTitle.js +25 -0
  34. package/dist/esm/styled/global-alert/StyledGlobalAlert.js +160 -0
  35. package/dist/esm/styled/global-alert/StyledGlobalAlertButton.js +118 -0
  36. package/dist/esm/styled/global-alert/StyledGlobalAlertClose.js +103 -0
  37. package/dist/esm/styled/global-alert/StyledGlobalAlertContent.js +22 -0
  38. package/dist/esm/styled/global-alert/StyledGlobalAlertIcon.js +65 -0
  39. package/dist/esm/styled/global-alert/StyledGlobalAlertTitle.js +49 -0
  40. package/dist/esm/types/index.js +9 -0
  41. package/dist/esm/utils/icons.js +25 -0
  42. package/dist/esm/utils/useGlobalAlertContext.js +14 -0
  43. package/dist/esm/utils/useNotificationsContext.js +14 -0
  44. package/dist/index.cjs.js +811 -440
  45. package/dist/typings/elements/Alert.d.ts +9 -1
  46. package/dist/typings/elements/Notification.d.ts +9 -1
  47. package/dist/typings/elements/Well.d.ts +7 -1
  48. package/dist/typings/elements/content/Close.d.ts +2 -0
  49. package/dist/typings/elements/content/Paragraph.d.ts +2 -0
  50. package/dist/typings/elements/content/Title.d.ts +2 -0
  51. package/dist/typings/index.d.ts +2 -6
  52. package/dist/typings/styled/StyledAlert.d.ts +8 -3
  53. package/dist/typings/styled/StyledBase.d.ts +8 -6
  54. package/dist/typings/styled/StyledIcon.d.ts +11 -2
  55. package/dist/typings/styled/StyledNotification.d.ts +11 -3
  56. package/dist/typings/styled/StyledWell.d.ts +7 -2
  57. package/dist/typings/styled/content/StyledClose.d.ts +5 -3
  58. package/dist/typings/styled/content/StyledTitle.d.ts +1 -1
  59. package/dist/typings/styled/global-alert/StyledGlobalAlert.d.ts +1 -1
  60. package/dist/typings/styled/global-alert/StyledGlobalAlertButton.d.ts +4 -11
  61. package/dist/typings/styled/global-alert/StyledGlobalAlertClose.d.ts +2 -3
  62. package/dist/typings/styled/global-alert/StyledGlobalAlertIcon.d.ts +2 -2
  63. package/dist/typings/styled/global-alert/StyledGlobalAlertTitle.d.ts +2 -2
  64. package/dist/typings/utils/icons.d.ts +1 -1
  65. package/dist/typings/{elements/global-alert/utility.d.ts → utils/useGlobalAlertContext.d.ts} +1 -1
  66. package/dist/typings/utils/useNotificationsContext.d.ts +2 -3
  67. package/package.json +9 -9
  68. package/dist/index.esm.js +0 -1124
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import styled, { css } from 'styled-components';
8
+ import { math } from 'polished';
9
+ import { StyledBaseIcon, retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
10
+
11
+ const COMPONENT_ID = 'notifications.global_alert.icon';
12
+ const sizeStyles = props => {
13
+ const size = props.theme.iconSizes.md;
14
+ const marginTop = math(`(${props.theme.space.base * 5} - ${size}) / 2`);
15
+ const marginHorizontal = `${props.theme.space.base * 2}px`;
16
+ return css(["margin-top:", ";margin-", ":", ";width:", ";height:", ";"], marginTop, props.theme.rtl ? 'left' : 'right', marginHorizontal, size, size);
17
+ };
18
+ const colorStyles = _ref => {
19
+ let {
20
+ theme,
21
+ $alertType
22
+ } = _ref;
23
+ let color;
24
+ switch ($alertType) {
25
+ case 'success':
26
+ color = getColor({
27
+ variable: 'foreground.success',
28
+ offset: -400,
29
+ theme
30
+ });
31
+ break;
32
+ case 'error':
33
+ color = getColor({
34
+ variable: 'foreground.danger',
35
+ offset: -400,
36
+ theme
37
+ });
38
+ break;
39
+ case 'warning':
40
+ color = getColor({
41
+ variable: 'foreground.warning',
42
+ theme
43
+ });
44
+ break;
45
+ case 'info':
46
+ color = getColor({
47
+ variable: 'foreground.primary',
48
+ theme
49
+ });
50
+ break;
51
+ }
52
+ return css(["color:", ";"], color);
53
+ };
54
+ const StyledGlobalAlertIcon = styled(StyledBaseIcon).attrs({
55
+ 'data-garden-id': COMPONENT_ID,
56
+ 'data-garden-version': '9.0.0-next.20'
57
+ }).withConfig({
58
+ displayName: "StyledGlobalAlertIcon",
59
+ componentId: "sc-84ne9k-0"
60
+ })(["flex-shrink:0;", ";", ";", ";"], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
61
+ StyledGlobalAlertIcon.defaultProps = {
62
+ theme: DEFAULT_THEME
63
+ };
64
+
65
+ export { StyledGlobalAlertIcon };
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import styled, { css } from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'notifications.global_alert.title';
11
+ const colorStyles = _ref => {
12
+ let {
13
+ theme,
14
+ $alertType
15
+ } = _ref;
16
+ let color;
17
+ switch ($alertType) {
18
+ case 'success':
19
+ case 'error':
20
+ color = theme.palette.white;
21
+ break;
22
+ case 'warning':
23
+ color = getColor({
24
+ variable: 'foreground.warningEmphasis',
25
+ theme
26
+ });
27
+ break;
28
+ case 'info':
29
+ color = getColor({
30
+ variable: 'foreground.primary',
31
+ offset: 200,
32
+ theme
33
+ });
34
+ break;
35
+ }
36
+ return css(["color:", ";"], color);
37
+ };
38
+ const StyledGlobalAlertTitle = styled.div.attrs({
39
+ 'data-garden-id': COMPONENT_ID,
40
+ 'data-garden-version': '9.0.0-next.20'
41
+ }).withConfig({
42
+ displayName: "StyledGlobalAlertTitle",
43
+ componentId: "sc-10clqbo-0"
44
+ })(["display:inline;margin-", ":", "px;font-weight:", ";", ";", ";"], props => props.theme.rtl ? 'left' : 'right', props => props.theme.space.base * 2, props => props.$isRegular ? props.theme.fontWeights.regular : props.theme.fontWeights.semibold, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
45
+ StyledGlobalAlertTitle.defaultProps = {
46
+ theme: DEFAULT_THEME
47
+ };
48
+
49
+ export { StyledGlobalAlertTitle };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ const TYPE = ['success', 'warning', 'error', 'info'];
8
+
9
+ export { TYPE };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import SvgAlertErrorStroke from '../node_modules/@zendeskgarden/svg-icons/src/16/alert-error-stroke.svg.js';
8
+ import SvgCheckCircleStroke from '../node_modules/@zendeskgarden/svg-icons/src/16/check-circle-stroke.svg.js';
9
+ import SvgAlertWarningStroke from '../node_modules/@zendeskgarden/svg-icons/src/16/alert-warning-stroke.svg.js';
10
+ import SvgInfoStroke from '../node_modules/@zendeskgarden/svg-icons/src/16/info-stroke.svg.js';
11
+
12
+ const validationIcons = {
13
+ success: SvgCheckCircleStroke,
14
+ error: SvgAlertErrorStroke,
15
+ warning: SvgAlertWarningStroke,
16
+ info: SvgInfoStroke
17
+ };
18
+ const validationTypes = {
19
+ success: 'success',
20
+ error: 'error',
21
+ warning: 'warning',
22
+ info: 'info'
23
+ };
24
+
25
+ export { validationIcons, validationTypes };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import { createContext, useContext } from 'react';
8
+
9
+ const GlobalAlertContext = createContext({
10
+ type: 'info'
11
+ });
12
+ const useGlobalAlertContext = () => useContext(GlobalAlertContext);
13
+
14
+ export { GlobalAlertContext, useGlobalAlertContext };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import { createContext, useContext } from 'react';
8
+
9
+ const NotificationsContext = createContext(undefined);
10
+ const useNotificationsContext = () => {
11
+ return useContext(NotificationsContext);
12
+ };
13
+
14
+ export { NotificationsContext, useNotificationsContext };