@zendeskgarden/react-notifications 9.0.0-next.13 → 9.0.0-next.15

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 (43) hide show
  1. package/LICENSE.md +176 -0
  2. package/dist/esm/elements/Alert.js +6 -6
  3. package/dist/esm/elements/Notification.js +4 -5
  4. package/dist/esm/elements/Well.js +12 -3
  5. package/dist/esm/elements/content/Close.js +7 -4
  6. package/dist/esm/elements/content/Title.js +10 -3
  7. package/dist/esm/elements/global-alert/GlobalAlert.js +23 -10
  8. package/dist/esm/elements/global-alert/GlobalAlertButton.js +3 -2
  9. package/dist/esm/elements/global-alert/GlobalAlertClose.js +5 -3
  10. package/dist/esm/elements/global-alert/GlobalAlertTitle.js +8 -3
  11. package/dist/esm/styled/StyledAlert.js +29 -3
  12. package/dist/esm/styled/StyledBase.js +72 -25
  13. package/dist/esm/styled/StyledIcon.js +47 -4
  14. package/dist/esm/styled/StyledNotification.js +19 -25
  15. package/dist/esm/styled/StyledWell.js +28 -4
  16. package/dist/esm/styled/content/StyledClose.js +53 -8
  17. package/dist/esm/styled/content/StyledParagraph.js +1 -1
  18. package/dist/esm/styled/content/StyledTitle.js +6 -3
  19. package/dist/esm/styled/global-alert/StyledGlobalAlert.js +113 -38
  20. package/dist/esm/styled/global-alert/StyledGlobalAlertButton.js +78 -33
  21. package/dist/esm/styled/global-alert/StyledGlobalAlertClose.js +62 -31
  22. package/dist/esm/styled/global-alert/StyledGlobalAlertContent.js +2 -2
  23. package/dist/esm/styled/global-alert/StyledGlobalAlertIcon.js +40 -4
  24. package/dist/esm/styled/global-alert/StyledGlobalAlertTitle.js +20 -9
  25. package/dist/esm/utils/icons.js +6 -6
  26. package/dist/index.cjs.js +765 -370
  27. package/dist/typings/styled/StyledAlert.d.ts +8 -3
  28. package/dist/typings/styled/StyledBase.d.ts +8 -6
  29. package/dist/typings/styled/StyledIcon.d.ts +10 -1
  30. package/dist/typings/styled/StyledNotification.d.ts +11 -3
  31. package/dist/typings/styled/StyledWell.d.ts +7 -2
  32. package/dist/typings/styled/content/StyledClose.d.ts +5 -3
  33. package/dist/typings/styled/content/StyledTitle.d.ts +1 -1
  34. package/dist/typings/styled/global-alert/StyledGlobalAlert.d.ts +1 -1
  35. package/dist/typings/styled/global-alert/StyledGlobalAlertButton.d.ts +3 -9
  36. package/dist/typings/styled/global-alert/StyledGlobalAlertClose.d.ts +3 -3
  37. package/dist/typings/styled/global-alert/StyledGlobalAlertTitle.d.ts +2 -2
  38. package/dist/typings/utils/icons.d.ts +1 -1
  39. package/dist/typings/{elements/global-alert/utility.d.ts → utils/useGlobalAlertContext.d.ts} +1 -1
  40. package/dist/typings/utils/useNotificationsContext.d.ts +2 -3
  41. package/package.json +5 -4
  42. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/x-stroke.svg.js +0 -26
  43. /package/dist/esm/{elements/global-alert/utility.js → utils/useGlobalAlertContext.js} +0 -0
@@ -5,50 +5,81 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled, { css } from 'styled-components';
8
- import { DEFAULT_THEME, getColorV8, focusStyles } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles, DEFAULT_THEME, getColor, focusStyles } from '@zendeskgarden/react-theming';
9
9
  import { IconButton } from '@zendeskgarden/react-buttons';
10
10
 
