@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.
- package/dist/esm/elements/Close.js +40 -0
- package/dist/esm/elements/Notification.js +8 -9
- package/dist/esm/elements/{Well.js → Paragraph.js} +5 -15
- package/dist/esm/elements/Title.js +35 -0
- package/dist/esm/elements/alert/Alert.js +56 -0
- package/dist/esm/elements/{content → alert}/Close.js +8 -5
- package/dist/esm/elements/{content → alert}/Paragraph.js +1 -1
- package/dist/esm/elements/{content → alert}/Title.js +11 -4
- 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/elements/toaster/styled.js +0 -7
- package/dist/esm/elements/well/Well.js +47 -0
- package/dist/esm/index.js +5 -5
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/alert-error-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/alert-warning-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/check-circle-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/info-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/x-stroke.svg.js +1 -1
- package/dist/esm/styled/StyledAlert.js +29 -6
- package/dist/esm/styled/StyledBase.js +62 -27
- package/dist/esm/styled/StyledIcon.js +47 -7
- package/dist/esm/styled/StyledNotification.js +19 -28
- package/dist/esm/styled/StyledWell.js +28 -7
- package/dist/esm/styled/content/StyledClose.js +53 -11
- package/dist/esm/styled/content/StyledParagraph.js +2 -5
- package/dist/esm/styled/content/StyledTitle.js +6 -6
- package/dist/esm/styled/global-alert/StyledGlobalAlert.js +113 -41
- package/dist/esm/styled/global-alert/StyledGlobalAlertButton.js +76 -36
- package/dist/esm/styled/global-alert/StyledGlobalAlertClose.js +60 -34
- package/dist/esm/styled/global-alert/StyledGlobalAlertContent.js +3 -6
- package/dist/esm/styled/global-alert/StyledGlobalAlertIcon.js +40 -7
- package/dist/esm/styled/global-alert/StyledGlobalAlertTitle.js +20 -12
- package/dist/esm/utils/icons.js +6 -6
- package/dist/index.cjs.js +793 -428
- package/dist/typings/elements/Notification.d.ts +4 -4
- package/dist/typings/elements/{content/Title.d.ts → Title.d.ts} +1 -1
- package/dist/typings/elements/{Alert.d.ts → alert/Alert.d.ts} +5 -5
- package/dist/typings/elements/alert/Close.d.ts +11 -0
- package/dist/typings/elements/alert/Paragraph.d.ts +11 -0
- package/dist/typings/elements/alert/Title.d.ts +12 -0
- package/dist/typings/elements/global-alert/GlobalAlert.d.ts +8 -1
- package/dist/typings/elements/toaster/Toast.d.ts +0 -1
- package/dist/typings/elements/well/Paragraph.d.ts +11 -0
- package/dist/typings/elements/well/Title.d.ts +12 -0
- package/dist/typings/elements/{Well.d.ts → well/Well.d.ts} +4 -4
- package/dist/typings/index.d.ts +5 -5
- 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 -2
- 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 +4 -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 +4 -18
- package/dist/typings/styled/global-alert/StyledGlobalAlertClose.d.ts +2 -4
- package/dist/typings/styled/global-alert/StyledGlobalAlertIcon.d.ts +0 -1
- 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 -2
- package/dist/typings/utils/useNotificationsContext.d.ts +2 -4
- package/package.json +9 -10
- package/LICENSE.md +0 -176
- package/dist/esm/elements/Alert.js +0 -56
- 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
- /package/dist/typings/elements/{content/Close.d.ts → Close.d.ts} +0 -0
- /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,
|
|
8
|
+
import { getLineHeight, retrieveComponentStyles, getColor } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { validationTypes } from '../utils/icons.js';
|
|
9
10
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
49
|
+
bgVariable = 'background.raised';
|
|
50
|
+
borderVariable = 'border.default';
|
|
51
|
+
fgVariable = 'foreground.default';
|
|
35
52
|
}
|
|
36
|
-
|
|
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.
|
|
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:", ";
|
|
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,
|
|
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
|
|
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;
|
|
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,
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
|
37
|
-
|
|
26
|
+
case validationTypes.error:
|
|
27
|
+
variable = 'foreground.danger';
|
|
38
28
|
break;
|
|
39
|
-
case
|
|
40
|
-
|
|
29
|
+
case validationTypes.warning:
|
|
30
|
+
variable = 'foreground.warning';
|
|
41
31
|
break;
|
|
42
|
-
|
|
43
|
-
|
|
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
|
|
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 {
|
|
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
|
|
38
|
+
'data-garden-version': '9.0.0'
|
|
15
39
|
}).withConfig({
|
|
16
40
|
displayName: "StyledWell",
|
|
17
41
|
componentId: "sc-a5831c-0"
|
|
18
|
-
})(["
|
|
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 {
|
|
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
|
|
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
|
|
61
|
+
'data-garden-version': '9.0.0'
|
|
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));
|
|
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
|
|
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
|
|
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 {
|
|
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
|
|
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:", ";", ";"],
|
|
18
|
-
|
|
19
|
-
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,
|
|
8
|
+
import { retrieveComponentStyles, 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,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
|
|
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 };
|