@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,61 @@
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 { StyledBaseIcon, retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
9
+ import { validationTypes } from '../utils/icons.js';
10
+
11
+ const COMPONENT_ID = 'notifications.icon';
12
+ const sizeStyles = _ref => {
13
+ let {
14
+ theme: {
15
+ rtl,
16
+ space
17
+ }
18
+ } = _ref;
19
+ return css(["right:", ";left:", ";margin-top:", "px;"], rtl && `${space.base * 4}px`, !rtl && `${space.base * 4}px`, space.base / 2);
20
+ };
21
+ const colorStyles = _ref2 => {
22
+ let {
23
+ theme,
24
+ $type
25
+ } = _ref2;
26
+ let variable;
27
+ switch ($type) {
28
+ case validationTypes.success:
29
+ variable = 'foreground.success';
30
+ break;
31
+ case validationTypes.error:
32
+ variable = 'foreground.danger';
33
+ break;
34
+ case validationTypes.warning:
35
+ variable = 'foreground.warning';
36
+ break;
37
+ case validationTypes.info:
38
+ variable = 'foreground.subtle';
39
+ break;
40
+ default:
41
+ variable = 'foreground.default';
42
+ break;
43
+ }
44
+ const color = getColor({
45
+ variable,
46
+ theme
47
+ });
48
+ return css(["color:", ";"], color);
49
+ };
50
+ const StyledIcon = styled(StyledBaseIcon).attrs({
51
+ 'data-garden-id': COMPONENT_ID,
52
+ 'data-garden-version': '9.0.0-next.20'
53
+ }).withConfig({
54
+ displayName: "StyledIcon",
55
+ componentId: "sc-msklws-0"
56
+ })(["position:absolute;", " ", " ", ""], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
57
+ StyledIcon.defaultProps = {
58
+ theme: DEFAULT_THEME
59
+ };
60
+
61
+ export { StyledIcon };
@@ -0,0 +1,56 @@
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 PropTypes from 'prop-types';
8
+ import styled, { css } from 'styled-components';
9
+ import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
10
+ import { TYPE } from '../types/index.js';
11
+ import { StyledTitle } from './content/StyledTitle.js';
12
+ import { StyledBase } from './StyledBase.js';
13
+ import { validationTypes } from '../utils/icons.js';
14
+
15
+ const COMPONENT_ID = 'notifications.notification';
16
+ const colorStyles = props => {
17
+ const {
18
+ $type,
19
+ theme
20
+ } = props;
21
+ let variable;
22
+ switch ($type) {
23
+ case validationTypes.success:
24
+ variable = 'foreground.success';
25
+ break;
26
+ case validationTypes.error:
27
+ variable = 'foreground.danger';
28
+ break;
29
+ case validationTypes.warning:
30
+ variable = 'foreground.warning';
31
+ break;
32
+ case validationTypes.info:
33
+ variable = 'foreground.default';
34
+ break;
35
+ }
36
+ const color = variable ? getColor({
37
+ variable,
38
+ theme
39
+ }) : 'inherit';
40
+ return css(["", "{color:", ";}"], StyledTitle, color);
41
+ };
42
+ const StyledNotification = styled(StyledBase).attrs({
43
+ 'data-garden-id': COMPONENT_ID,
44
+ 'data-garden-version': '9.0.0-next.20'
45
+ }).withConfig({
46
+ displayName: "StyledNotification",
47
+ componentId: "sc-uf6jh-0"
48
+ })(["", " ", ";"], colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
49
+ StyledNotification.propTypes = {
50
+ $type: PropTypes.oneOf(TYPE)
51
+ };
52
+ StyledNotification.defaultProps = {
53
+ theme: DEFAULT_THEME
54
+ };
55
+
56
+ export { StyledNotification };
@@ -0,0 +1,47 @@
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
+ import { StyledBase } from './StyledBase.js';
10
+
11
+ const COMPONENT_ID = 'notifications.well';
12
+ const colorStyles = _ref => {
13
+ let {
14
+ theme,
15
+ $isFloating,
16
+ $isRecessed
17
+ } = _ref;
18
+ let backgroundVariable;
19
+ if ($isRecessed) {
20
+ backgroundVariable = 'background.recessed';
21
+ } else if ($isFloating) {
22
+ backgroundVariable = 'background.raised';
23
+ } else {
24
+ backgroundVariable = 'background.default';
25
+ }
26
+ const foreground = getColor({
27
+ variable: 'foreground.subtle',
28
+ theme
29
+ });
30
+ const background = getColor({
31
+ variable: backgroundVariable,
32
+ theme
33
+ });
34
+ return css(["background-color:", ";color:", ";"], background, foreground);
35
+ };
36
+ const StyledWell = styled(StyledBase).attrs({
37
+ 'data-garden-id': COMPONENT_ID,
38
+ 'data-garden-version': '9.0.0-next.20'
39
+ }).withConfig({
40
+ displayName: "StyledWell",
41
+ componentId: "sc-a5831c-0"
42
+ })(["", " ", ";"], colorStyles, p => retrieveComponentStyles(COMPONENT_ID, p));
43
+ StyledWell.defaultProps = {
44
+ theme: DEFAULT_THEME
45
+ };
46
+
47
+ export { StyledWell };
@@ -0,0 +1,70 @@
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
+ import { validationTypes } from '../../utils/icons.js';
10
+ import { IconButton } from '@zendeskgarden/react-buttons';
11
+
12
+ const COMPONENT_ID = 'notifications.close';
13
+ const colorStyles = _ref => {
14
+ let {
15
+ theme,
16
+ $type
17
+ } = _ref;
18
+ let variable;
19
+ switch ($type) {
20
+ case validationTypes.warning:
21
+ variable = 'foreground.warning';
22
+ break;
23
+ case validationTypes.error:
24
+ variable = 'foreground.danger';
25
+ break;
26
+ case validationTypes.success:
27
+ variable = 'foreground.success';
28
+ break;
29
+ default:
30
+ variable = 'foreground.subtle';
31
+ break;
32
+ }
33
+ const color = getColor({
34
+ variable,
35
+ theme
36
+ });
37
+ const hoverColor = getColor({
38
+ variable,
39
+ light: {
40
+ offset: 100
41
+ },
42
+ dark: {
43
+ offset: -100
44
+ },
45
+ theme
46
+ });
47
+ const activeColor = getColor({
48
+ variable,
49
+ light: {
50
+ offset: 200
51
+ },
52
+ dark: {
53
+ offset: -200
54
+ },
55
+ theme
56
+ });
57
+ return css(["color:", ";&:hover{background-color:transparent;color:", ";}&:active{background-color:transparent;color:", ";}"], color, hoverColor, activeColor);
58
+ };
59
+ const StyledClose = styled(IconButton).attrs({
60
+ 'data-garden-id': COMPONENT_ID,
61
+ 'data-garden-version': '9.0.0-next.20'
62
+ }).withConfig({
63
+ displayName: "StyledClose",
64
+ componentId: "sc-1mr9nx1-0"
65
+ })(["position:absolute;top:", "px;right:", ";left:", ";", " ", ";"], props => props.theme.space.base, p => !p.theme.rtl && `${p.theme.space.base}px`, p => p.theme.rtl && `${p.theme.space.base}px`, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
66
+ StyledClose.defaultProps = {
67
+ theme: DEFAULT_THEME
68
+ };
69
+
70
+ export { StyledClose };
@@ -0,0 +1,22 @@
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 from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'notifications.paragraph';
11
+ const StyledParagraph = styled.p.attrs({
12
+ 'data-garden-id': COMPONENT_ID,
13
+ 'data-garden-version': '9.0.0-next.20'
14
+ }).withConfig({
15
+ displayName: "StyledParagraph",
16
+ componentId: "sc-12tmd6p-0"
17
+ })(["margin:", "px 0 0;", ";"], props => props.theme.space.base * 2, props => retrieveComponentStyles(COMPONENT_ID, props));
18
+ StyledParagraph.defaultProps = {
19
+ theme: DEFAULT_THEME
20
+ };
21
+
22
+ export { StyledParagraph };
@@ -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 styled from 'styled-components';
8
+ import { getColor, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'notifications.title';
11
+ const StyledTitle = styled.div.attrs({
12
+ 'data-garden-id': COMPONENT_ID,
13
+ 'data-garden-version': '9.0.0-next.20'
14
+ }).withConfig({
15
+ displayName: "StyledTitle",
16
+ componentId: "sc-xx4jsv-0"
17
+ })(["margin:0;color:", ";font-weight:", ";", ";"], p => getColor({
18
+ variable: 'foreground.default',
19
+ theme: p.theme
20
+ }), props => props.$isRegular ? props.theme.fontWeights.regular : props.theme.fontWeights.semibold, props => retrieveComponentStyles(COMPONENT_ID, props));
21
+ StyledTitle.defaultProps = {
22
+ theme: DEFAULT_THEME
23
+ };
24
+
25
+ export { StyledTitle };
@@ -0,0 +1,160 @@
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, focusStyles, getLineHeight } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'notifications.global_alert';
11
+ const colorStyles = _ref => {
12
+ let {
13
+ theme,
14
+ $alertType
15
+ } = _ref;
16
+ let borderColor;
17
+ let backgroundColor;
18
+ let foregroundColor;
19
+ let anchorHoverColor;
20
+ let anchorActiveColor;
21
+ let focusVariable;
22
+ switch ($alertType) {
23
+ case 'success':
24
+ {
25
+ borderColor = getColor({
26
+ variable: 'border.successEmphasis',
27
+ offset: 100,
28
+ theme
29
+ });
30
+ backgroundColor = getColor({
31
+ variable: 'background.successEmphasis',
32
+ theme
33
+ });
34
+ foregroundColor = getColor({
35
+ variable: 'foreground.success',
36
+ offset: -600,
37
+ theme
38
+ });
39
+ anchorHoverColor = theme.palette.white;
40
+ anchorActiveColor = theme.palette.white;
41
+ focusVariable = 'foreground.successEmphasis';
42
+ break;
43
+ }
44
+ case 'error':
45
+ {
46
+ borderColor = getColor({
47
+ variable: 'border.dangerEmphasis',
48
+ offset: 100,
49
+ theme
50
+ });
51
+ backgroundColor = getColor({
52
+ variable: 'background.dangerEmphasis',
53
+ theme
54
+ });
55
+ foregroundColor = getColor({
56
+ variable: 'foreground.danger',
57
+ offset: -600,
58
+ theme
59
+ });
60
+ anchorActiveColor = theme.palette.white;
61
+ anchorHoverColor = theme.palette.white;
62
+ focusVariable = 'foreground.dangerEmphasis';
63
+ break;
64
+ }
65
+ case 'warning':
66
+ {
67
+ borderColor = getColor({
68
+ variable: 'border.warningEmphasis',
69
+ offset: -300,
70
+ theme
71
+ });
72
+ backgroundColor = getColor({
73
+ variable: 'background.warningEmphasis',
74
+ offset: -400,
75
+ theme
76
+ });
77
+ const fgVariable = 'foreground.warning';
78
+ foregroundColor = getColor({
79
+ variable: fgVariable,
80
+ offset: 100,
81
+ theme
82
+ });
83
+ anchorHoverColor = getColor({
84
+ variable: fgVariable,
85
+ offset: 200,
86
+ theme
87
+ });
88
+ anchorActiveColor = getColor({
89
+ variable: fgVariable,
90
+ offset: 300,
91
+ theme
92
+ });
93
+ focusVariable = fgVariable;
94
+ break;
95
+ }
96
+ case 'info':
97
+ {
98
+ borderColor = getColor({
99
+ variable: 'border.primaryEmphasis',
100
+ offset: -300,
101
+ theme
102
+ });
103
+ backgroundColor = getColor({
104
+ variable: 'background.primaryEmphasis',
105
+ offset: -400,
106
+ theme
107
+ });
108
+ const fgVariable = 'foreground.primary';
109
+ foregroundColor = getColor({
110
+ variable: fgVariable,
111
+ offset: 100,
112
+ theme
113
+ });
114
+ anchorHoverColor = getColor({
115
+ variable: fgVariable,
116
+ offset: 200,
117
+ theme
118
+ });
119
+ anchorActiveColor = getColor({
120
+ variable: fgVariable,
121
+ offset: 300,
122
+ theme
123
+ });
124
+ focusVariable = fgVariable;
125
+ break;
126
+ }
127
+ }
128
+ const boxShadow = `0 ${theme.borderWidths.sm} ${theme.borderWidths.sm} ${borderColor}`;
129
+ return css(["box-shadow:", ";background-color:", ";color:", ";& a{color:inherit;", " &:hover{color:", ";}&:active{color:", ";}}"], boxShadow, backgroundColor, foregroundColor, focusStyles({
130
+ theme,
131
+ color: {
132
+ variable: focusVariable
133
+ },
134
+ styles: {
135
+ color: 'inherit'
136
+ }
137
+ }), anchorHoverColor, anchorActiveColor);
138
+ };
139
+ const sizeStyles = props => {
140
+ const {
141
+ fontSizes,
142
+ space
143
+ } = props.theme;
144
+ const minHeight = space.base * 13;
145
+ const padding = space.base * 4;
146
+ const lineHeight = getLineHeight(space.base * 5, fontSizes.md);
147
+ return css(["padding:", "px;min-height:", "px;line-height:", ";font-size:", ";"], padding, minHeight, lineHeight, fontSizes.md);
148
+ };
149
+ const StyledGlobalAlert = styled.div.attrs({
150
+ 'data-garden-id': COMPONENT_ID,
151
+ 'data-garden-version': '9.0.0-next.20'
152
+ }).withConfig({
153
+ displayName: "StyledGlobalAlert",
154
+ componentId: "sc-k6rimt-0"
155
+ })(["display:flex;flex-wrap:nowrap;overflow:auto;overflow-x:hidden;box-sizing:border-box;direction:", ";", " ", " && a{border-radius:", ";text-decoration:underline;}", ";"], props => props.theme.rtl ? 'rtl' : 'ltr', sizeStyles, colorStyles, props => props.theme.borderRadii.sm, props => retrieveComponentStyles(COMPONENT_ID, props));
156
+ StyledGlobalAlert.defaultProps = {
157
+ theme: DEFAULT_THEME
158
+ };
159
+
160
+ export { StyledGlobalAlert };
@@ -0,0 +1,118 @@
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, focusStyles } from '@zendeskgarden/react-theming';
9
+ import { Button } from '@zendeskgarden/react-buttons';
10
+ import { colorStyles as colorStyles$1 } from './StyledGlobalAlertClose.js';
11
+
12
+ const COMPONENT_ID = 'notifications.global_alert.button';
13
+ function colorStyles(props) {
14
+ const {
15
+ $alertType,
16
+ isBasic,
17
+ theme
18
+ } = props;
19
+ if (isBasic) {
20
+ return colorStyles$1(props);
21
+ }
22
+ let bgVariable;
23
+ let offsetOptions;
24
+ let offsetHoverOptions;
25
+ let offsetActiveOptions;
26
+ let focusVariable;
27
+ switch ($alertType) {
28
+ case 'success':
29
+ bgVariable = 'background.successEmphasis';
30
+ offsetOptions = {
31
+ offset: 200
32
+ };
33
+ offsetHoverOptions = {
34
+ offset: 300
35
+ };
36
+ offsetActiveOptions = {
37
+ offset: 400
38
+ };
39
+ focusVariable = 'foreground.successEmphasis';
40
+ break;
41
+ case 'error':
42
+ bgVariable = 'background.dangerEmphasis';
43
+ offsetOptions = {
44
+ offset: 200
45
+ };
46
+ offsetHoverOptions = {
47
+ offset: 300
48
+ };
49
+ offsetActiveOptions = {
50
+ offset: 400
51
+ };
52
+ focusVariable = 'foreground.dangerEmphasis';
53
+ break;
54
+ case 'warning':
55
+ bgVariable = 'background.warningEmphasis';
56
+ offsetOptions = {};
57
+ offsetHoverOptions = {
58
+ offset: 100
59
+ };
60
+ offsetActiveOptions = {
61
+ offset: 200
62
+ };
63
+ focusVariable = 'foreground.warning';
64
+ break;
65
+ case 'info':
66
+ bgVariable = 'background.primaryEmphasis';
67
+ offsetOptions = {};
68
+ offsetHoverOptions = {
69
+ offset: 100
70
+ };
71
+ offsetActiveOptions = {
72
+ offset: 200
73
+ };
74
+ focusVariable = 'foreground.primary';
75
+ break;
76
+ }
77
+ const backgroundColor = getColor({
78
+ variable: bgVariable,
79
+ ...offsetOptions,
80
+ theme
81
+ });
82
+ const hoverBackgroundColor = getColor({
83
+ variable: bgVariable,
84
+ ...offsetHoverOptions,
85
+ theme
86
+ });
87
+ const activeBackgroundColor = getColor({
88
+ variable: bgVariable,
89
+ ...offsetActiveOptions,
90
+ theme
91
+ });
92
+ return css(["background-color:", ";color:", ";&:hover{background-color:", ";}", " &:active{background-color:", ";}"], backgroundColor, getColor({
93
+ hue: 'white',
94
+ theme
95
+ }), hoverBackgroundColor, focusStyles({
96
+ theme,
97
+ color: {
98
+ variable: focusVariable
99
+ }
100
+ }), activeBackgroundColor);
101
+ }
102
+ function sizeStyles(props) {
103
+ const marginVertical = `-${props.theme.space.base * 1.5}px`;
104
+ const marginStart = `${props.theme.space.base * 2}px`;
105
+ return css(["margin:", " ", " ", " ", ";"], marginVertical, props.theme.rtl ? marginStart : 0, marginVertical, props.theme.rtl ? 0 : marginStart);
106
+ }
107
+ const StyledGlobalAlertButton = styled(Button).attrs({
108
+ 'data-garden-id': COMPONENT_ID,
109
+ 'data-garden-version': '9.0.0-next.20'
110
+ }).withConfig({
111
+ displayName: "StyledGlobalAlertButton",
112
+ componentId: "sc-1txe91a-0"
113
+ })(["flex-shrink:0;", ";", ";", ";"], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
114
+ StyledGlobalAlertButton.defaultProps = {
115
+ theme: DEFAULT_THEME
116
+ };
117
+
118
+ export { StyledGlobalAlertButton };
@@ -0,0 +1,103 @@
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, focusStyles } from '@zendeskgarden/react-theming';
9
+ import { IconButton } from '@zendeskgarden/react-buttons';
10
+
11
+ const COMPONENT_ID = 'notifications.global_alert.close';
12
+ const colorStyles = props => {
13
+ const {
14
+ $alertType,
15
+ theme
16
+ } = props;
17
+ let hoverBackgroundColor;
18
+ let hoverForegroundColor;
19
+ let activeBackgroundColor;
20
+ let activeForegroundColor;
21
+ let focusVariable;
22
+ switch ($alertType) {
23
+ case 'success':
24
+ hoverBackgroundColor = getColor({
25
+ variable: 'background.success',
26
+ theme,
27
+ transparency: theme.opacity[100]
28
+ });
29
+ hoverForegroundColor = theme.palette.white;
30
+ activeBackgroundColor = getColor({
31
+ variable: 'background.success',
32
+ theme,
33
+ transparency: theme.opacity[200]
34
+ });
35
+ activeForegroundColor = theme.palette.white;
36
+ focusVariable = 'foreground.successEmphasis';
37
+ break;
38
+ case 'error':
39
+ hoverBackgroundColor = getColor({
40
+ variable: 'background.danger',
41
+ theme,
42
+ transparency: theme.opacity[100]
43
+ });
44
+ hoverForegroundColor = theme.palette.white;
45
+ activeBackgroundColor = getColor({
46
+ variable: 'background.danger',
47
+ theme,
48
+ transparency: theme.opacity[200]
49
+ });
50
+ activeForegroundColor = theme.palette.white;
51
+ focusVariable = 'foreground.dangerEmphasis';
52
+ break;
53
+ case 'warning':
54
+ hoverBackgroundColor = getColor({
55
+ variable: 'background.warningEmphasis',
56
+ transparency: theme.opacity[100],
57
+ theme
58
+ });
59
+ hoverForegroundColor = getColor({
60
+ variable: 'foreground.warningEmphasis',
61
+ offset: 200,
62
+ theme
63
+ });
64
+ activeBackgroundColor = getColor({
65
+ variable: 'background.warningEmphasis',
66
+ transparency: theme.opacity[200],
67
+ theme
68
+ });
69
+ activeForegroundColor = getColor({
70
+ variable: 'foreground.warningEmphasis',
71
+ offset: 300,
72
+ theme
73
+ });
74
+ focusVariable = 'foreground.warning';
75
+ break;
76
+ default:
77
+ focusVariable = 'foreground.primary';
78
+ }
79
+ return css(["color:inherit;&:hover{background-color:", ";color:", ";}", " &:active{background-color:", ";color:", ";}"], hoverBackgroundColor, hoverForegroundColor, focusStyles({
80
+ theme,
81
+ color: {
82
+ variable: focusVariable
83
+ }
84
+ }), activeBackgroundColor, activeForegroundColor);
85
+ };
86
+ const sizeStyles = props => {
87
+ const marginVertical = `-${props.theme.space.base * 1.5}px`;
88
+ const marginStart = `${props.theme.space.base * 2}px`;
89
+ const marginEnd = `-${props.theme.space.base * 2}px`;
90
+ return css(["margin:", " ", " ", " ", ";"], marginVertical, props.theme.rtl ? marginStart : marginEnd, marginVertical, props.theme.rtl ? marginEnd : marginStart);
91
+ };
92
+ const StyledGlobalAlertClose = styled(IconButton).attrs({
93
+ 'data-garden-id': COMPONENT_ID,
94
+ 'data-garden-version': '9.0.0-next.20'
95
+ }).withConfig({
96
+ displayName: "StyledGlobalAlertClose",
97
+ componentId: "sc-1g5s93s-0"
98
+ })(["", ";", ";", ";"], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
99
+ StyledGlobalAlertClose.defaultProps = {
100
+ theme: DEFAULT_THEME
101
+ };
102
+
103
+ export { StyledGlobalAlertClose, colorStyles };
@@ -0,0 +1,22 @@
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 from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'notifications.global_alert.content';
11
+ const StyledGlobalAlertContent = styled.div.attrs({
12
+ 'data-garden-id': COMPONENT_ID,
13
+ 'data-garden-version': '9.0.0-next.20'
14
+ }).withConfig({
15
+ displayName: "StyledGlobalAlertContent",
16
+ componentId: "sc-rept0u-0"
17
+ })(["flex-grow:1;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
18
+ StyledGlobalAlertContent.defaultProps = {
19
+ theme: DEFAULT_THEME
20
+ };
21
+
22
+ export { StyledGlobalAlertContent };