@zendeskgarden/react-notifications 9.0.0-next.9 → 9.0.0

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 (70) hide show
  1. package/dist/esm/elements/Close.js +40 -0
  2. package/dist/esm/elements/Notification.js +8 -9
  3. package/dist/esm/elements/{Well.js → Paragraph.js} +5 -15
  4. package/dist/esm/elements/Title.js +35 -0
  5. package/dist/esm/elements/alert/Alert.js +56 -0
  6. package/dist/esm/elements/{content → alert}/Close.js +8 -5
  7. package/dist/esm/elements/{content → alert}/Paragraph.js +1 -1
  8. package/dist/esm/elements/{content → alert}/Title.js +11 -4
  9. package/dist/esm/elements/global-alert/GlobalAlert.js +23 -10
  10. package/dist/esm/elements/global-alert/GlobalAlertButton.js +3 -2
  11. package/dist/esm/elements/global-alert/GlobalAlertClose.js +5 -3
  12. package/dist/esm/elements/global-alert/GlobalAlertTitle.js +8 -3
  13. package/dist/esm/elements/toaster/styled.js +0 -7
  14. package/dist/esm/elements/well/Well.js +47 -0
  15. package/dist/esm/index.js +5 -5
  16. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/alert-error-stroke.svg.js +1 -1
  17. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/alert-warning-stroke.svg.js +1 -1
  18. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/check-circle-stroke.svg.js +1 -1
  19. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/info-stroke.svg.js +1 -1
  20. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/x-stroke.svg.js +1 -1
  21. package/dist/esm/styled/StyledAlert.js +29 -6
  22. package/dist/esm/styled/StyledBase.js +62 -27
  23. package/dist/esm/styled/StyledIcon.js +47 -7
  24. package/dist/esm/styled/StyledNotification.js +19 -28
  25. package/dist/esm/styled/StyledWell.js +28 -7
  26. package/dist/esm/styled/content/StyledClose.js +53 -11
  27. package/dist/esm/styled/content/StyledParagraph.js +2 -5
  28. package/dist/esm/styled/content/StyledTitle.js +6 -6
  29. package/dist/esm/styled/global-alert/StyledGlobalAlert.js +113 -41
  30. package/dist/esm/styled/global-alert/StyledGlobalAlertButton.js +76 -36
  31. package/dist/esm/styled/global-alert/StyledGlobalAlertClose.js +60 -34
  32. package/dist/esm/styled/global-alert/StyledGlobalAlertContent.js +3 -6
  33. package/dist/esm/styled/global-alert/StyledGlobalAlertIcon.js +40 -7
  34. package/dist/esm/styled/global-alert/StyledGlobalAlertTitle.js +20 -12
  35. package/dist/esm/utils/icons.js +6 -6
  36. package/dist/index.cjs.js +793 -428
  37. package/dist/typings/elements/Notification.d.ts +4 -4
  38. package/dist/typings/elements/{content/Title.d.ts → Title.d.ts} +1 -1
  39. package/dist/typings/elements/{Alert.d.ts → alert/Alert.d.ts} +5 -5
  40. package/dist/typings/elements/alert/Close.d.ts +11 -0
  41. package/dist/typings/elements/alert/Paragraph.d.ts +11 -0
  42. package/dist/typings/elements/alert/Title.d.ts +12 -0
  43. package/dist/typings/elements/global-alert/GlobalAlert.d.ts +8 -1
  44. package/dist/typings/elements/toaster/Toast.d.ts +0 -1
  45. package/dist/typings/elements/well/Paragraph.d.ts +11 -0
  46. package/dist/typings/elements/well/Title.d.ts +12 -0
  47. package/dist/typings/elements/{Well.d.ts → well/Well.d.ts} +4 -4
  48. package/dist/typings/index.d.ts +5 -5
  49. package/dist/typings/styled/StyledAlert.d.ts +8 -3
  50. package/dist/typings/styled/StyledBase.d.ts +8 -6
  51. package/dist/typings/styled/StyledIcon.d.ts +10 -2
  52. package/dist/typings/styled/StyledNotification.d.ts +11 -3
  53. package/dist/typings/styled/StyledWell.d.ts +7 -2
  54. package/dist/typings/styled/content/StyledClose.d.ts +4 -3
  55. package/dist/typings/styled/content/StyledTitle.d.ts +1 -1
  56. package/dist/typings/styled/global-alert/StyledGlobalAlert.d.ts +1 -1
  57. package/dist/typings/styled/global-alert/StyledGlobalAlertButton.d.ts +4 -18
  58. package/dist/typings/styled/global-alert/StyledGlobalAlertClose.d.ts +2 -4
  59. package/dist/typings/styled/global-alert/StyledGlobalAlertIcon.d.ts +0 -1
  60. package/dist/typings/styled/global-alert/StyledGlobalAlertTitle.d.ts +2 -2
  61. package/dist/typings/utils/icons.d.ts +1 -1
  62. package/dist/typings/{elements/global-alert/utility.d.ts → utils/useGlobalAlertContext.d.ts} +1 -2
  63. package/dist/typings/utils/useNotificationsContext.d.ts +2 -4
  64. package/package.json +9 -10
  65. package/LICENSE.md +0 -176
  66. package/dist/esm/elements/Alert.js +0 -56
  67. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/x-stroke.svg.js +0 -26
  68. /package/dist/esm/{elements/global-alert/utility.js → utils/useGlobalAlertContext.js} +0 -0
  69. /package/dist/typings/elements/{content/Close.d.ts → Close.d.ts} +0 -0
  70. /package/dist/typings/elements/{content/Paragraph.d.ts → Paragraph.d.ts} +0 -0
