@semcore/notice 4.0.1 → 4.1.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/CHANGELOG.md +20 -0
- package/lib/cjs/Notice.js +28 -19
- package/lib/cjs/Notice.js.map +1 -1
- package/lib/cjs/index.d.ts +6 -1
- package/lib/cjs/style/notice.shadow.css +24 -24
- package/lib/es6/Notice.js +25 -19
- package/lib/es6/Notice.js.map +1 -1
- package/lib/es6/index.d.ts +6 -1
- package/lib/es6/style/notice.shadow.css +24 -24
- package/lib/types/index.d.ts +6 -1
- package/package.json +3 -2
- package/src/Notice.jsx +13 -3
- package/src/index.d.ts +6 -1
- package/src/style/notice.shadow.css +24 -24
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [4.1.0] - 2022-05-30
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Changed animation duration from 200ms to 250ms.
|
|
10
|
+
- Set prop `use` in deprecated. Added fallback on `NoticeGlobal`.
|
|
11
|
+
- Add styles for Close icon hover.
|
|
12
|
+
|
|
13
|
+
## [4.0.3] - 2022-05-23
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- Version patch update due to children dependencies update (`@semcore/icon` [2.25.1 ~> 2.26.0]).
|
|
18
|
+
|
|
19
|
+
## [4.0.2] - 2022-05-19
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Version patch update due to children dependencies update (`@semcore/animation` [1.5.0 ~> 1.5.1], `@semcore/utils` [3.32.0 ~> 3.32.1], `@semcore/flex-box` [4.5.1 ~> 4.5.3], `@semcore/icon` [2.25.0 ~> 2.25.1]).
|
|
24
|
+
|
|
5
25
|
## [4.0.1] - 2022-05-18
|
|
6
26
|
|
|
7
27
|
### Changed
|
package/lib/cjs/Notice.js
CHANGED
|
@@ -33,6 +33,10 @@ var _color = _interopRequireDefault(require("@semcore/utils/lib/color"));
|
|
|
33
33
|
|
|
34
34
|
var _animation = require("@semcore/animation");
|
|
35
35
|
|
|
36
|
+
var _logger = _interopRequireDefault(require("@semcore/utils/lib/logger"));
|
|
37
|
+
|
|
38
|
+
var _noticeGlobal = _interopRequireDefault(require("@semcore/notice-global"));
|
|
39
|
+
|
|
36
40
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
41
|
|
|
38
42
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -50,25 +54,23 @@ var style = (
|
|
|
50
54
|
/*__reshadow_css_start__*/
|
|
51
55
|
_core.sstyled.insert(
|
|
52
56
|
/*__inner_css_start__*/
|
|
53
|
-
".
|
|
57
|
+
".___SNotice_uwgyz_gg_{display:flex;padding:16px;font-size:14px;line-height:1.42;box-sizing:border-box;border-style:solid;border-width:1px;border-radius:6px}.___SNotice_uwgyz_gg_._theme_info_uwgyz_gg_{background-color:#e9f7ff;border-color:#8ecdff}.___SNotice_uwgyz_gg_._theme_info_uwgyz_gg_ .___SCloseIcon_uwgyz_gg_{color:#008ff8}.___SNotice_uwgyz_gg_._theme_info_uwgyz_gg_ .___SCloseIcon_uwgyz_gg_:hover{color:#006dca}.___SNotice_uwgyz_gg_._theme_danger_uwgyz_gg_{background-color:#fff0f7;border-color:#ffaeb5}.___SNotice_uwgyz_gg_._theme_danger_uwgyz_gg_ .___SCloseIcon_uwgyz_gg_{color:#ff4953}.___SNotice_uwgyz_gg_._theme_danger_uwgyz_gg_ .___SCloseIcon_uwgyz_gg_:hover{color:#d1002f}.___SNotice_uwgyz_gg_._theme_warning_uwgyz_gg_{background-color:#fff3d9;border-color:#ffb26e}.___SNotice_uwgyz_gg_._theme_warning_uwgyz_gg_ .___SCloseIcon_uwgyz_gg_{color:#ff622d}.___SNotice_uwgyz_gg_._theme_warning_uwgyz_gg_ .___SCloseIcon_uwgyz_gg_:hover{color:#c33909}.___SNotice_uwgyz_gg_._theme_success_uwgyz_gg_{background-color:#dbfee8;border-color:#59ddaa}.___SNotice_uwgyz_gg_._theme_success_uwgyz_gg_ .___SCloseIcon_uwgyz_gg_{color:#009f81}.___SNotice_uwgyz_gg_._theme_success_uwgyz_gg_ .___SCloseIcon_uwgyz_gg_:hover{color:#007c65}.___SContent_uwgyz_gg_{flex:1 1 auto;width:100%}.___SActions_uwgyz_gg_{flex-shrink:0;margin-top:12px}.___SLabel_uwgyz_gg_{margin-top:2px;margin-right:8px;display:inline-flex}.___SLabel_uwgyz_gg_._theme_info_uwgyz_gg_{color:#8a8e9b}.___SLabel_uwgyz_gg_._theme_danger_uwgyz_gg_{color:#ff4953}.___SLabel_uwgyz_gg_._theme_warning_uwgyz_gg_{color:#ff622d}.___SLabel_uwgyz_gg_._theme_success_uwgyz_gg_{color:#009f81}.___SLabel_uwgyz_gg_._theme_custom_uwgyz_gg_{color:var(--color_gatqwf)}.___SCloseIcon_uwgyz_gg_{flex-shrink:0;margin-left:16px}.___SNotice_uwgyz_gg_._theme_custom_uwgyz_gg_{background-color:var(--backgroundColor_gatqwf);border-color:var(--backgroundColor_gatqwf)}"
|
|
54
58
|
/*__inner_css_end__*/
|
|
55
|
-
, "
|
|
59
|
+
, "gatqwf_gg_")
|
|
56
60
|
/*__reshadow_css_end__*/
|
|
57
61
|
, {
|
|
58
|
-
"__SNotice": "
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"--color": "--color_3l4djo",
|
|
71
|
-
"--backgroundColor": "--backgroundColor_3l4djo"
|
|
62
|
+
"__SNotice": "___SNotice_uwgyz_gg_",
|
|
63
|
+
"_theme_info": "_theme_info_uwgyz_gg_",
|
|
64
|
+
"__SCloseIcon": "___SCloseIcon_uwgyz_gg_",
|
|
65
|
+
"_theme_danger": "_theme_danger_uwgyz_gg_",
|
|
66
|
+
"_theme_warning": "_theme_warning_uwgyz_gg_",
|
|
67
|
+
"_theme_success": "_theme_success_uwgyz_gg_",
|
|
68
|
+
"__SContent": "___SContent_uwgyz_gg_",
|
|
69
|
+
"__SActions": "___SActions_uwgyz_gg_",
|
|
70
|
+
"__SLabel": "___SLabel_uwgyz_gg_",
|
|
71
|
+
"_theme_custom": "_theme_custom_uwgyz_gg_",
|
|
72
|
+
"--color": "--color_gatqwf",
|
|
73
|
+
"--backgroundColor": "--backgroundColor_gatqwf"
|
|
72
74
|
});
|
|
73
75
|
|
|
74
76
|
function isCustomTheme(theme) {
|
|
@@ -104,9 +106,17 @@ var RootNotice = /*#__PURE__*/function (_Component) {
|
|
|
104
106
|
Children = _this$asProps.Children,
|
|
105
107
|
styles = _this$asProps.styles,
|
|
106
108
|
hidden = _this$asProps.hidden,
|
|
107
|
-
theme = _this$asProps.theme
|
|
109
|
+
theme = _this$asProps.theme,
|
|
110
|
+
use = _this$asProps.use;
|
|
108
111
|
var color = (0, _color["default"])(theme);
|
|
109
112
|
var useTheme = isCustomTheme(theme) ? 'custom' : theme;
|
|
113
|
+
|
|
114
|
+
if (use === 'primary') {
|
|
115
|
+
_logger["default"].warn(true, "This deprecated property, you should use component <NoticeGlobal/>", RootNotice.displayName);
|
|
116
|
+
|
|
117
|
+
return /*#__PURE__*/_react["default"].createElement(_noticeGlobal["default"], this.asProps);
|
|
118
|
+
}
|
|
119
|
+
|
|
110
120
|
return _ref6 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SNotice, _ref6.cn("SNotice", _objectSpread({}, (0, _core.assignProps)({
|
|
111
121
|
"visible": !hidden,
|
|
112
122
|
"use:theme": useTheme,
|
|
@@ -122,8 +132,7 @@ var RootNotice = /*#__PURE__*/function (_Component) {
|
|
|
122
132
|
(0, _defineProperty2["default"])(RootNotice, "style", style);
|
|
123
133
|
(0, _defineProperty2["default"])(RootNotice, "defaultProps", {
|
|
124
134
|
theme: 'info',
|
|
125
|
-
|
|
126
|
-
duration: 200
|
|
135
|
+
duration: 250
|
|
127
136
|
});
|
|
128
137
|
|
|
129
138
|
function Label(_ref11) {
|
package/lib/cjs/Notice.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Notice.jsx"],"names":["isCustomTheme","theme","includes","RootNotice","asProps","SNotice","FadeInOut","Children","styles","hidden","color","useTheme","
|
|
1
|
+
{"version":3,"sources":["../../src/Notice.jsx"],"names":["isCustomTheme","theme","includes","RootNotice","asProps","SNotice","FadeInOut","Children","styles","hidden","use","color","useTheme","logger","warn","displayName","Component","style","duration","Label","SLabel","Box","Actions","SActions","Content","SContent","CloseIcon","SCloseIcon","Close"],"mappings":"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","sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport Close from '@semcore/icon/Close/m';\nimport resolveColor from '@semcore/utils/lib/color';\nimport { FadeInOut } from '@semcore/animation';\nimport logger from '@semcore/utils/lib/logger';\nimport NoticeGlobal from '@semcore/notice-global';\n\nimport style from './style/notice.shadow.css';\n\nfunction isCustomTheme(theme) {\n return !['danger', 'warning', 'success', 'info'].includes(theme);\n}\n\nclass RootNotice extends Component {\n static displayName = 'Notice';\n static style = style;\n static defaultProps = {\n theme: 'info',\n duration: 250,\n };\n\n getLabelProps() {\n const { theme } = this.asProps;\n return {\n theme,\n };\n }\n\n render() {\n const SNotice = Root;\n const { Children, styles, hidden, theme, use } = this.asProps;\n const color = resolveColor(theme);\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n\n if (use === 'primary') {\n logger.warn(\n true,\n `This deprecated property, you should use component <NoticeGlobal/>`,\n RootNotice.displayName,\n );\n return <NoticeGlobal {...this.asProps} />;\n }\n\n return sstyled(styles)(\n <SNotice\n render={FadeInOut}\n visible={!hidden}\n use:theme={useTheme}\n backgroundColor={color}\n role=\"alert\"\n >\n <Children />\n </SNotice>,\n );\n }\n}\n\nfunction Label({ styles, theme }) {\n const SLabel = Root;\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n const color = resolveColor(theme);\n return sstyled(styles)(<SLabel render={Box} use:theme={useTheme} color={color} />);\n}\n\nfunction Actions({ styles }) {\n const SActions = Root;\n return sstyled(styles)(<SActions render={Box} />);\n}\n\nfunction Content({ styles }) {\n const SContent = Root;\n return sstyled(styles)(<SContent render={Box} />);\n}\n\nfunction CloseIcon({ styles }) {\n const SCloseIcon = Root;\n return sstyled(styles)(\n <SCloseIcon render={Box} tag={Close} interactive aria-label=\"Close alert\" />,\n );\n}\n\nexport default createComponent(RootNotice, {\n Label,\n Actions,\n Content,\n CloseIcon,\n});\n"],"file":"Notice.js"}
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -3,17 +3,22 @@ import { Box, IBoxProps } from '@semcore/flex-box';
|
|
|
3
3
|
import { IIconProps } from '@semcore/icon';
|
|
4
4
|
|
|
5
5
|
export type NoticeTheme = 'danger' | 'warning' | 'success' | 'info' | string;
|
|
6
|
+
export type NoticeUse = 'primary' | 'secondary';
|
|
6
7
|
|
|
7
8
|
export interface INoticeProps extends IBoxProps {
|
|
8
9
|
/** Property for managing visibility of Notice */
|
|
9
10
|
hidden?: boolean;
|
|
11
|
+
/** Notice type
|
|
12
|
+
* @deprecated since version ^4.1.0
|
|
13
|
+
*/
|
|
14
|
+
use?: NoticeUse;
|
|
10
15
|
/**
|
|
11
16
|
* Notice theme
|
|
12
17
|
* @default info
|
|
13
18
|
*/
|
|
14
19
|
theme?: NoticeTheme;
|
|
15
20
|
/** Duration of animation, ms
|
|
16
|
-
* @default
|
|
21
|
+
* @default 250
|
|
17
22
|
*/
|
|
18
23
|
duration?: number;
|
|
19
24
|
}
|
|
@@ -2,17 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
SNotice {
|
|
4
4
|
display: flex;
|
|
5
|
+
padding: 16px;
|
|
5
6
|
font-size: var(--fs-200);
|
|
6
7
|
line-height: var(--lh-200);
|
|
7
8
|
box-sizing: border-box;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
SNotice[use='primary'] {
|
|
11
|
-
padding: 8px 32px;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
SNotice[use='secondary'] {
|
|
15
|
-
padding: 16px;
|
|
16
9
|
border-style: solid;
|
|
17
10
|
border-width: 1px;
|
|
18
11
|
border-radius: var(--rounded-m);
|
|
@@ -20,43 +13,53 @@ SNotice[use='secondary'] {
|
|
|
20
13
|
|
|
21
14
|
SNotice[theme='info'] {
|
|
22
15
|
background-color: var(--blue-50);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
16
|
+
border-color: var(--blue-200);
|
|
17
|
+
|
|
26
18
|
& SCloseIcon {
|
|
27
19
|
color: var(--blue-400);
|
|
20
|
+
|
|
21
|
+
&:hover {
|
|
22
|
+
color: var(--blue-500);
|
|
23
|
+
}
|
|
28
24
|
}
|
|
29
25
|
}
|
|
30
26
|
|
|
31
27
|
SNotice[theme='danger'] {
|
|
32
28
|
background-color: var(--red-50);
|
|
29
|
+
border-color: var(--red-200);
|
|
33
30
|
|
|
34
|
-
&[use='secondary'] {
|
|
35
|
-
border-color: var(--red-200);
|
|
36
|
-
}
|
|
37
31
|
& SCloseIcon {
|
|
38
32
|
color: var(--red-400);
|
|
33
|
+
|
|
34
|
+
&:hover {
|
|
35
|
+
color: var(--red-500);
|
|
36
|
+
}
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
39
|
|
|
42
40
|
SNotice[theme='warning'] {
|
|
43
41
|
background-color: var(--orange-50);
|
|
42
|
+
border-color: var(--orange-200);
|
|
44
43
|
|
|
45
|
-
&[use='secondary'] {
|
|
46
|
-
border-color: var(--orange-200);
|
|
47
|
-
}
|
|
48
44
|
& SCloseIcon {
|
|
49
45
|
color: var(--orange-400);
|
|
46
|
+
|
|
47
|
+
&:hover {
|
|
48
|
+
color: var(--orange-500);
|
|
49
|
+
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
SNotice[theme='success'] {
|
|
54
54
|
background-color: var(--green-50);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
55
|
+
border-color: var(--green-200);
|
|
56
|
+
|
|
58
57
|
& SCloseIcon {
|
|
59
58
|
color: var(--green-400);
|
|
59
|
+
|
|
60
|
+
&:hover {
|
|
61
|
+
color: var(--green-500);
|
|
62
|
+
}
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
65
|
|
|
@@ -103,8 +106,5 @@ SCloseIcon {
|
|
|
103
106
|
|
|
104
107
|
SNotice[theme='custom'] {
|
|
105
108
|
background-color: var(--backgroundColor);
|
|
106
|
-
|
|
107
|
-
&[use='secondary'] {
|
|
108
|
-
border-color: var(--backgroundColor);
|
|
109
|
-
}
|
|
109
|
+
border-color: var(--backgroundColor);
|
|
110
110
|
}
|
package/lib/es6/Notice.js
CHANGED
|
@@ -25,31 +25,31 @@ import { Box } from '@semcore/flex-box';
|
|
|
25
25
|
import Close from '@semcore/icon/Close/m';
|
|
26
26
|
import resolveColor from '@semcore/utils/lib/color';
|
|
27
27
|
import { FadeInOut } from '@semcore/animation';
|
|
28
|
+
import logger from '@semcore/utils/lib/logger';
|
|
29
|
+
import NoticeGlobal from '@semcore/notice-global';
|
|
28
30
|
|
|
29
31
|
/*__reshadow-styles__:"./style/notice.shadow.css"*/
|
|
30
32
|
var style = (
|
|
31
33
|
/*__reshadow_css_start__*/
|
|
32
34
|
_sstyled.insert(
|
|
33
35
|
/*__inner_css_start__*/
|
|
34
|
-
".
|
|
36
|
+
".___SNotice_uwgyz_gg_{display:flex;padding:16px;font-size:14px;line-height:1.42;box-sizing:border-box;border-style:solid;border-width:1px;border-radius:6px}.___SNotice_uwgyz_gg_._theme_info_uwgyz_gg_{background-color:#e9f7ff;border-color:#8ecdff}.___SNotice_uwgyz_gg_._theme_info_uwgyz_gg_ .___SCloseIcon_uwgyz_gg_{color:#008ff8}.___SNotice_uwgyz_gg_._theme_info_uwgyz_gg_ .___SCloseIcon_uwgyz_gg_:hover{color:#006dca}.___SNotice_uwgyz_gg_._theme_danger_uwgyz_gg_{background-color:#fff0f7;border-color:#ffaeb5}.___SNotice_uwgyz_gg_._theme_danger_uwgyz_gg_ .___SCloseIcon_uwgyz_gg_{color:#ff4953}.___SNotice_uwgyz_gg_._theme_danger_uwgyz_gg_ .___SCloseIcon_uwgyz_gg_:hover{color:#d1002f}.___SNotice_uwgyz_gg_._theme_warning_uwgyz_gg_{background-color:#fff3d9;border-color:#ffb26e}.___SNotice_uwgyz_gg_._theme_warning_uwgyz_gg_ .___SCloseIcon_uwgyz_gg_{color:#ff622d}.___SNotice_uwgyz_gg_._theme_warning_uwgyz_gg_ .___SCloseIcon_uwgyz_gg_:hover{color:#c33909}.___SNotice_uwgyz_gg_._theme_success_uwgyz_gg_{background-color:#dbfee8;border-color:#59ddaa}.___SNotice_uwgyz_gg_._theme_success_uwgyz_gg_ .___SCloseIcon_uwgyz_gg_{color:#009f81}.___SNotice_uwgyz_gg_._theme_success_uwgyz_gg_ .___SCloseIcon_uwgyz_gg_:hover{color:#007c65}.___SContent_uwgyz_gg_{flex:1 1 auto;width:100%}.___SActions_uwgyz_gg_{flex-shrink:0;margin-top:12px}.___SLabel_uwgyz_gg_{margin-top:2px;margin-right:8px;display:inline-flex}.___SLabel_uwgyz_gg_._theme_info_uwgyz_gg_{color:#8a8e9b}.___SLabel_uwgyz_gg_._theme_danger_uwgyz_gg_{color:#ff4953}.___SLabel_uwgyz_gg_._theme_warning_uwgyz_gg_{color:#ff622d}.___SLabel_uwgyz_gg_._theme_success_uwgyz_gg_{color:#009f81}.___SLabel_uwgyz_gg_._theme_custom_uwgyz_gg_{color:var(--color_gatqwf)}.___SCloseIcon_uwgyz_gg_{flex-shrink:0;margin-left:16px}.___SNotice_uwgyz_gg_._theme_custom_uwgyz_gg_{background-color:var(--backgroundColor_gatqwf);border-color:var(--backgroundColor_gatqwf)}"
|
|
35
37
|
/*__inner_css_end__*/
|
|
36
|
-
, "
|
|
38
|
+
, "gatqwf_gg_")
|
|
37
39
|
/*__reshadow_css_end__*/
|
|
38
40
|
, {
|
|
39
|
-
"__SNotice": "
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"--color": "--color_3l4djo",
|
|
52
|
-
"--backgroundColor": "--backgroundColor_3l4djo"
|
|
41
|
+
"__SNotice": "___SNotice_uwgyz_gg_",
|
|
42
|
+
"_theme_info": "_theme_info_uwgyz_gg_",
|
|
43
|
+
"__SCloseIcon": "___SCloseIcon_uwgyz_gg_",
|
|
44
|
+
"_theme_danger": "_theme_danger_uwgyz_gg_",
|
|
45
|
+
"_theme_warning": "_theme_warning_uwgyz_gg_",
|
|
46
|
+
"_theme_success": "_theme_success_uwgyz_gg_",
|
|
47
|
+
"__SContent": "___SContent_uwgyz_gg_",
|
|
48
|
+
"__SActions": "___SActions_uwgyz_gg_",
|
|
49
|
+
"__SLabel": "___SLabel_uwgyz_gg_",
|
|
50
|
+
"_theme_custom": "_theme_custom_uwgyz_gg_",
|
|
51
|
+
"--color": "--color_gatqwf",
|
|
52
|
+
"--backgroundColor": "--backgroundColor_gatqwf"
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
function isCustomTheme(theme) {
|
|
@@ -86,9 +86,16 @@ var RootNotice = /*#__PURE__*/function (_Component) {
|
|
|
86
86
|
Children = _this$asProps.Children,
|
|
87
87
|
styles = _this$asProps.styles,
|
|
88
88
|
hidden = _this$asProps.hidden,
|
|
89
|
-
theme = _this$asProps.theme
|
|
89
|
+
theme = _this$asProps.theme,
|
|
90
|
+
use = _this$asProps.use;
|
|
90
91
|
var color = resolveColor(theme);
|
|
91
92
|
var useTheme = isCustomTheme(theme) ? 'custom' : theme;
|
|
93
|
+
|
|
94
|
+
if (use === 'primary') {
|
|
95
|
+
logger.warn(true, "This deprecated property, you should use component <NoticeGlobal/>", RootNotice.displayName);
|
|
96
|
+
return /*#__PURE__*/React.createElement(NoticeGlobal, this.asProps);
|
|
97
|
+
}
|
|
98
|
+
|
|
92
99
|
return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SNotice, _ref6.cn("SNotice", _objectSpread({}, _assignProps({
|
|
93
100
|
"visible": !hidden,
|
|
94
101
|
"use:theme": useTheme,
|
|
@@ -107,8 +114,7 @@ _defineProperty(RootNotice, "style", style);
|
|
|
107
114
|
|
|
108
115
|
_defineProperty(RootNotice, "defaultProps", {
|
|
109
116
|
theme: 'info',
|
|
110
|
-
|
|
111
|
-
duration: 200
|
|
117
|
+
duration: 250
|
|
112
118
|
});
|
|
113
119
|
|
|
114
120
|
function Label(_ref11) {
|
package/lib/es6/Notice.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Notice.jsx"],"names":["React","createComponent","Component","sstyled","Root","Box","Close","resolveColor","FadeInOut","isCustomTheme","theme","includes","RootNotice","asProps","SNotice","Children","styles","hidden","color","useTheme","
|
|
1
|
+
{"version":3,"sources":["../../src/Notice.jsx"],"names":["React","createComponent","Component","sstyled","Root","Box","Close","resolveColor","FadeInOut","logger","NoticeGlobal","isCustomTheme","theme","includes","RootNotice","asProps","SNotice","Children","styles","hidden","use","color","useTheme","warn","displayName","style","duration","Label","SLabel","Actions","SActions","Content","SContent","CloseIcon","SCloseIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,eAAP,IAA0BC,SAA1B,EAAqCC,OAArC,EAA8CC,IAA9C,QAA0D,eAA1D;AACA,SAASC,GAAT,QAAoB,mBAApB;AACA,OAAOC,KAAP,MAAkB,uBAAlB;AACA,OAAOC,YAAP,MAAyB,0BAAzB;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,OAAOC,MAAP,MAAmB,2BAAnB;AACA,OAAOC,YAAP,MAAyB,wBAAzB;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAASC,aAAT,CAAuBC,KAAvB,EAA8B;AAC5B,SAAO,CAAC,CAAC,QAAD,EAAW,SAAX,EAAsB,SAAtB,EAAiC,MAAjC,EAAyCC,QAAzC,CAAkDD,KAAlD,CAAR;AACD;;IAEKE,U;;;;;;;;;;;;;WAQJ,yBAAgB;AACd,UAAQF,KAAR,GAAkB,KAAKG,OAAvB,CAAQH,KAAR;AACA,aAAO;AACLA,QAAAA,KAAK,EAALA;AADK,OAAP;AAGD;;;WAED,kBAAS;AAAA;AAAA;;AACP,UAAMI,OAAO,GAgBDR,SAhBZ;AACA,0BAAiD,KAAKO,OAAtD;AAAA,UAAQE,QAAR,iBAAQA,QAAR;AAAA,UAAkBC,MAAlB,iBAAkBA,MAAlB;AAAA,UAA0BC,MAA1B,iBAA0BA,MAA1B;AAAA,UAAkCP,KAAlC,iBAAkCA,KAAlC;AAAA,UAAyCQ,GAAzC,iBAAyCA,GAAzC;AACA,UAAMC,KAAK,GAAGd,YAAY,CAACK,KAAD,CAA1B;AACA,UAAMU,QAAQ,GAAGX,aAAa,CAACC,KAAD,CAAb,GAAuB,QAAvB,GAAkCA,KAAnD;;AAEA,UAAIQ,GAAG,KAAK,SAAZ,EAAuB;AACrBX,QAAAA,MAAM,CAACc,IAAP,CACE,IADF,wEAGET,UAAU,CAACU,WAHb;AAKA,4BAAO,oBAAC,YAAD,EAAkB,KAAKT,OAAvB,CAAP;AACD;;AAED,qBAAOZ,OAAO,CAACe,MAAD,CAAd,eACE,oBAAC,OAAD;AAAA,mBAEW,CAACC,MAFZ;AAAA,qBAGaG,QAHb;AAAA,2BAImBD,KAJnB;AAAA,gBAKO;AALP,+BAOE,oBAAC,QAAD,2BAPF,CADF;AAWD;;;;EAzCsBnB,S;;gBAAnBY,U,iBACiB,Q;;gBADjBA,U,WAEWW,K;;gBAFXX,U,kBAGkB;AACpBF,EAAAA,KAAK,EAAE,MADa;AAEpBc,EAAAA,QAAQ,EAAE;AAFU,C;;AAyCxB,SAASC,KAAT,SAAkC;AAAA;AAAA;;AAAA,MAAjBT,MAAiB,UAAjBA,MAAiB;AAAA,MAATN,KAAS,UAATA,KAAS;AAChC,MAAMgB,MAAM,GAG2BvB,GAHvC;AACA,MAAMiB,QAAQ,GAAGX,aAAa,CAACC,KAAD,CAAb,GAAuB,QAAvB,GAAkCA,KAAnD;AACA,MAAMS,KAAK,GAAGd,YAAY,CAACK,KAAD,CAA1B;AACA,iBAAOT,OAAO,CAACe,MAAD,CAAd,eAAuB,oBAAC,MAAD;AAAA,iBAAgCI,QAAhC;AAAA,aAAiDD;AAAjD,cAAvB;AACD;;AAED,SAASQ,OAAT,SAA6B;AAAA;AAAA;;AAAA,MAAVX,MAAU,UAAVA,MAAU;AAC3B,MAAMY,QAAQ,GAC2BzB,GADzC;AACA,iBAAOF,OAAO,CAACe,MAAD,CAAd,eAAuB,oBAAC,QAAD,oEAAvB;AACD;;AAED,SAASa,OAAT,SAA6B;AAAA;AAAA;;AAAA,MAAVb,MAAU,UAAVA,MAAU;AAC3B,MAAMc,QAAQ,GAC2B3B,GADzC;AACA,iBAAOF,OAAO,CAACe,MAAD,CAAd,eAAuB,oBAAC,QAAD,oEAAvB;AACD;;AAED,SAASe,SAAT,SAA+B;AAAA;AAAA;;AAAA,MAAVf,MAAU,UAAVA,MAAU;AAC7B,MAAMgB,UAAU,GAEM7B,GAFtB;AACA,kBAAOF,OAAO,CAACe,MAAD,CAAd,eACE,oBAAC,UAAD;AAAA,WAA8BZ,KAA9B;AAAA;AAAA,kBAA4D;AAA5D,cADF;AAGD;;AAED,eAAeL,eAAe,CAACa,UAAD,EAAa;AACzCa,EAAAA,KAAK,EAALA,KADyC;AAEzCE,EAAAA,OAAO,EAAPA,OAFyC;AAGzCE,EAAAA,OAAO,EAAPA,OAHyC;AAIzCE,EAAAA,SAAS,EAATA;AAJyC,CAAb,CAA9B","sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport Close from '@semcore/icon/Close/m';\nimport resolveColor from '@semcore/utils/lib/color';\nimport { FadeInOut } from '@semcore/animation';\nimport logger from '@semcore/utils/lib/logger';\nimport NoticeGlobal from '@semcore/notice-global';\n\nimport style from './style/notice.shadow.css';\n\nfunction isCustomTheme(theme) {\n return !['danger', 'warning', 'success', 'info'].includes(theme);\n}\n\nclass RootNotice extends Component {\n static displayName = 'Notice';\n static style = style;\n static defaultProps = {\n theme: 'info',\n duration: 250,\n };\n\n getLabelProps() {\n const { theme } = this.asProps;\n return {\n theme,\n };\n }\n\n render() {\n const SNotice = Root;\n const { Children, styles, hidden, theme, use } = this.asProps;\n const color = resolveColor(theme);\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n\n if (use === 'primary') {\n logger.warn(\n true,\n `This deprecated property, you should use component <NoticeGlobal/>`,\n RootNotice.displayName,\n );\n return <NoticeGlobal {...this.asProps} />;\n }\n\n return sstyled(styles)(\n <SNotice\n render={FadeInOut}\n visible={!hidden}\n use:theme={useTheme}\n backgroundColor={color}\n role=\"alert\"\n >\n <Children />\n </SNotice>,\n );\n }\n}\n\nfunction Label({ styles, theme }) {\n const SLabel = Root;\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n const color = resolveColor(theme);\n return sstyled(styles)(<SLabel render={Box} use:theme={useTheme} color={color} />);\n}\n\nfunction Actions({ styles }) {\n const SActions = Root;\n return sstyled(styles)(<SActions render={Box} />);\n}\n\nfunction Content({ styles }) {\n const SContent = Root;\n return sstyled(styles)(<SContent render={Box} />);\n}\n\nfunction CloseIcon({ styles }) {\n const SCloseIcon = Root;\n return sstyled(styles)(\n <SCloseIcon render={Box} tag={Close} interactive aria-label=\"Close alert\" />,\n );\n}\n\nexport default createComponent(RootNotice, {\n Label,\n Actions,\n Content,\n CloseIcon,\n});\n"],"file":"Notice.js"}
|
package/lib/es6/index.d.ts
CHANGED
|
@@ -3,17 +3,22 @@ import { Box, IBoxProps } from '@semcore/flex-box';
|
|
|
3
3
|
import { IIconProps } from '@semcore/icon';
|
|
4
4
|
|
|
5
5
|
export type NoticeTheme = 'danger' | 'warning' | 'success' | 'info' | string;
|
|
6
|
+
export type NoticeUse = 'primary' | 'secondary';
|
|
6
7
|
|
|
7
8
|
export interface INoticeProps extends IBoxProps {
|
|
8
9
|
/** Property for managing visibility of Notice */
|
|
9
10
|
hidden?: boolean;
|
|
11
|
+
/** Notice type
|
|
12
|
+
* @deprecated since version ^4.1.0
|
|
13
|
+
*/
|
|
14
|
+
use?: NoticeUse;
|
|
10
15
|
/**
|
|
11
16
|
* Notice theme
|
|
12
17
|
* @default info
|
|
13
18
|
*/
|
|
14
19
|
theme?: NoticeTheme;
|
|
15
20
|
/** Duration of animation, ms
|
|
16
|
-
* @default
|
|
21
|
+
* @default 250
|
|
17
22
|
*/
|
|
18
23
|
duration?: number;
|
|
19
24
|
}
|
|
@@ -2,17 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
SNotice {
|
|
4
4
|
display: flex;
|
|
5
|
+
padding: 16px;
|
|
5
6
|
font-size: var(--fs-200);
|
|
6
7
|
line-height: var(--lh-200);
|
|
7
8
|
box-sizing: border-box;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
SNotice[use='primary'] {
|
|
11
|
-
padding: 8px 32px;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
SNotice[use='secondary'] {
|
|
15
|
-
padding: 16px;
|
|
16
9
|
border-style: solid;
|
|
17
10
|
border-width: 1px;
|
|
18
11
|
border-radius: var(--rounded-m);
|
|
@@ -20,43 +13,53 @@ SNotice[use='secondary'] {
|
|
|
20
13
|
|
|
21
14
|
SNotice[theme='info'] {
|
|
22
15
|
background-color: var(--blue-50);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
16
|
+
border-color: var(--blue-200);
|
|
17
|
+
|
|
26
18
|
& SCloseIcon {
|
|
27
19
|
color: var(--blue-400);
|
|
20
|
+
|
|
21
|
+
&:hover {
|
|
22
|
+
color: var(--blue-500);
|
|
23
|
+
}
|
|
28
24
|
}
|
|
29
25
|
}
|
|
30
26
|
|
|
31
27
|
SNotice[theme='danger'] {
|
|
32
28
|
background-color: var(--red-50);
|
|
29
|
+
border-color: var(--red-200);
|
|
33
30
|
|
|
34
|
-
&[use='secondary'] {
|
|
35
|
-
border-color: var(--red-200);
|
|
36
|
-
}
|
|
37
31
|
& SCloseIcon {
|
|
38
32
|
color: var(--red-400);
|
|
33
|
+
|
|
34
|
+
&:hover {
|
|
35
|
+
color: var(--red-500);
|
|
36
|
+
}
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
39
|
|
|
42
40
|
SNotice[theme='warning'] {
|
|
43
41
|
background-color: var(--orange-50);
|
|
42
|
+
border-color: var(--orange-200);
|
|
44
43
|
|
|
45
|
-
&[use='secondary'] {
|
|
46
|
-
border-color: var(--orange-200);
|
|
47
|
-
}
|
|
48
44
|
& SCloseIcon {
|
|
49
45
|
color: var(--orange-400);
|
|
46
|
+
|
|
47
|
+
&:hover {
|
|
48
|
+
color: var(--orange-500);
|
|
49
|
+
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
SNotice[theme='success'] {
|
|
54
54
|
background-color: var(--green-50);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
55
|
+
border-color: var(--green-200);
|
|
56
|
+
|
|
58
57
|
& SCloseIcon {
|
|
59
58
|
color: var(--green-400);
|
|
59
|
+
|
|
60
|
+
&:hover {
|
|
61
|
+
color: var(--green-500);
|
|
62
|
+
}
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
65
|
|
|
@@ -103,8 +106,5 @@ SCloseIcon {
|
|
|
103
106
|
|
|
104
107
|
SNotice[theme='custom'] {
|
|
105
108
|
background-color: var(--backgroundColor);
|
|
106
|
-
|
|
107
|
-
&[use='secondary'] {
|
|
108
|
-
border-color: var(--backgroundColor);
|
|
109
|
-
}
|
|
109
|
+
border-color: var(--backgroundColor);
|
|
110
110
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -3,17 +3,22 @@ import { Box, IBoxProps } from '@semcore/flex-box';
|
|
|
3
3
|
import { IIconProps } from '@semcore/icon';
|
|
4
4
|
|
|
5
5
|
export type NoticeTheme = 'danger' | 'warning' | 'success' | 'info' | string;
|
|
6
|
+
export type NoticeUse = 'primary' | 'secondary';
|
|
6
7
|
|
|
7
8
|
export interface INoticeProps extends IBoxProps {
|
|
8
9
|
/** Property for managing visibility of Notice */
|
|
9
10
|
hidden?: boolean;
|
|
11
|
+
/** Notice type
|
|
12
|
+
* @deprecated since version ^4.1.0
|
|
13
|
+
*/
|
|
14
|
+
use?: NoticeUse;
|
|
10
15
|
/**
|
|
11
16
|
* Notice theme
|
|
12
17
|
* @default info
|
|
13
18
|
*/
|
|
14
19
|
theme?: NoticeTheme;
|
|
15
20
|
/** Duration of animation, ms
|
|
16
|
-
* @default
|
|
21
|
+
* @default 250
|
|
17
22
|
*/
|
|
18
23
|
duration?: number;
|
|
19
24
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/notice",
|
|
3
3
|
"description": "SEMRush Notice Component",
|
|
4
|
-
"version": "4.0
|
|
4
|
+
"version": "4.1.0",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"@semcore/animation": "^1",
|
|
17
17
|
"@semcore/utils": "^3.15",
|
|
18
18
|
"@semcore/flex-box": "^4",
|
|
19
|
-
"@semcore/icon": "^2.16"
|
|
19
|
+
"@semcore/icon": "^2.16",
|
|
20
|
+
"@semcore/notice-global": "^1"
|
|
20
21
|
},
|
|
21
22
|
"peerDependencies": {
|
|
22
23
|
"@semcore/core": "^1.11",
|
package/src/Notice.jsx
CHANGED
|
@@ -4,6 +4,8 @@ import { Box } from '@semcore/flex-box';
|
|
|
4
4
|
import Close from '@semcore/icon/Close/m';
|
|
5
5
|
import resolveColor from '@semcore/utils/lib/color';
|
|
6
6
|
import { FadeInOut } from '@semcore/animation';
|
|
7
|
+
import logger from '@semcore/utils/lib/logger';
|
|
8
|
+
import NoticeGlobal from '@semcore/notice-global';
|
|
7
9
|
|
|
8
10
|
import style from './style/notice.shadow.css';
|
|
9
11
|
|
|
@@ -16,8 +18,7 @@ class RootNotice extends Component {
|
|
|
16
18
|
static style = style;
|
|
17
19
|
static defaultProps = {
|
|
18
20
|
theme: 'info',
|
|
19
|
-
|
|
20
|
-
duration: 200,
|
|
21
|
+
duration: 250,
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
getLabelProps() {
|
|
@@ -29,10 +30,19 @@ class RootNotice extends Component {
|
|
|
29
30
|
|
|
30
31
|
render() {
|
|
31
32
|
const SNotice = Root;
|
|
32
|
-
const { Children, styles, hidden, theme } = this.asProps;
|
|
33
|
+
const { Children, styles, hidden, theme, use } = this.asProps;
|
|
33
34
|
const color = resolveColor(theme);
|
|
34
35
|
const useTheme = isCustomTheme(theme) ? 'custom' : theme;
|
|
35
36
|
|
|
37
|
+
if (use === 'primary') {
|
|
38
|
+
logger.warn(
|
|
39
|
+
true,
|
|
40
|
+
`This deprecated property, you should use component <NoticeGlobal/>`,
|
|
41
|
+
RootNotice.displayName,
|
|
42
|
+
);
|
|
43
|
+
return <NoticeGlobal {...this.asProps} />;
|
|
44
|
+
}
|
|
45
|
+
|
|
36
46
|
return sstyled(styles)(
|
|
37
47
|
<SNotice
|
|
38
48
|
render={FadeInOut}
|
package/src/index.d.ts
CHANGED
|
@@ -3,17 +3,22 @@ import { Box, IBoxProps } from '@semcore/flex-box';
|
|
|
3
3
|
import { IIconProps } from '@semcore/icon';
|
|
4
4
|
|
|
5
5
|
export type NoticeTheme = 'danger' | 'warning' | 'success' | 'info' | string;
|
|
6
|
+
export type NoticeUse = 'primary' | 'secondary';
|
|
6
7
|
|
|
7
8
|
export interface INoticeProps extends IBoxProps {
|
|
8
9
|
/** Property for managing visibility of Notice */
|
|
9
10
|
hidden?: boolean;
|
|
11
|
+
/** Notice type
|
|
12
|
+
* @deprecated since version ^4.1.0
|
|
13
|
+
*/
|
|
14
|
+
use?: NoticeUse;
|
|
10
15
|
/**
|
|
11
16
|
* Notice theme
|
|
12
17
|
* @default info
|
|
13
18
|
*/
|
|
14
19
|
theme?: NoticeTheme;
|
|
15
20
|
/** Duration of animation, ms
|
|
16
|
-
* @default
|
|
21
|
+
* @default 250
|
|
17
22
|
*/
|
|
18
23
|
duration?: number;
|
|
19
24
|
}
|
|
@@ -2,17 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
SNotice {
|
|
4
4
|
display: flex;
|
|
5
|
+
padding: 16px;
|
|
5
6
|
font-size: var(--fs-200);
|
|
6
7
|
line-height: var(--lh-200);
|
|
7
8
|
box-sizing: border-box;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
SNotice[use='primary'] {
|
|
11
|
-
padding: 8px 32px;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
SNotice[use='secondary'] {
|
|
15
|
-
padding: 16px;
|
|
16
9
|
border-style: solid;
|
|
17
10
|
border-width: 1px;
|
|
18
11
|
border-radius: var(--rounded-m);
|
|
@@ -20,43 +13,53 @@ SNotice[use='secondary'] {
|
|
|
20
13
|
|
|
21
14
|
SNotice[theme='info'] {
|
|
22
15
|
background-color: var(--blue-50);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
16
|
+
border-color: var(--blue-200);
|
|
17
|
+
|
|
26
18
|
& SCloseIcon {
|
|
27
19
|
color: var(--blue-400);
|
|
20
|
+
|
|
21
|
+
&:hover {
|
|
22
|
+
color: var(--blue-500);
|
|
23
|
+
}
|
|
28
24
|
}
|
|
29
25
|
}
|
|
30
26
|
|
|
31
27
|
SNotice[theme='danger'] {
|
|
32
28
|
background-color: var(--red-50);
|
|
29
|
+
border-color: var(--red-200);
|
|
33
30
|
|
|
34
|
-
&[use='secondary'] {
|
|
35
|
-
border-color: var(--red-200);
|
|
36
|
-
}
|
|
37
31
|
& SCloseIcon {
|
|
38
32
|
color: var(--red-400);
|
|
33
|
+
|
|
34
|
+
&:hover {
|
|
35
|
+
color: var(--red-500);
|
|
36
|
+
}
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
39
|
|
|
42
40
|
SNotice[theme='warning'] {
|
|
43
41
|
background-color: var(--orange-50);
|
|
42
|
+
border-color: var(--orange-200);
|
|
44
43
|
|
|
45
|
-
&[use='secondary'] {
|
|
46
|
-
border-color: var(--orange-200);
|
|
47
|
-
}
|
|
48
44
|
& SCloseIcon {
|
|
49
45
|
color: var(--orange-400);
|
|
46
|
+
|
|
47
|
+
&:hover {
|
|
48
|
+
color: var(--orange-500);
|
|
49
|
+
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
SNotice[theme='success'] {
|
|
54
54
|
background-color: var(--green-50);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
55
|
+
border-color: var(--green-200);
|
|
56
|
+
|
|
58
57
|
& SCloseIcon {
|
|
59
58
|
color: var(--green-400);
|
|
59
|
+
|
|
60
|
+
&:hover {
|
|
61
|
+
color: var(--green-500);
|
|
62
|
+
}
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
65
|
|
|
@@ -103,8 +106,5 @@ SCloseIcon {
|
|
|
103
106
|
|
|
104
107
|
SNotice[theme='custom'] {
|
|
105
108
|
background-color: var(--backgroundColor);
|
|
106
|
-
|
|
107
|
-
&[use='secondary'] {
|
|
108
|
-
border-color: var(--backgroundColor);
|
|
109
|
-
}
|
|
109
|
+
border-color: var(--backgroundColor);
|
|
110
110
|
}
|