@zendeskgarden/react-notifications 9.0.0-next.6 → 9.0.0-next.8
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 +56 -0
- package/dist/esm/elements/Notification.js +56 -0
- package/dist/esm/elements/Well.js +38 -0
- package/dist/esm/elements/content/Close.js +37 -0
- package/dist/esm/elements/content/Paragraph.js +28 -0
- package/dist/esm/elements/content/Title.js +28 -0
- package/dist/esm/elements/global-alert/GlobalAlert.js +64 -0
- package/dist/esm/elements/global-alert/GlobalAlertButton.js +46 -0
- package/dist/esm/elements/global-alert/GlobalAlertClose.js +41 -0
- package/dist/esm/elements/global-alert/GlobalAlertContent.js +30 -0
- package/dist/esm/elements/global-alert/GlobalAlertTitle.js +39 -0
- package/dist/esm/elements/global-alert/utility.js +14 -0
- package/dist/esm/elements/toaster/Toast.js +62 -0
- package/dist/esm/elements/toaster/ToastContext.js +11 -0
- package/dist/esm/elements/toaster/ToastProvider.js +51 -0
- package/dist/esm/elements/toaster/ToastSlot.js +82 -0
- package/dist/esm/elements/toaster/reducer.js +66 -0
- package/dist/esm/elements/toaster/styled.js +71 -0
- package/dist/esm/elements/toaster/useToast.js +70 -0
- package/dist/esm/index.js +15 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/x-stroke.svg.js +26 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/alert-error-stroke.svg.js +37 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/alert-warning-stroke.svg.js +32 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/check-circle-stroke.svg.js +33 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/info-stroke.svg.js +37 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/x-stroke.svg.js +26 -0
- package/dist/esm/styled/StyledAlert.js +25 -0
- package/dist/esm/styled/StyledBase.js +54 -0
- package/dist/esm/styled/StyledIcon.js +25 -0
- package/dist/esm/styled/StyledNotification.js +62 -0
- package/dist/esm/styled/StyledWell.js +23 -0
- package/dist/esm/styled/content/StyledClose.js +25 -0
- package/dist/esm/styled/content/StyledParagraph.js +22 -0
- package/dist/esm/styled/content/StyledTitle.js +22 -0
- package/dist/esm/styled/global-alert/StyledGlobalAlert.js +85 -0
- package/dist/esm/styled/global-alert/StyledGlobalAlertButton.js +75 -0
- package/dist/esm/styled/global-alert/StyledGlobalAlertClose.js +74 -0
- package/dist/esm/styled/global-alert/StyledGlobalAlertContent.js +22 -0
- package/dist/esm/styled/global-alert/StyledGlobalAlertIcon.js +36 -0
- package/dist/esm/styled/global-alert/StyledGlobalAlertTitle.js +38 -0
- package/dist/esm/types/index.js +9 -0
- package/dist/esm/utils/icons.js +25 -0
- package/dist/esm/utils/useNotificationsContext.js +14 -0
- package/dist/index.cjs.js +42 -52
- package/package.json +6 -6
- package/dist/index.esm.js +0 -1134
|
@@ -0,0 +1,23 @@
|
|
|
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 { getColorV8, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledBase } from './StyledBase.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'notifications.well';
|
|
12
|
+
const StyledWell = styled(StyledBase).attrs({
|
|
13
|
+
'data-garden-id': COMPONENT_ID,
|
|
14
|
+
'data-garden-version': '9.0.0-next.8'
|
|
15
|
+
}).withConfig({
|
|
16
|
+
displayName: "StyledWell",
|
|
17
|
+
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
|
+
};
|
|
22
|
+
|
|
23
|
+
export { StyledWell };
|
|
@@ -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 { getColorV8, focusStyles, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'notifications.close';
|
|
11
|
+
const StyledClose = styled.button.attrs({
|
|
12
|
+
'data-garden-id': COMPONENT_ID,
|
|
13
|
+
'data-garden-version': '9.0.0-next.8'
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "StyledClose",
|
|
16
|
+
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
|
+
};
|
|
24
|
+
|
|
25
|
+
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.8'
|
|
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,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 { getColorV8, 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.8'
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "StyledTitle",
|
|
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
|
+
};
|
|
21
|
+
|
|
22
|
+
export { StyledTitle };
|
|
@@ -0,0 +1,85 @@
|
|
|
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, getColorV8, focusStyles, getLineHeight } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'notifications.global-alert';
|
|
11
|
+
const colorStyles = props => {
|
|
12
|
+
let borderColor;
|
|
13
|
+
let backgroundColor;
|
|
14
|
+
let foregroundColor;
|
|
15
|
+
let anchorHoverColor;
|
|
16
|
+
let anchorActiveColor;
|
|
17
|
+
let focusColor;
|
|
18
|
+
switch (props.alertType) {
|
|
19
|
+
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;
|
|
27
|
+
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;
|
|
35
|
+
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;
|
|
43
|
+
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;
|
|
51
|
+
}
|
|
52
|
+
const boxShadow = `0 ${props.theme.borderWidths.sm} ${props.theme.borderWidths.sm} ${borderColor}`;
|
|
53
|
+
return css(["box-shadow:", ";background-color:", ";color:", ";& a{color:inherit;", " &:hover{color:", ";}&:active{color:", ";}}"], boxShadow, backgroundColor, foregroundColor, focusStyles({
|
|
54
|
+
theme: props.theme,
|
|
55
|
+
color: {
|
|
56
|
+
hue: focusColor,
|
|
57
|
+
shade: props.alertType === 'info' ? 600 : 800
|
|
58
|
+
},
|
|
59
|
+
styles: {
|
|
60
|
+
color: 'inherit'
|
|
61
|
+
}
|
|
62
|
+
}), anchorHoverColor, anchorActiveColor);
|
|
63
|
+
};
|
|
64
|
+
const sizeStyles = props => {
|
|
65
|
+
const {
|
|
66
|
+
fontSizes,
|
|
67
|
+
space
|
|
68
|
+
} = props.theme;
|
|
69
|
+
const minHeight = space.base * 13;
|
|
70
|
+
const padding = space.base * 4;
|
|
71
|
+
const lineHeight = getLineHeight(space.base * 5, fontSizes.md);
|
|
72
|
+
return css(["padding:", "px;min-height:", "px;line-height:", ";font-size:", ";"], padding, minHeight, lineHeight, fontSizes.md);
|
|
73
|
+
};
|
|
74
|
+
const StyledGlobalAlert = styled.div.attrs({
|
|
75
|
+
'data-garden-id': COMPONENT_ID,
|
|
76
|
+
'data-garden-version': '9.0.0-next.8'
|
|
77
|
+
}).withConfig({
|
|
78
|
+
displayName: "StyledGlobalAlert",
|
|
79
|
+
componentId: "sc-k6rimt-0"
|
|
80
|
+
})(["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
|
+
|
|
85
|
+
export { StyledGlobalAlert };
|
|
@@ -0,0 +1,75 @@
|
|
|
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, getColorV8, 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
|
+
if (props.isBasic) {
|
|
15
|
+
return colorStyles$1(props);
|
|
16
|
+
}
|
|
17
|
+
let backgroundColor;
|
|
18
|
+
let hoverBackgroundColor;
|
|
19
|
+
let activeBackgroundColor;
|
|
20
|
+
let focusColor;
|
|
21
|
+
switch (props.alertType) {
|
|
22
|
+
case 'success':
|
|
23
|
+
backgroundColor = getColorV8('successHue', 800, props.theme);
|
|
24
|
+
hoverBackgroundColor = getColorV8('successHue', 900, props.theme);
|
|
25
|
+
activeBackgroundColor = getColorV8('successHue', 1000, props.theme);
|
|
26
|
+
focusColor = 'successHue';
|
|
27
|
+
break;
|
|
28
|
+
case 'error':
|
|
29
|
+
backgroundColor = getColorV8('dangerHue', 800, props.theme);
|
|
30
|
+
hoverBackgroundColor = getColorV8('dangerHue', 900, props.theme);
|
|
31
|
+
activeBackgroundColor = getColorV8('dangerHue', 1000, props.theme);
|
|
32
|
+
focusColor = 'dangerHue';
|
|
33
|
+
break;
|
|
34
|
+
case 'warning':
|
|
35
|
+
backgroundColor = getColorV8('warningHue', 800, props.theme);
|
|
36
|
+
hoverBackgroundColor = getColorV8('warningHue', 900, props.theme);
|
|
37
|
+
activeBackgroundColor = getColorV8('warningHue', 1000, props.theme);
|
|
38
|
+
focusColor = 'warningHue';
|
|
39
|
+
break;
|
|
40
|
+
case 'info':
|
|
41
|
+
focusColor = 'primaryHue';
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
return css(["background-color:", ";&:hover{background-color:", ";}", " &:active{background-color:", ";}"], backgroundColor, hoverBackgroundColor, focusStyles({
|
|
45
|
+
theme: props.theme,
|
|
46
|
+
color: {
|
|
47
|
+
hue: focusColor,
|
|
48
|
+
shade: props.alertType === 'info' ? 600 : 800
|
|
49
|
+
}
|
|
50
|
+
}), activeBackgroundColor);
|
|
51
|
+
}
|
|
52
|
+
function sizeStyles(props) {
|
|
53
|
+
const marginVertical = `-${props.theme.space.base * 1.5}px`;
|
|
54
|
+
const marginStart = `${props.theme.space.base * 2}px`;
|
|
55
|
+
return css(["margin:", " ", " ", " ", ";"], marginVertical, props.theme.rtl ? marginStart : 0, marginVertical, props.theme.rtl ? 0 : marginStart);
|
|
56
|
+
}
|
|
57
|
+
const StyledGlobalAlertButton = styled(Button).attrs({
|
|
58
|
+
'data-garden-id': COMPONENT_ID,
|
|
59
|
+
'data-garden-version': '9.0.0-next.8',
|
|
60
|
+
focusInset: false,
|
|
61
|
+
isDanger: false,
|
|
62
|
+
isLink: false,
|
|
63
|
+
isNeutral: false,
|
|
64
|
+
isPill: false,
|
|
65
|
+
isStretched: false,
|
|
66
|
+
size: 'small'
|
|
67
|
+
}).withConfig({
|
|
68
|
+
displayName: "StyledGlobalAlertButton",
|
|
69
|
+
componentId: "sc-1txe91a-0"
|
|
70
|
+
})(["flex-shrink:0;", ";", ";", ";"], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
71
|
+
StyledGlobalAlertButton.defaultProps = {
|
|
72
|
+
theme: DEFAULT_THEME
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export { StyledGlobalAlertButton };
|
|
@@ -0,0 +1,74 @@
|
|
|
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, getColorV8, 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
|
+
let hoverBackgroundColor;
|
|
14
|
+
let hoverForegroundColor;
|
|
15
|
+
let activeBackgroundColor;
|
|
16
|
+
let activeForegroundColor;
|
|
17
|
+
let focusColor;
|
|
18
|
+
switch (props.alertType) {
|
|
19
|
+
case 'success':
|
|
20
|
+
hoverBackgroundColor = getColorV8('successHue', 100, props.theme, 0.08);
|
|
21
|
+
hoverForegroundColor = props.theme.palette.white;
|
|
22
|
+
activeBackgroundColor = getColorV8('successHue', 100, props.theme, 0.2);
|
|
23
|
+
activeForegroundColor = props.theme.palette.white;
|
|
24
|
+
focusColor = 'successHue';
|
|
25
|
+
break;
|
|
26
|
+
case 'error':
|
|
27
|
+
hoverBackgroundColor = getColorV8('dangerHue', 100, props.theme, 0.08);
|
|
28
|
+
hoverForegroundColor = props.theme.palette.white;
|
|
29
|
+
activeBackgroundColor = getColorV8('dangerHue', 100, props.theme, 0.2);
|
|
30
|
+
activeForegroundColor = props.theme.palette.white;
|
|
31
|
+
focusColor = 'dangerHue';
|
|
32
|
+
break;
|
|
33
|
+
case 'warning':
|
|
34
|
+
hoverBackgroundColor = getColorV8('warningHue', 800, props.theme, 0.08);
|
|
35
|
+
hoverForegroundColor = getColorV8('warningHue', 900, props.theme);
|
|
36
|
+
activeBackgroundColor = getColorV8('warningHue', 800, props.theme, 0.2);
|
|
37
|
+
activeForegroundColor = getColorV8('warningHue', 1000, props.theme);
|
|
38
|
+
focusColor = 'warningHue';
|
|
39
|
+
break;
|
|
40
|
+
case 'info':
|
|
41
|
+
hoverBackgroundColor = getColorV8('primaryHue', 700, props.theme, 0.08);
|
|
42
|
+
hoverForegroundColor = getColorV8('primaryHue', 800, props.theme);
|
|
43
|
+
activeBackgroundColor = getColorV8('primaryHue', 700, props.theme, 0.2);
|
|
44
|
+
activeForegroundColor = getColorV8('primaryHue', 900, props.theme);
|
|
45
|
+
focusColor = 'primaryHue';
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
return css(["color:inherit;&:hover{background-color:", ";color:", ";}", " &:active{background-color:", ";color:", ";}"], hoverBackgroundColor, hoverForegroundColor, focusStyles({
|
|
49
|
+
theme: props.theme,
|
|
50
|
+
color: {
|
|
51
|
+
hue: focusColor,
|
|
52
|
+
shade: props.alertType === 'info' ? 600 : 800
|
|
53
|
+
}
|
|
54
|
+
}), activeBackgroundColor, activeForegroundColor);
|
|
55
|
+
};
|
|
56
|
+
const sizeStyles = props => {
|
|
57
|
+
const marginVertical = `-${props.theme.space.base * 1.5}px`;
|
|
58
|
+
const marginStart = `${props.theme.space.base * 2}px`;
|
|
59
|
+
const marginEnd = `-${props.theme.space.base * 2}px`;
|
|
60
|
+
return css(["margin:", " ", " ", " ", ";"], marginVertical, props.theme.rtl ? marginStart : marginEnd, marginVertical, props.theme.rtl ? marginEnd : marginStart);
|
|
61
|
+
};
|
|
62
|
+
const StyledGlobalAlertClose = styled(IconButton).attrs({
|
|
63
|
+
'data-garden-id': COMPONENT_ID,
|
|
64
|
+
'data-garden-version': '9.0.0-next.8',
|
|
65
|
+
size: 'small'
|
|
66
|
+
}).withConfig({
|
|
67
|
+
displayName: "StyledGlobalAlertClose",
|
|
68
|
+
componentId: "sc-1g5s93s-0"
|
|
69
|
+
})(["", ";", ";", ";"], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
70
|
+
StyledGlobalAlertClose.defaultProps = {
|
|
71
|
+
theme: DEFAULT_THEME
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
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.8'
|
|
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 };
|
|
@@ -0,0 +1,36 @@
|
|
|
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 React__default, { Children } from 'react';
|
|
8
|
+
import styled, { css } from 'styled-components';
|
|
9
|
+
import { math } from 'polished';
|
|
10
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
11
|
+
|
|
12
|
+
const COMPONENT_ID = 'notifications.global-alert.icon';
|
|
13
|
+
const sizeStyles = props => {
|
|
14
|
+
const size = props.theme.iconSizes.md;
|
|
15
|
+
const marginTop = math(`(${props.theme.space.base * 5} - ${size}) / 2`);
|
|
16
|
+
const marginHorizontal = `${props.theme.space.base * 2}px`;
|
|
17
|
+
return css(["margin-top:", ";margin-", ":", ";width:", ";height:", ";"], marginTop, props.theme.rtl ? 'left' : 'right', marginHorizontal, size, size);
|
|
18
|
+
};
|
|
19
|
+
const StyledGlobalAlertIcon = styled(_ref => {
|
|
20
|
+
let {
|
|
21
|
+
children,
|
|
22
|
+
...props
|
|
23
|
+
} = _ref;
|
|
24
|
+
return React__default.cloneElement(Children.only(children), props);
|
|
25
|
+
}).attrs({
|
|
26
|
+
'data-garden-id': COMPONENT_ID,
|
|
27
|
+
'data-garden-version': '9.0.0-next.8'
|
|
28
|
+
}).withConfig({
|
|
29
|
+
displayName: "StyledGlobalAlertIcon",
|
|
30
|
+
componentId: "sc-84ne9k-0"
|
|
31
|
+
})(["flex-shrink:0;", ";", ";"], sizeStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
32
|
+
StyledGlobalAlertIcon.defaultProps = {
|
|
33
|
+
theme: DEFAULT_THEME
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { StyledGlobalAlertIcon };
|
|
@@ -0,0 +1,38 @@
|
|
|
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, getColorV8 } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'notifications.global-alert.title';
|
|
11
|
+
const colorStyles = props => {
|
|
12
|
+
let color;
|
|
13
|
+
switch (props.alertType) {
|
|
14
|
+
case 'success':
|
|
15
|
+
case 'error':
|
|
16
|
+
color = props.theme.palette.white;
|
|
17
|
+
break;
|
|
18
|
+
case 'warning':
|
|
19
|
+
color = getColorV8('warningHue', 900, props.theme);
|
|
20
|
+
break;
|
|
21
|
+
case 'info':
|
|
22
|
+
color = getColorV8('primaryHue', 800, props.theme);
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
return css(["color:", ";"], color);
|
|
26
|
+
};
|
|
27
|
+
const StyledGlobalAlertTitle = styled.div.attrs({
|
|
28
|
+
'data-garden-id': COMPONENT_ID,
|
|
29
|
+
'data-garden-version': '9.0.0-next.8'
|
|
30
|
+
}).withConfig({
|
|
31
|
+
displayName: "StyledGlobalAlertTitle",
|
|
32
|
+
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));
|
|
34
|
+
StyledGlobalAlertTitle.defaultProps = {
|
|
35
|
+
theme: DEFAULT_THEME
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { StyledGlobalAlertTitle };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import SvgAlertErrorStroke from '../node_modules/@zendeskgarden/svg-icons/src/16/alert-error-stroke.svg.js';
|
|
8
|
+
import SvgCheckCircleStroke from '../node_modules/@zendeskgarden/svg-icons/src/16/check-circle-stroke.svg.js';
|
|
9
|
+
import SvgAlertWarningStroke from '../node_modules/@zendeskgarden/svg-icons/src/16/alert-warning-stroke.svg.js';
|
|
10
|
+
import SvgInfoStroke from '../node_modules/@zendeskgarden/svg-icons/src/16/info-stroke.svg.js';
|
|
11
|
+
|
|
12
|
+
const validationIcons = {
|
|
13
|
+
success: SvgCheckCircleStroke,
|
|
14
|
+
error: SvgAlertErrorStroke,
|
|
15
|
+
warning: SvgAlertWarningStroke,
|
|
16
|
+
info: SvgInfoStroke
|
|
17
|
+
};
|
|
18
|
+
const validationHues = {
|
|
19
|
+
success: 'successHue',
|
|
20
|
+
error: 'dangerHue',
|
|
21
|
+
warning: 'warningHue',
|
|
22
|
+
info: 'neutralHue'
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { validationHues, validationIcons };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import { createContext, useContext } from 'react';
|
|
8
|
+
|
|
9
|
+
const NotificationsContext = createContext(undefined);
|
|
10
|
+
const useNotificationsContext = () => {
|
|
11
|
+
return useContext(NotificationsContext);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { NotificationsContext, useNotificationsContext };
|