@@ -5,35 +5,70 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled, { css } from 'styled-components';
8
- import { getLineHeight, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
8
+ import { getLineHeight, retrieveComponentStyles, getColor } from '@zendeskgarden/react-theming';
9
+ import { validationTypes } from '../utils/icons.js';
9
10
 
10
- const boxShadow = props => {
11
- const {
12
- theme
13
- } = props;
11
+ const COMPONENT_ID = 'notifications.base_container';
12
+ const colorStyles = _ref => {
13
+ let {
14
+ theme,
15
+ $type,
16
+ $isFloating
17
+ } = _ref;
14
18
  const {
15
19
  space,
16
20
  shadows
17
21
  } = theme;
18
- const offsetY = `${space.base * 5}px`;
19
- const blurRadius = `${space.base * 7}px`;
20
- const color = getColorV8('chromeHue', 600, theme, 0.15);
21
- return shadows.lg(offsetY, blurRadius, color);
22
- };
23
- const colorStyles = props => {
24
- let backgroundColor;
25
- let borderColor;
26
- let foregroundColor;
27
- if (props.hue) {
28
- backgroundColor = getColorV8(props.hue, 100, props.theme);
29
- borderColor = getColorV8(props.hue, 300, props.theme);
30
- foregroundColor = getColorV8(props.hue, props.type === 'info' ? 600 : 700, props.theme);
22
+ let bgVariable;
23
+ let borderVariable;
24
+ let fgVariable;
25
+ if (!$isFloating && $type && !!validationTypes[$type]) {
26
+ switch ($type) {
27
+ case validationTypes.success:
28
+ bgVariable = 'background.success';
29
+ borderVariable = 'border.success';
30
+ fgVariable = 'foreground.success';
31
+ break;
32
+ case validationTypes.error:
33
+ bgVariable = 'background.danger';
34
+ borderVariable = 'border.danger';
35
+ fgVariable = 'foreground.danger';
36
+ break;
37
+ case validationTypes.warning:
38
+ bgVariable = 'background.warning';
39
+ borderVariable = 'border.warning';
40
+ fgVariable = 'foreground.warning';
41
+ break;
42
+ case validationTypes.info:
43
+ bgVariable = 'background.subtle';
44
+ borderVariable = 'border.default';
45
+ fgVariable = 'foreground.subtle';
46
+ break;
47
+ }
31
48
  } else {
32
- backgroundColor = getColorV8('background', 600 , props.theme);
33
- borderColor = getColorV8('neutralHue', 300, props.theme);
34
- foregroundColor = getColorV8('neutralHue', 800, props.theme);
49
+ bgVariable = 'background.raised';
50
+ borderVariable = 'border.default';
51
+ fgVariable = 'foreground.default';
35
52
  }
36
- return css(["border-color:", ";background-color:", ";color:", ";"], borderColor, backgroundColor, foregroundColor);
53
+ const backgroundColor = getColor({
54
+ variable: bgVariable,
55
+ theme
56
+ });
57
+ const borderColor = getColor({
58
+ variable: borderVariable,
59
+ theme
60
+ });
61
+ const foregroundColor = getColor({
62
+ variable: fgVariable,
63
+ theme
64
+ });
65
+ const offsetY = `${space.base * 5}px`;
66
+ const blurRadius = `${space.base * 7}px`;
67
+ const boxShadow = $isFloating ? shadows.lg(offsetY, blurRadius, getColor({
68
+ variable: 'shadow.large',
69
+ theme
70
+ })) : undefined;
71
+ return css(["border-color:", ";box-shadow:", ";background-color:", ";color:", ";"], borderColor, boxShadow, backgroundColor, foregroundColor);
37
72
  };
38
73
  const padding = props => {
39
74
  const {
@@ -43,12 +78,12 @@ const padding = props => {
43
78
  const paddingHorizontal = `${space.base * 10}px`;
44
79
  return `${paddingVertical} ${paddingHorizontal}`;
45
80
  };
46
- const StyledBase = styled.div.withConfig({
81
+ const StyledBase = styled.div.attrs({
82
+ 'data-garden-id': COMPONENT_ID,
83
+ 'data-garden-version': '9.0.0'
84
+ }).withConfig({
47
85
  displayName: "StyledBase",
48
86
  componentId: "sc-14syaqw-0"
49
- })(["position:relative;border:", ";border-radius:", ";box-shadow:", ";padding:", ";line-height:", ";font-size:", ";direction:", ";", ";"], props => props.theme.borders.sm, props => props.theme.borderRadii.md, props => props.isFloating && boxShadow, padding, props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md), props => props.theme.fontSizes.md, props => props.theme.rtl && 'rtl', colorStyles);
50
- StyledBase.defaultProps = {
51
- theme: DEFAULT_THEME
52
- };
87
+ })(["position:relative;border:", ";border-radius:", ";padding:", ";line-height:", ";font-size:", ";direction:", ";", ";", ""], props => props.theme.borders.sm, props => props.theme.borderRadii.md, padding, props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md), props => props.theme.fontSizes.md, props => props.theme.rtl && 'rtl', colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
53
88
 
54
89
  export { StyledBase };
@@ -4,15 +4,55 @@
4
4
  * Use of this source code is governed under the Apache License, Version 2.0
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
- import styled from 'styled-components';
8
- import { StyledBaseIcon, getColorV8, DEFAULT_THEME } from '@zendeskgarden/react-theming';
7
+ import styled, { css } from 'styled-components';
8
+ import { StyledBaseIcon, retrieveComponentStyles, getColor } from '@zendeskgarden/react-theming';
9
+ import { validationTypes } from '../utils/icons.js';
9
10
 
10
- const StyledIcon = styled(StyledBaseIcon).withConfig({
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'
53
+ }).withConfig({
11
54
  displayName: "StyledIcon",
12
55
  componentId: "sc-msklws-0"
13
- })(["position:absolute;right:", ";left:", ";margin-top:", "px;color:", ";"], props => props.theme.rtl && `${props.theme.space.base * 4}px`, props => !props.theme.rtl && `${props.theme.space.base * 4}px`, props => props.theme.space.base / 2, props => props.$hue && getColorV8(props.$hue, props.$hue === 'warningHue' ? 700 : 600, props.theme));
14
- StyledIcon.defaultProps = {
15
- theme: DEFAULT_THEME
16
- };
56
+ })(["position:absolute;", " ", " ", ""], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
17
57
 
18
58
  export { StyledIcon };
@@ -6,57 +6,48 @@
6
6
  */
7
7
  import PropTypes from 'prop-types';
8
8
  import styled, { css } from 'styled-components';
9
- import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
9
+ import { retrieveComponentStyles, getColor } from '@zendeskgarden/react-theming';
10
10
  import { TYPE } from '../types/index.js';
11
11
  import { StyledTitle } from './content/StyledTitle.js';
12
12
  import { StyledBase } from './StyledBase.js';
13
+ import { validationTypes } from '../utils/icons.js';
13
14
 
14
15
  const COMPONENT_ID = 'notifications.notification';
15
16
  const colorStyles = props => {
16
17
  const {
17
- type,
18
+ $type,
18
19
  theme
19
20
  } = props;
20
- const {
21
- colors
22
- } = theme;
23
- const {
24
- successHue,
25
- dangerHue,
26
- warningHue
27
- } = colors;
28
- let color;
29
- switch (type) {
30
- case 'success':
31
- color = getColorV8(successHue, 600, theme);
32
- break;
33
- case 'error':
34
- color = getColorV8(dangerHue, 600, theme);
21
+ let variable;
22
+ switch ($type) {
23
+ case validationTypes.success:
24
+ variable = 'foreground.success';
35
25
  break;
36
- case 'warning':
37
- color = getColorV8(warningHue, 700, theme);
26
+ case validationTypes.error:
27
+ variable = 'foreground.danger';
38
28
  break;
39
- case 'info':
40
- color = getColorV8('foreground', 600 , theme);
29
+ case validationTypes.warning:
30
+ variable = 'foreground.warning';
41
31
  break;
42
- default:
43
- color = 'inherit';
32
+ case validationTypes.info:
33
+ variable = 'foreground.default';
44
34
  break;
45
35
  }
36
+ const color = variable ? getColor({
37
+ variable,
38
+ theme
39
+ }) : 'inherit';
46
40
  return css(["", "{color:", ";}"], StyledTitle, color);
47
41
  };
48
42
  const StyledNotification = styled(StyledBase).attrs({
49
43
  'data-garden-id': COMPONENT_ID,
50
- 'data-garden-version': '9.0.0-next.9'
44
+ 'data-garden-version': '9.0.0'
51
45
  }).withConfig({
52
46
  displayName: "StyledNotification",
53
47
  componentId: "sc-uf6jh-0"
54
48
  })(["", " ", ";"], colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
55
49
  StyledNotification.propTypes = {
56
- type: PropTypes.oneOf(TYPE)
57
- };
58
- StyledNotification.defaultProps = {
59
- theme: DEFAULT_THEME
50
+ $type: PropTypes.oneOf(TYPE)
60
51
  };
61
52
 
62
53
  export { StyledNotification };
@@ -4,20 +4,41 @@
4
4
  * Use of this source code is governed under the Apache License, Version 2.0
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
- import styled from 'styled-components';
8
- import { getColorV8, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
7
+ import styled, { css } from 'styled-components';
8
+ import { retrieveComponentStyles, getColor } from '@zendeskgarden/react-theming';
9
9
  import { StyledBase } from './StyledBase.js';
10
10
 
11
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
+ };
12
36
  const StyledWell = styled(StyledBase).attrs({
13
37
  'data-garden-id': COMPONENT_ID,
14
- 'data-garden-version': '9.0.0-next.9'
38
+ 'data-garden-version': '9.0.0'
15
39
  }).withConfig({
16
40
  displayName: "StyledWell",
17
41
  componentId: "sc-a5831c-0"
18
- })(["background-color:", ";color:", " ", ";"], props => props.isRecessed && getColorV8('neutralHue', 100, props.theme), props => getColorV8('neutralHue', 600, props.theme), props => retrieveComponentStyles(COMPONENT_ID, props));
19
- StyledWell.defaultProps = {
20
- theme: DEFAULT_THEME
21
- };
42
+ })(["", " ", ";"], colorStyles, p => retrieveComponentStyles(COMPONENT_ID, p));
22
43
 
23
44
  export { StyledWell };
@@ -4,22 +4,64 @@
4
4
  * Use of this source code is governed under the Apache License, Version 2.0
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
- import styled from 'styled-components';
8
- import { getColorV8, focusStyles, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
7
+ import styled, { css } from 'styled-components';
8
+ import { retrieveComponentStyles, getColor } from '@zendeskgarden/react-theming';
9
+ import { validationTypes } from '../../utils/icons.js';
10
+ import { IconButton } from '@zendeskgarden/react-buttons';
9
11
 
10
12
  const COMPONENT_ID = 'notifications.close';
11
- const StyledClose = styled.button.attrs({
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({
12
60
  'data-garden-id': COMPONENT_ID,
13
- 'data-garden-version': '9.0.0-next.9'
61
+ 'data-garden-version': '9.0.0'
14
62
  }).withConfig({
15
63
  displayName: "StyledClose",
16
64
  componentId: "sc-1mr9nx1-0"
17
- })(["display:block;position:absolute;top:", "px;", ":", ";transition:background-color 0.1s ease-in-out,color 0.25s ease-in-out,box-shadow 0.1s ease-in-out;border:none;border-radius:50%;background-color:transparent;cursor:pointer;padding:0;width:", "px;height:", "px;overflow:hidden;color:", ";font-size:0;user-select:none;&::-moz-focus-inner{border:0;}&:hover{color:", ";}", " ", ";"], props => props.theme.space.base, props => props.theme.rtl ? 'left' : 'right', props => `${props.theme.space.base}px`, props => props.theme.space.base * 7, props => props.theme.space.base * 7, props => props.hue ? getColorV8(props.hue, props.hue === 'warningHue' ? 700 : 600, props.theme) : getColorV8('neutralHue', 600, props.theme), props => props.hue ? getColorV8(props.hue, 800, props.theme) : getColorV8('neutralHue', 800, props.theme), props => focusStyles({
18
- theme: props.theme,
19
- inset: true
20
- }), props => retrieveComponentStyles(COMPONENT_ID, props));
21
- StyledClose.defaultProps = {
22
- theme: DEFAULT_THEME
23
- };
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));
24
66
 
25
67
  export { StyledClose };
@@ -5,18 +5,15 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled from 'styled-components';
8
- import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
9
9
 
10
10
  const COMPONENT_ID = 'notifications.paragraph';
11
11
  const StyledParagraph = styled.p.attrs({
12
12
  'data-garden-id': COMPONENT_ID,
13
- 'data-garden-version': '9.0.0-next.9'
13
+ 'data-garden-version': '9.0.0'
14
14
  }).withConfig({
15
15
  displayName: "StyledParagraph",
16
16
  componentId: "sc-12tmd6p-0"
17
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
18
 
22
19
  export { StyledParagraph };
@@ -5,18 +5,18 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled from 'styled-components';
8
- import { getColorV8, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
8
+ import { getColor, retrieveComponentStyles } from '@zendeskgarden/react-theming';
9
9
 
10
10
  const COMPONENT_ID = 'notifications.title';
11
11
  const StyledTitle = styled.div.attrs({
12
12
  'data-garden-id': COMPONENT_ID,
13
- 'data-garden-version': '9.0.0-next.9'
13
+ 'data-garden-version': '9.0.0'
14
14
  }).withConfig({
15
15
  displayName: "StyledTitle",
16
16
  componentId: "sc-xx4jsv-0"
17
- })(["margin:0;color:", ";font-weight:", ";", ";"], props => getColorV8('foreground', 600 , props.theme), props => props.isRegular ? props.theme.fontWeights.regular : props.theme.fontWeights.semibold, props => retrieveComponentStyles(COMPONENT_ID, props));
18
- StyledTitle.defaultProps = {
19
- theme: DEFAULT_THEME
20
- };
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
21
 
22
22
  export { StyledTitle };
@@ -5,56 +5,131 @@
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, focusStyles, getLineHeight } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles, getColor, focusStyles, getLineHeight } from '@zendeskgarden/react-theming';
9
9
 
10
- const COMPONENT_ID = 'notifications.global-alert';
11
- const colorStyles = props => {
10
+ const COMPONENT_ID = 'notifications.global_alert';
11
+ const colorStyles = _ref => {
12
+ let {
13
+ theme,
14
+ $alertType
15
+ } = _ref;
12
16
  let borderColor;
13
17
  let backgroundColor;
14
18
  let foregroundColor;
15
19
  let anchorHoverColor;
16
20
  let anchorActiveColor;
17
- let focusColor;
18
- switch (props.alertType) {
21
+ let focusVariable;
22
+ switch ($alertType) {
19
23
  case 'success':
20
- borderColor = getColorV8('successHue', 700, props.theme);
21
- backgroundColor = getColorV8('successHue', 600, props.theme);
22
- foregroundColor = getColorV8('successHue', 100, props.theme);
23
- anchorHoverColor = props.theme.palette.white;
24
- anchorActiveColor = props.theme.palette.white;
25
- focusColor = 'successHue';
26
- break;
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
+ }
27
44
  case 'error':
28
- borderColor = getColorV8('dangerHue', 700, props.theme);
29
- backgroundColor = getColorV8('dangerHue', 600, props.theme);
30
- foregroundColor = getColorV8('dangerHue', 100, props.theme);
31
- anchorHoverColor = props.theme.palette.white;
32
- anchorActiveColor = props.theme.palette.white;
33
- focusColor = 'dangerHue';
34
- break;
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
+ }
35
65
  case 'warning':
36
- borderColor = getColorV8('warningHue', 400, props.theme);
37
- backgroundColor = getColorV8('warningHue', 300, props.theme);
38
- foregroundColor = getColorV8('warningHue', 800, props.theme);
39
- anchorHoverColor = getColorV8('warningHue', 900, props.theme);
40
- anchorActiveColor = getColorV8('warningHue', 1000, props.theme);
41
- focusColor = 'warningHue';
42
- break;
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
+ }
43
96
  case 'info':
44
- borderColor = getColorV8('primaryHue', 300, props.theme);
45
- backgroundColor = getColorV8('primaryHue', 200, props.theme);
46
- foregroundColor = getColorV8('primaryHue', 700, props.theme);
47
- anchorHoverColor = getColorV8('primaryHue', 800, props.theme);
48
- anchorActiveColor = getColorV8('primaryHue', 900, props.theme);
49
- focusColor = 'primaryHue';
50
- break;
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
+ }
51
127
  }
52
- const boxShadow = `0 ${props.theme.borderWidths.sm} ${props.theme.borderWidths.sm} ${borderColor}`;
128
+ const boxShadow = `0 ${theme.borderWidths.sm} ${theme.borderWidths.sm} ${borderColor}`;
53
129
  return css(["box-shadow:", ";background-color:", ";color:", ";& a{color:inherit;", " &:hover{color:", ";}&:active{color:", ";}}"], boxShadow, backgroundColor, foregroundColor, focusStyles({
54
- theme: props.theme,
130
+ theme,
55
131
  color: {
56
- hue: focusColor,
57
- shade: props.alertType === 'info' ? 600 : 800
132
+ variable: focusVariable
58
133
  },
59
134
  styles: {
60
135
  color: 'inherit'
@@ -73,13 +148,10 @@ const sizeStyles = props => {
73
148
  };
74
149
  const StyledGlobalAlert = styled.div.attrs({
75
150
  'data-garden-id': COMPONENT_ID,
76
- 'data-garden-version': '9.0.0-next.9'
151
+ 'data-garden-version': '9.0.0'
77
152
  }).withConfig({
78
153
  displayName: "StyledGlobalAlert",
79
154
  componentId: "sc-k6rimt-0"
80
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));
81
- StyledGlobalAlert.defaultProps = {
82
- theme: DEFAULT_THEME
83
- };
84
156
 
85
157
  export { StyledGlobalAlert };