@zendeskgarden/react-notifications 9.0.0-next.14 → 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.
- package/dist/esm/elements/Alert.js +6 -6
- package/dist/esm/elements/Notification.js +4 -5
- package/dist/esm/elements/Well.js +12 -3
- package/dist/esm/elements/content/Close.js +7 -4
- package/dist/esm/elements/content/Title.js +10 -3
- package/dist/esm/elements/global-alert/GlobalAlert.js +23 -10
- package/dist/esm/elements/global-alert/GlobalAlertButton.js +3 -2
- package/dist/esm/elements/global-alert/GlobalAlertClose.js +5 -3
- package/dist/esm/elements/global-alert/GlobalAlertTitle.js +8 -3
- package/dist/esm/styled/StyledAlert.js +29 -3
- package/dist/esm/styled/StyledBase.js +72 -25
- package/dist/esm/styled/StyledIcon.js +47 -4
- package/dist/esm/styled/StyledNotification.js +19 -25
- package/dist/esm/styled/StyledWell.js +28 -4
- package/dist/esm/styled/content/StyledClose.js +53 -8
- package/dist/esm/styled/content/StyledParagraph.js +1 -1
- package/dist/esm/styled/content/StyledTitle.js +6 -3
- package/dist/esm/styled/global-alert/StyledGlobalAlert.js +113 -38
- package/dist/esm/styled/global-alert/StyledGlobalAlertButton.js +78 -33
- package/dist/esm/styled/global-alert/StyledGlobalAlertClose.js +62 -31
- package/dist/esm/styled/global-alert/StyledGlobalAlertContent.js +2 -2
- package/dist/esm/styled/global-alert/StyledGlobalAlertIcon.js +40 -4
- package/dist/esm/styled/global-alert/StyledGlobalAlertTitle.js +20 -9
- package/dist/esm/utils/icons.js +6 -6
- package/dist/index.cjs.js +765 -370
- package/dist/typings/styled/StyledAlert.d.ts +8 -3
- package/dist/typings/styled/StyledBase.d.ts +8 -6
- package/dist/typings/styled/StyledIcon.d.ts +10 -1
- package/dist/typings/styled/StyledNotification.d.ts +11 -3
- package/dist/typings/styled/StyledWell.d.ts +7 -2
- package/dist/typings/styled/content/StyledClose.d.ts +5 -3
- package/dist/typings/styled/content/StyledTitle.d.ts +1 -1
- package/dist/typings/styled/global-alert/StyledGlobalAlert.d.ts +1 -1
- package/dist/typings/styled/global-alert/StyledGlobalAlertButton.d.ts +3 -9
- package/dist/typings/styled/global-alert/StyledGlobalAlertClose.d.ts +3 -3
- package/dist/typings/styled/global-alert/StyledGlobalAlertTitle.d.ts +2 -2
- package/dist/typings/utils/icons.d.ts +1 -1
- package/dist/typings/{elements/global-alert/utility.d.ts → utils/useGlobalAlertContext.d.ts} +1 -1
- package/dist/typings/utils/useNotificationsContext.d.ts +2 -3
- package/package.json +4 -4
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/x-stroke.svg.js +0 -26
- /package/dist/esm/{elements/global-alert/utility.js → utils/useGlobalAlertContext.js} +0 -0
|
@@ -4,20 +4,65 @@
|
|
|
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 {
|
|
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';
|
|
9
11
|
|
|
10
12
|
const COMPONENT_ID = 'notifications.close';
|
|
11
|
-
const
|
|
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.
|
|
61
|
+
'data-garden-version': '9.0.0-next.15'
|
|
14
62
|
}).withConfig({
|
|
15
63
|
displayName: "StyledClose",
|
|
16
64
|
componentId: "sc-1mr9nx1-0"
|
|
17
|
-
})(["
|
|
18
|
-
theme: props.theme,
|
|
19
|
-
inset: true
|
|
20
|
-
}), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
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));
|
|
21
66
|
StyledClose.defaultProps = {
|
|
22
67
|
theme: DEFAULT_THEME
|
|
23
68
|
};
|
|
@@ -10,7 +10,7 @@ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-the
|
|
|
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.
|
|
13
|
+
'data-garden-version': '9.0.0-next.15'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledParagraph",
|
|
16
16
|
componentId: "sc-12tmd6p-0"
|
|
@@ -5,16 +5,19 @@
|
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
7
|
import styled from 'styled-components';
|
|
8
|
-
import {
|
|
8
|
+
import { getColor, retrieveComponentStyles, DEFAULT_THEME } 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.
|
|
13
|
+
'data-garden-version': '9.0.0-next.15'
|
|
14
14
|
}).withConfig({
|
|
15
15
|
displayName: "StyledTitle",
|
|
16
16
|
componentId: "sc-xx4jsv-0"
|
|
17
|
-
})(["margin:0;color:", ";font-weight:", ";", ";"],
|
|
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));
|
|
18
21
|
StyledTitle.defaultProps = {
|
|
19
22
|
theme: DEFAULT_THEME
|
|
20
23
|
};
|
|
@@ -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,
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor, focusStyles, getLineHeight } from '@zendeskgarden/react-theming';
|
|
9
9
|
|
|
10
|
-
const COMPONENT_ID = 'notifications.
|
|
11
|
-
const colorStyles =
|
|
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
|
|
18
|
-
switch (
|
|
21
|
+
let focusVariable;
|
|
22
|
+
switch ($alertType) {
|
|
19
23
|
case 'success':
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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 ${
|
|
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
|
|
130
|
+
theme,
|
|
55
131
|
color: {
|
|
56
|
-
|
|
57
|
-
shade: props.alertType === 'info' ? 600 : 800
|
|
132
|
+
variable: focusVariable
|
|
58
133
|
},
|
|
59
134
|
styles: {
|
|
60
135
|
color: 'inherit'
|
|
@@ -73,7 +148,7 @@ 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.
|
|
151
|
+
'data-garden-version': '9.0.0-next.15'
|
|
77
152
|
}).withConfig({
|
|
78
153
|
displayName: "StyledGlobalAlert",
|
|
79
154
|
componentId: "sc-k6rimt-0"
|
|
@@ -5,46 +5,97 @@
|
|
|
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,
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColor, focusStyles } from '@zendeskgarden/react-theming';
|
|
9
9
|
import { Button } from '@zendeskgarden/react-buttons';
|
|
10
10
|
import { colorStyles as colorStyles$1 } from './StyledGlobalAlertClose.js';
|
|
11
11
|
|
|
12
|
+
const COMPONENT_ID = 'notifications.global_alert.button';
|
|
12
13
|
function colorStyles(props) {
|
|
13
|
-
|
|
14
|
+
const {
|
|
15
|
+
$alertType,
|
|
16
|
+
isBasic,
|
|
17
|
+
theme
|
|
18
|
+
} = props;
|
|
19
|
+
if (isBasic) {
|
|
14
20
|
return colorStyles$1(props);
|
|
15
21
|
}
|
|
16
|
-
let
|
|
17
|
-
let
|
|
18
|
-
let
|
|
19
|
-
let
|
|
20
|
-
|
|
22
|
+
let bgVariable;
|
|
23
|
+
let offsetOptions;
|
|
24
|
+
let offsetHoverOptions;
|
|
25
|
+
let offsetActiveOptions;
|
|
26
|
+
let focusVariable;
|
|
27
|
+
switch ($alertType) {
|
|
21
28
|
case 'success':
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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';
|
|
26
40
|
break;
|
|
27
41
|
case 'error':
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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';
|
|
32
53
|
break;
|
|
33
54
|
case 'warning':
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
55
|
+
bgVariable = 'background.warningEmphasis';
|
|
56
|
+
offsetOptions = {};
|
|
57
|
+
offsetHoverOptions = {
|
|
58
|
+
offset: 100
|
|
59
|
+
};
|
|
60
|
+
offsetActiveOptions = {
|
|
61
|
+
offset: 200
|
|
62
|
+
};
|
|
63
|
+
focusVariable = 'foreground.warning';
|
|
38
64
|
break;
|
|
39
65
|
case 'info':
|
|
40
|
-
|
|
66
|
+
bgVariable = 'background.primaryEmphasis';
|
|
67
|
+
offsetOptions = {};
|
|
68
|
+
offsetHoverOptions = {
|
|
69
|
+
offset: 100
|
|
70
|
+
};
|
|
71
|
+
offsetActiveOptions = {
|
|
72
|
+
offset: 200
|
|
73
|
+
};
|
|
74
|
+
focusVariable = 'foreground.primary';
|
|
41
75
|
break;
|
|
42
76
|
}
|
|
43
|
-
|
|
44
|
-
|
|
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,
|
|
45
97
|
color: {
|
|
46
|
-
|
|
47
|
-
shade: props.alertType === 'info' ? 600 : 800
|
|
98
|
+
variable: focusVariable
|
|
48
99
|
}
|
|
49
100
|
}), activeBackgroundColor);
|
|
50
101
|
}
|
|
@@ -54,18 +105,12 @@ function sizeStyles(props) {
|
|
|
54
105
|
return css(["margin:", " ", " ", " ", ";"], marginVertical, props.theme.rtl ? marginStart : 0, marginVertical, props.theme.rtl ? 0 : marginStart);
|
|
55
106
|
}
|
|
56
107
|
const StyledGlobalAlertButton = styled(Button).attrs({
|
|
57
|
-
'data-garden-
|
|
58
|
-
|
|
59
|
-
isDanger: false,
|
|
60
|
-
isLink: false,
|
|
61
|
-
isNeutral: false,
|
|
62
|
-
isPill: false,
|
|
63
|
-
isStretched: false,
|
|
64
|
-
size: 'small'
|
|
108
|
+
'data-garden-id': COMPONENT_ID,
|
|
109
|
+
'data-garden-version': '9.0.0-next.15'
|
|
65
110
|
}).withConfig({
|
|
66
111
|
displayName: "StyledGlobalAlertButton",
|
|
67
112
|
componentId: "sc-1txe91a-0"
|
|
68
|
-
})(["flex-shrink:0;", ";", ";"], sizeStyles, colorStyles);
|
|
113
|
+
})(["flex-shrink:0;", ";", ";", ";"], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
69
114
|
StyledGlobalAlertButton.defaultProps = {
|
|
70
115
|
theme: DEFAULT_THEME
|
|
71
116
|
};
|
|
@@ -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,
|
|
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
|
|
17
|
-
switch (
|
|
21
|
+
let focusVariable;
|
|
22
|
+
switch ($alertType) {
|
|
18
23
|
case 'success':
|
|
19
|
-
hoverBackgroundColor =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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 =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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 =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
|
80
|
+
theme,
|
|
49
81
|
color: {
|
|
50
|
-
|
|
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-
|
|
63
|
-
|
|
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.
|
|
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
|
+
'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.
|
|
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.
|
|
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
|
};
|