11
+ const COMPONENT_ID = 'notifications.global_alert.close';
11
12
  const colorStyles = props => {
13
+ const {
14
+ $alertType,
15
+ theme
16
+ } = props;
12
17
  let hoverBackgroundColor;
13
18
  let hoverForegroundColor;
14
19
  let activeBackgroundColor;
15
20
  let activeForegroundColor;
16
- let focusColor;
17
- switch (props.alertType) {
21
+ let focusVariable;
22
+ switch ($alertType) {
18
23
  case 'success':
19
- hoverBackgroundColor = getColorV8('successHue', 100, props.theme, 0.08);
20
- hoverForegroundColor = props.theme.palette.white;
21
- activeBackgroundColor = getColorV8('successHue', 100, props.theme, 0.2);
22
- activeForegroundColor = props.theme.palette.white;
23
- focusColor = 'successHue';
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';
24
37
  break;
25
38
  case 'error':
26
- hoverBackgroundColor = getColorV8('dangerHue', 100, props.theme, 0.08);
27
- hoverForegroundColor = props.theme.palette.white;
28
- activeBackgroundColor = getColorV8('dangerHue', 100, props.theme, 0.2);
29
- activeForegroundColor = props.theme.palette.white;
30
- focusColor = 'dangerHue';
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';
31
52
  break;
32
53
  case 'warning':
33
- hoverBackgroundColor = getColorV8('warningHue', 800, props.theme, 0.08);
34
- hoverForegroundColor = getColorV8('warningHue', 900, props.theme);
35
- activeBackgroundColor = getColorV8('warningHue', 800, props.theme, 0.2);
36
- activeForegroundColor = getColorV8('warningHue', 1000, props.theme);
37
- focusColor = 'warningHue';
38
- break;
39
- case 'info':
40
- hoverBackgroundColor = getColorV8('primaryHue', 700, props.theme, 0.08);
41
- hoverForegroundColor = getColorV8('primaryHue', 800, props.theme);
42
- activeBackgroundColor = getColorV8('primaryHue', 700, props.theme, 0.2);
43
- activeForegroundColor = getColorV8('primaryHue', 900, props.theme);
44
- focusColor = 'primaryHue';
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';
45
75
  break;
76
+ default:
77
+ focusVariable = 'foreground.primary';
46
78
  }
47
79
  return css(["color:inherit;&:hover{background-color:", ";color:", ";}", " &:active{background-color:", ";color:", ";}"], hoverBackgroundColor, hoverForegroundColor, focusStyles({
48
- theme: props.theme,
80
+ theme,
49
81
  color: {
50
- hue: focusColor,
51
- shade: props.alertType === 'info' ? 600 : 800
82
+ variable: focusVariable
52
83
  }
53
84
  }), activeBackgroundColor, activeForegroundColor);
54
85
  };
@@ -59,12 +90,12 @@ const sizeStyles = props => {
59
90
  return css(["margin:", " ", " ", " ", ";"], marginVertical, props.theme.rtl ? marginStart : marginEnd, marginVertical, props.theme.rtl ? marginEnd : marginStart);
60
91
  };
61
92
  const StyledGlobalAlertClose = styled(IconButton).attrs({
62
- 'data-garden-version': '9.0.0-next.13',
63
- size: 'small'
93
+ 'data-garden-id': COMPONENT_ID,
94
+ 'data-garden-version': '9.0.0-next.15'
64
95
  }).withConfig({
65
96
  displayName: "StyledGlobalAlertClose",
66
97
  componentId: "sc-1g5s93s-0"
67
- })(["", ";", ";"], sizeStyles, colorStyles);
98
+ })(["", ";", ";", ";"], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
68
99
  StyledGlobalAlertClose.defaultProps = {
69
100
  theme: DEFAULT_THEME
70
101
  };
@@ -7,10 +7,10 @@
7
7
  import styled from 'styled-components';
8
8
  import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
9
 
10
- const COMPONENT_ID = 'notifications.global-alert.content';
10
+ const COMPONENT_ID = 'notifications.global_alert.content';
11
11
  const StyledGlobalAlertContent = styled.div.attrs({
12
12
  'data-garden-id': COMPONENT_ID,
13
- 'data-garden-version': '9.0.0-next.13'
13
+ 'data-garden-version': '9.0.0-next.15'
14
14
  }).withConfig({
15
15
  displayName: "StyledGlobalAlertContent",
16
16
  componentId: "sc-rept0u-0"
@@ -6,22 +6,58 @@
6
6
  */
7
7
  import styled, { css } from 'styled-components';
8
8
  import { math } from 'polished';
9
- import { StyledBaseIcon, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+ import { StyledBaseIcon, retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
10
10
 
11
- const COMPONENT_ID = 'notifications.global-alert.icon';
11
+ const COMPONENT_ID = 'notifications.global_alert.icon';
12
12
  const sizeStyles = props => {
13
13
  const size = props.theme.iconSizes.md;
14
14
  const marginTop = math(`(${props.theme.space.base * 5} - ${size}) / 2`);
15
15
  const marginHorizontal = `${props.theme.space.base * 2}px`;
16
16
  return css(["margin-top:", ";margin-", ":", ";width:", ";height:", ";"], marginTop, props.theme.rtl ? 'left' : 'right', marginHorizontal, size, size);
17
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
+ };
18
54
  const StyledGlobalAlertIcon = styled(StyledBaseIcon).attrs({
19
55
  'data-garden-id': COMPONENT_ID,
20
- 'data-garden-version': '9.0.0-next.13'
56
+ 'data-garden-version': '9.0.0-next.15'
21
57
  }).withConfig({
22
58
  displayName: "StyledGlobalAlertIcon",
23
59
  componentId: "sc-84ne9k-0"
24
- })(["flex-shrink:0;", ";", ";"], sizeStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
60
+ })(["flex-shrink:0;", ";", ";", ";"], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
25
61
  StyledGlobalAlertIcon.defaultProps = {
26
62
  theme: DEFAULT_THEME
27
63
  };
@@ -5,32 +5,43 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled, { css } from 'styled-components';
8
- import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
9
9
 
10
- const COMPONENT_ID = 'notifications.global-alert.title';
11
- const colorStyles = props => {
10
+ const COMPONENT_ID = 'notifications.global_alert.title';
11
+ const colorStyles = _ref => {
12
+ let {
13
+ theme,
14
+ $alertType
15
+ } = _ref;
12
16
  let color;
13
- switch (props.alertType) {
17
+ switch ($alertType) {
14
18
  case 'success':
15
19
  case 'error':
16
- color = props.theme.palette.white;
20
+ color = theme.palette.white;
17
21
  break;
18
22
  case 'warning':
19
- color = getColorV8('warningHue', 900, props.theme);
23
+ color = getColor({
24
+ variable: 'foreground.warningEmphasis',
25
+ theme
26
+ });
20
27
  break;
21
28
  case 'info':
22
- color = getColorV8('primaryHue', 800, props.theme);
29
+ color = getColor({
30
+ variable: 'foreground.primary',
31
+ offset: 200,
32
+ theme
33
+ });
23
34
  break;
24
35
  }
25
36
  return css(["color:", ";"], color);
26
37
  };
27
38
  const StyledGlobalAlertTitle = styled.div.attrs({
28
39
  'data-garden-id': COMPONENT_ID,
29
- 'data-garden-version': '9.0.0-next.13'
40
+ 'data-garden-version': '9.0.0-next.15'
30
41
  }).withConfig({
31
42
  displayName: "StyledGlobalAlertTitle",
32
43
  componentId: "sc-10clqbo-0"
33
- })(["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));
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));
34
45
  StyledGlobalAlertTitle.defaultProps = {
35
46
  theme: DEFAULT_THEME
36
47
  };
@@ -15,11 +15,11 @@ const validationIcons = {
15
15
  warning: SvgAlertWarningStroke,
16
16
  info: SvgInfoStroke
17
17
  };
18
- const validationHues = {
19
- success: 'successHue',
20
- error: 'dangerHue',
21
- warning: 'warningHue',
22
- info: 'neutralHue'
18
+ const validationTypes = {
19
+ success: 'success',
20
+ error: 'error',
21
+ warning: 'warning',
22
+ info: 'info'
23
23
  };
24
24
 
25
- export { validationHues, validationIcons };
25
+ export { validationIcons, validationTypes };