@semcore/notice 3.1.1 → 3.2.1
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 +18 -0
- package/lib/cjs/Notice.js +30 -32
- package/lib/cjs/Notice.js.map +1 -1
- package/lib/cjs/NoticeSmart.js +6 -2
- package/lib/cjs/NoticeSmart.js.map +1 -1
- package/lib/cjs/style/notice.shadow.css +18 -2
- package/lib/es6/Notice.js +24 -30
- package/lib/es6/Notice.js.map +1 -1
- package/lib/es6/NoticeSmart.js.map +1 -1
- package/lib/es6/style/notice.shadow.css +18 -2
- package/package.json +8 -3
- package/src/Notice.js +5 -6
- package/src/style/notice.shadow.css +18 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [3.2.1] - 2022-02-24
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added repository field to package.json file.
|
|
10
|
+
|
|
11
|
+
## [3.2.0] - 2022-01-18
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Up version icons and use new icon.
|
|
16
|
+
|
|
17
|
+
## [3.1.2] - 2021-12-08
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Moved SLabel colors to style
|
|
22
|
+
|
|
5
23
|
## [3.1.1] - 2021-8-26
|
|
6
24
|
|
|
7
25
|
### Changed
|
package/lib/cjs/Notice.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
4
|
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
@@ -27,15 +27,19 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
27
27
|
|
|
28
28
|
var _flexBox = require("@semcore/flex-box");
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _m = _interopRequireDefault(require("@semcore/icon/Close/m"));
|
|
31
31
|
|
|
32
32
|
var _color = _interopRequireDefault(require("@semcore/utils/lib/color"));
|
|
33
33
|
|
|
34
34
|
var _animation = require("@semcore/animation");
|
|
35
35
|
|
|
36
|
-
function
|
|
36
|
+
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
|
+
|
|
38
|
+
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; }
|
|
37
39
|
|
|
38
|
-
function
|
|
40
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
41
|
+
|
|
42
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
39
43
|
|
|
40
44
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
41
45
|
|
|
@@ -46,39 +50,31 @@ var style = (
|
|
|
46
50
|
/*__reshadow_css_start__*/
|
|
47
51
|
_core.sstyled.insert(
|
|
48
52
|
/*__inner_css_start__*/
|
|
49
|
-
".
|
|
53
|
+
".___SNotice_1jw1k_gg_{display:flex;font-size:12px;line-height:1.5;box-sizing:border-box}.___SNotice_1jw1k_gg_._use_primary_1jw1k_gg_{padding:8px 32px}.___SNotice_1jw1k_gg_._use_secondary_1jw1k_gg_{padding:15px;border-style:solid;border-width:1px;border-radius:2px}.___SNotice_1jw1k_gg_._theme_info_1jw1k_gg_{background-color:rgba(43,148,225,.15)}.___SNotice_1jw1k_gg_._theme_info_1jw1k_gg_._use_secondary_1jw1k_gg_{border-color:rgba(43,148,225,.25)}.___SNotice_1jw1k_gg_._theme_danger_1jw1k_gg_{background-color:rgba(237,45,45,.1)}.___SNotice_1jw1k_gg_._theme_danger_1jw1k_gg_._use_secondary_1jw1k_gg_{border-color:rgba(237,45,45,.2)}.___SNotice_1jw1k_gg_._theme_warning_1jw1k_gg_{background-color:rgba(249,177,89,.15)}.___SNotice_1jw1k_gg_._theme_warning_1jw1k_gg_._use_secondary_1jw1k_gg_{border-color:rgba(249,177,89,.4)}.___SNotice_1jw1k_gg_._theme_success_1jw1k_gg_{background-color:rgba(79,174,51,.15)}.___SNotice_1jw1k_gg_._theme_success_1jw1k_gg_._use_secondary_1jw1k_gg_{border-color:rgba(79,174,51,.3)}.___SContent_1jw1k_gg_{flex:1 1 auto;width:100%}.___SActions_1jw1k_gg_{flex-shrink:0;margin-top:12px}.___SLabel_1jw1k_gg_{margin-right:8px;display:inline-flex}.___SLabel_1jw1k_gg_._theme_danger_1jw1k_gg_{color:#ed2d2d}.___SLabel_1jw1k_gg_._theme_info_1jw1k_gg_{color:#a6b0b3}.___SLabel_1jw1k_gg_._theme_success_1jw1k_gg_{color:#4fae33}.___SLabel_1jw1k_gg_._theme_warning_1jw1k_gg_{color:#f9b159}.___SLabel_1jw1k_gg_._theme_custom_1jw1k_gg_{color:var(--color_1du3pp1)}.___SCloseIcon_1jw1k_gg_{flex-shrink:0;margin-left:16px}.___SNotice_1jw1k_gg_._theme_custom_1jw1k_gg_{background-color:var(--backgroundColor_1du3pp1)}.___SNotice_1jw1k_gg_._theme_custom_1jw1k_gg_._use_secondary_1jw1k_gg_{border-color:var(--backgroundColor_1du3pp1)}"
|
|
50
54
|
/*__inner_css_end__*/
|
|
51
|
-
, "
|
|
55
|
+
, "1du3pp1_gg_")
|
|
52
56
|
/*__reshadow_css_end__*/
|
|
53
57
|
, {
|
|
54
|
-
"__SNotice": "
|
|
55
|
-
"_use_primary": "
|
|
56
|
-
"_use_secondary": "
|
|
57
|
-
"_theme_info": "
|
|
58
|
-
"_theme_danger": "
|
|
59
|
-
"_theme_warning": "
|
|
60
|
-
"_theme_success": "
|
|
61
|
-
"__SContent": "
|
|
62
|
-
"__SActions": "
|
|
63
|
-
"__SLabel": "
|
|
64
|
-
"
|
|
65
|
-
"--
|
|
66
|
-
"__SCloseIcon": "
|
|
67
|
-
"
|
|
68
|
-
"--backgroundColor": "--backgroundColor_8h0fr7"
|
|
58
|
+
"__SNotice": "___SNotice_1jw1k_gg_",
|
|
59
|
+
"_use_primary": "_use_primary_1jw1k_gg_",
|
|
60
|
+
"_use_secondary": "_use_secondary_1jw1k_gg_",
|
|
61
|
+
"_theme_info": "_theme_info_1jw1k_gg_",
|
|
62
|
+
"_theme_danger": "_theme_danger_1jw1k_gg_",
|
|
63
|
+
"_theme_warning": "_theme_warning_1jw1k_gg_",
|
|
64
|
+
"_theme_success": "_theme_success_1jw1k_gg_",
|
|
65
|
+
"__SContent": "___SContent_1jw1k_gg_",
|
|
66
|
+
"__SActions": "___SActions_1jw1k_gg_",
|
|
67
|
+
"__SLabel": "___SLabel_1jw1k_gg_",
|
|
68
|
+
"_theme_custom": "_theme_custom_1jw1k_gg_",
|
|
69
|
+
"--color": "--color_1du3pp1",
|
|
70
|
+
"__SCloseIcon": "___SCloseIcon_1jw1k_gg_",
|
|
71
|
+
"--backgroundColor": "--backgroundColor_1du3pp1"
|
|
69
72
|
});
|
|
70
73
|
|
|
71
74
|
function isCustomTheme(theme) {
|
|
72
75
|
return !['danger', 'warning', 'success', 'info'].includes(theme);
|
|
73
76
|
}
|
|
74
77
|
|
|
75
|
-
var THEME_LABEL = {
|
|
76
|
-
info: 'stone',
|
|
77
|
-
success: 'green',
|
|
78
|
-
warning: 'orange',
|
|
79
|
-
danger: 'red'
|
|
80
|
-
};
|
|
81
|
-
|
|
82
78
|
var RootNotice = /*#__PURE__*/function (_Component) {
|
|
83
79
|
(0, _inherits2["default"])(RootNotice, _Component);
|
|
84
80
|
|
|
@@ -137,9 +133,11 @@ function Label(_ref11) {
|
|
|
137
133
|
var styles = _ref11.styles,
|
|
138
134
|
theme = _ref11.theme;
|
|
139
135
|
var SLabel = _flexBox.Box;
|
|
140
|
-
var useTheme = isCustomTheme(theme) ?
|
|
136
|
+
var useTheme = isCustomTheme(theme) ? 'custom' : theme;
|
|
137
|
+
var color = (0, _color["default"])(theme);
|
|
141
138
|
return _ref7 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SLabel, _ref7.cn("SLabel", _objectSpread({}, (0, _core.assignProps)({
|
|
142
|
-
"use:theme": useTheme
|
|
139
|
+
"use:theme": useTheme,
|
|
140
|
+
"color": color
|
|
143
141
|
}, _ref2))));
|
|
144
142
|
}
|
|
145
143
|
|
|
@@ -168,7 +166,7 @@ function CloseIcon(_ref14) {
|
|
|
168
166
|
var styles = _ref14.styles;
|
|
169
167
|
var SCloseIcon = _flexBox.Box;
|
|
170
168
|
return _ref10 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SCloseIcon, _ref10.cn("SCloseIcon", _objectSpread({}, (0, _core.assignProps)({
|
|
171
|
-
"tag":
|
|
169
|
+
"tag": _m["default"],
|
|
172
170
|
"color": "stone",
|
|
173
171
|
"interactive": true,
|
|
174
172
|
"aria-label": "Close alert"
|
package/lib/cjs/Notice.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Notice.js"],"names":["isCustomTheme","theme","includes","
|
|
1
|
+
{"version":3,"sources":["../../src/Notice.js"],"names":["isCustomTheme","theme","includes","RootNotice","asProps","SNotice","FadeInOut","Children","styles","hidden","color","useTheme","Component","style","use","duration","Label","SLabel","Box","Actions","SActions","Content","SContent","CloseIcon","SCloseIcon","Close"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;;AADA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAASA,aAAT,CAAuBC,KAAvB,EAA8B;AAC5B,SAAO,CAAC,CAAC,QAAD,EAAW,SAAX,EAAsB,SAAtB,EAAiC,MAAjC,EAAyCC,QAAzC,CAAkDD,KAAlD,CAAR;AACD;;IAEKE,U;;;;;;;;;;;;WASJ,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,GAODC,oBAPZ;AACA,0BAA4C,KAAKF,OAAjD;AAAA,UAAQG,QAAR,iBAAQA,QAAR;AAAA,UAAkBC,MAAlB,iBAAkBA,MAAlB;AAAA,UAA0BC,MAA1B,iBAA0BA,MAA1B;AAAA,UAAkCR,KAAlC,iBAAkCA,KAAlC;AACA,UAAMS,KAAK,GAAG,uBAAaT,KAAb,CAAd;AACA,UAAMU,QAAQ,GAAGX,aAAa,CAACC,KAAD,CAAb,GAAuB,QAAvB,GAAkCA,KAAnD;AAEA,qBAAO,mBAAQO,MAAR,CAAP,eACE,gCAAC,OAAD;AAAA,mBAEW,CAACC,MAFZ;AAAA,qBAGaE,QAHb;AAAA,2BAImBD,KAJnB;AAAA,gBAKO;AALP,+BAOE,gCAAC,QAAD,2BAPF,CADF;AAWD;;;EAjCsBE,e;;iCAAnBT,U,iBACiB,Q;iCADjBA,U,WAEWU,K;iCAFXV,U,kBAGkB;AACpBW,EAAAA,GAAG,EAAE,WADe;AAEpBb,EAAAA,KAAK,EAAE,MAFa;AAGpBc,EAAAA,QAAQ,EAAE;AAHU,C;;AAiCxB,SAASC,KAAT,SAAkC;AAAA;AAAA;;AAAA,MAAjBR,MAAiB,UAAjBA,MAAiB;AAAA,MAATP,KAAS,UAATA,KAAS;AAChC,MAAMgB,MAAM,GAG2BC,YAHvC;AACA,MAAMP,QAAQ,GAAGX,aAAa,CAACC,KAAD,CAAb,GAAuB,QAAvB,GAAkCA,KAAnD;AACA,MAAMS,KAAK,GAAG,uBAAaT,KAAb,CAAd;AACA,iBAAO,mBAAQO,MAAR,CAAP,eAAuB,gCAAC,MAAD;AAAA,iBAAgCG,QAAhC;AAAA,aAAiDD;AAAjD,cAAvB;AACD;;AAED,SAASS,OAAT,SAA6B;AAAA;AAAA;;AAAA,MAAVX,MAAU,UAAVA,MAAU;AAC3B,MAAMY,QAAQ,GAC2BF,YADzC;AACA,iBAAO,mBAAQV,MAAR,CAAP,eAAuB,gCAAC,QAAD,6EAAvB;AACD;;AAED,SAASa,OAAT,SAA6B;AAAA;AAAA;;AAAA,MAAVb,MAAU,UAAVA,MAAU;AAC3B,MAAMc,QAAQ,GAC2BJ,YADzC;AACA,iBAAO,mBAAQV,MAAR,CAAP,eAAuB,gCAAC,QAAD,6EAAvB;AACD;;AAED,SAASe,SAAT,SAA+B;AAAA;AAAA;;AAAA,MAAVf,MAAU,UAAVA,MAAU;AAC7B,MAAMgB,UAAU,GAEMN,YAFtB;AACA,kBAAO,mBAAQV,MAAR,CAAP,eACE,gCAAC,UAAD;AAAA,WAA8BiB,aAA9B;AAAA,aAA2C,OAA3C;AAAA;AAAA,kBAA0E;AAA1E,cADF;AAGD;;eAEc,sBAAgBtB,UAAhB,EAA4B;AACzCa,EAAAA,KAAK,EAALA,KADyC;AAEzCG,EAAAA,OAAO,EAAPA,OAFyC;AAGzCE,EAAAA,OAAO,EAAPA,OAHyC;AAIzCE,EAAAA,SAAS,EAATA;AAJyC,CAA5B,C","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';\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 use: 'secondary',\n theme: 'info',\n duration: 200,\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 } = this.asProps;\n const color = resolveColor(theme);\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\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} color=\"stone\" 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/NoticeSmart.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
4
|
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
@@ -29,6 +29,10 @@ var _isNode = _interopRequireDefault(require("@semcore/utils/lib/isNode"));
|
|
|
29
29
|
|
|
30
30
|
var _Notice = _interopRequireDefault(require("./Notice"));
|
|
31
31
|
|
|
32
|
+
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); }
|
|
33
|
+
|
|
34
|
+
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; }
|
|
35
|
+
|
|
32
36
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
33
37
|
|
|
34
38
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/NoticeSmart.js"],"names":["NoticeSmart","SNoticeSmart","Notice","asProps","Children","label","actions","closable","onClose","Component","theme"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;;AADA;;AAEA;;AACA
|
|
1
|
+
{"version":3,"sources":["../../src/NoticeSmart.js"],"names":["NoticeSmart","SNoticeSmart","Notice","asProps","Children","label","actions","closable","onClose","Component","theme"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;;AADA;;AAEA;;AACA;;;;;;;;;;IAEMA,W;;;;;;;;;;;;WAOJ,kBAAS;AAAA;;AACP,UAAMC,YAAY,GAGMC,kBAHxB;AACA,0BAAwD,KAAKC,OAA7D;AAAA,UAAQC,QAAR,iBAAQA,QAAR;AAAA,UAAkBC,KAAlB,iBAAkBA,KAAlB;AAAA,UAAyBC,OAAzB,iBAAyBA,OAAzB;AAAA,UAAkCC,QAAlC,iBAAkCA,QAAlC;AAAA,UAA4CC,OAA5C,iBAA4CA,OAA5C;AACA,0BACE,gCAAC,YAAD,oCACG,wBAAOH,KAAP,kBAAiB,gCAAC,kBAAD,CAAQ,KAAR,QAAeA,KAAf,CADpB,eAEE,gCAAC,kBAAD,CAAQ,OAAR,qBACE,gCAAC,QAAD,OADF,EAEG,wBAAOC,OAAP,kBAAmB,gCAAC,kBAAD,CAAQ,OAAR,QAAiBA,OAAjB,CAFtB,CAFF,EAMGC,QAAQ,iBAAI,gCAAC,kBAAD,CAAQ,SAAR;AAAkB,QAAA,OAAO,EAAEC;AAA3B,QANf,CADF;AAUD;;;EApBuBC,e;;iCAApBT,W,iBACiB,a;iCADjBA,W,kBAGkB;AACpBU,EAAAA,KAAK,EAAE;AADa,C;;eAoBT,sBAAgBV,WAAhB,C","sourcesContent":["import React from 'react';\nimport createComponent, { Component, Root } from '@semcore/core';\nimport isNode from '@semcore/utils/lib/isNode';\nimport Notice from './Notice';\n\nclass NoticeSmart extends Component {\n static displayName = 'NoticeSmart';\n\n static defaultProps = {\n theme: 'info',\n };\n\n render() {\n const SNoticeSmart = Root;\n const { Children, label, actions, closable, onClose } = this.asProps;\n return (\n <SNoticeSmart render={Notice}>\n {isNode(label) && <Notice.Label>{label}</Notice.Label>}\n <Notice.Content>\n <Children />\n {isNode(actions) && <Notice.Actions>{actions}</Notice.Actions>}\n </Notice.Content>\n {closable && <Notice.CloseIcon onClick={onClose} />}\n </SNoticeSmart>\n );\n }\n}\n\nexport default createComponent(NoticeSmart);\n"],"file":"NoticeSmart.js"}
|
|
@@ -64,8 +64,24 @@ SLabel {
|
|
|
64
64
|
display: inline-flex;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
SLabel[theme] {
|
|
68
|
-
color: var(--
|
|
67
|
+
SLabel[theme='danger'] {
|
|
68
|
+
color: var(--red);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
SLabel[theme='info'] {
|
|
72
|
+
color: var(--stone);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
SLabel[theme='success'] {
|
|
76
|
+
color: var(--green);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
SLabel[theme='warning'] {
|
|
80
|
+
color: var(--light-orange);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
SLabel[theme='custom'] {
|
|
84
|
+
color: var(--color);
|
|
69
85
|
}
|
|
70
86
|
|
|
71
87
|
SCloseIcon {
|
package/lib/es6/Notice.js
CHANGED
|
@@ -11,9 +11,9 @@ import { assignProps as _assignProps3 } from "@semcore/core";
|
|
|
11
11
|
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
12
12
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
13
13
|
|
|
14
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
15
|
|
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
17
|
|
|
18
18
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
19
19
|
|
|
@@ -22,7 +22,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
22
22
|
import React from 'react';
|
|
23
23
|
import createComponent, { Component, sstyled, Root } from '@semcore/core';
|
|
24
24
|
import { Box } from '@semcore/flex-box';
|
|
25
|
-
import
|
|
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
28
|
|
|
@@ -31,39 +31,31 @@ var style = (
|
|
|
31
31
|
/*__reshadow_css_start__*/
|
|
32
32
|
_sstyled.insert(
|
|
33
33
|
/*__inner_css_start__*/
|
|
34
|
-
".
|
|
34
|
+
".___SNotice_1jw1k_gg_{display:flex;font-size:12px;line-height:1.5;box-sizing:border-box}.___SNotice_1jw1k_gg_._use_primary_1jw1k_gg_{padding:8px 32px}.___SNotice_1jw1k_gg_._use_secondary_1jw1k_gg_{padding:15px;border-style:solid;border-width:1px;border-radius:2px}.___SNotice_1jw1k_gg_._theme_info_1jw1k_gg_{background-color:rgba(43,148,225,.15)}.___SNotice_1jw1k_gg_._theme_info_1jw1k_gg_._use_secondary_1jw1k_gg_{border-color:rgba(43,148,225,.25)}.___SNotice_1jw1k_gg_._theme_danger_1jw1k_gg_{background-color:rgba(237,45,45,.1)}.___SNotice_1jw1k_gg_._theme_danger_1jw1k_gg_._use_secondary_1jw1k_gg_{border-color:rgba(237,45,45,.2)}.___SNotice_1jw1k_gg_._theme_warning_1jw1k_gg_{background-color:rgba(249,177,89,.15)}.___SNotice_1jw1k_gg_._theme_warning_1jw1k_gg_._use_secondary_1jw1k_gg_{border-color:rgba(249,177,89,.4)}.___SNotice_1jw1k_gg_._theme_success_1jw1k_gg_{background-color:rgba(79,174,51,.15)}.___SNotice_1jw1k_gg_._theme_success_1jw1k_gg_._use_secondary_1jw1k_gg_{border-color:rgba(79,174,51,.3)}.___SContent_1jw1k_gg_{flex:1 1 auto;width:100%}.___SActions_1jw1k_gg_{flex-shrink:0;margin-top:12px}.___SLabel_1jw1k_gg_{margin-right:8px;display:inline-flex}.___SLabel_1jw1k_gg_._theme_danger_1jw1k_gg_{color:#ed2d2d}.___SLabel_1jw1k_gg_._theme_info_1jw1k_gg_{color:#a6b0b3}.___SLabel_1jw1k_gg_._theme_success_1jw1k_gg_{color:#4fae33}.___SLabel_1jw1k_gg_._theme_warning_1jw1k_gg_{color:#f9b159}.___SLabel_1jw1k_gg_._theme_custom_1jw1k_gg_{color:var(--color_1du3pp1)}.___SCloseIcon_1jw1k_gg_{flex-shrink:0;margin-left:16px}.___SNotice_1jw1k_gg_._theme_custom_1jw1k_gg_{background-color:var(--backgroundColor_1du3pp1)}.___SNotice_1jw1k_gg_._theme_custom_1jw1k_gg_._use_secondary_1jw1k_gg_{border-color:var(--backgroundColor_1du3pp1)}"
|
|
35
35
|
/*__inner_css_end__*/
|
|
36
|
-
, "
|
|
36
|
+
, "1du3pp1_gg_")
|
|
37
37
|
/*__reshadow_css_end__*/
|
|
38
38
|
, {
|
|
39
|
-
"__SNotice": "
|
|
40
|
-
"_use_primary": "
|
|
41
|
-
"_use_secondary": "
|
|
42
|
-
"_theme_info": "
|
|
43
|
-
"_theme_danger": "
|
|
44
|
-
"_theme_warning": "
|
|
45
|
-
"_theme_success": "
|
|
46
|
-
"__SContent": "
|
|
47
|
-
"__SActions": "
|
|
48
|
-
"__SLabel": "
|
|
49
|
-
"
|
|
50
|
-
"--
|
|
51
|
-
"__SCloseIcon": "
|
|
52
|
-
"
|
|
53
|
-
"--backgroundColor": "--backgroundColor_8h0fr7"
|
|
39
|
+
"__SNotice": "___SNotice_1jw1k_gg_",
|
|
40
|
+
"_use_primary": "_use_primary_1jw1k_gg_",
|
|
41
|
+
"_use_secondary": "_use_secondary_1jw1k_gg_",
|
|
42
|
+
"_theme_info": "_theme_info_1jw1k_gg_",
|
|
43
|
+
"_theme_danger": "_theme_danger_1jw1k_gg_",
|
|
44
|
+
"_theme_warning": "_theme_warning_1jw1k_gg_",
|
|
45
|
+
"_theme_success": "_theme_success_1jw1k_gg_",
|
|
46
|
+
"__SContent": "___SContent_1jw1k_gg_",
|
|
47
|
+
"__SActions": "___SActions_1jw1k_gg_",
|
|
48
|
+
"__SLabel": "___SLabel_1jw1k_gg_",
|
|
49
|
+
"_theme_custom": "_theme_custom_1jw1k_gg_",
|
|
50
|
+
"--color": "--color_1du3pp1",
|
|
51
|
+
"__SCloseIcon": "___SCloseIcon_1jw1k_gg_",
|
|
52
|
+
"--backgroundColor": "--backgroundColor_1du3pp1"
|
|
54
53
|
});
|
|
55
54
|
|
|
56
55
|
function isCustomTheme(theme) {
|
|
57
56
|
return !['danger', 'warning', 'success', 'info'].includes(theme);
|
|
58
57
|
}
|
|
59
58
|
|
|
60
|
-
var THEME_LABEL = {
|
|
61
|
-
info: 'stone',
|
|
62
|
-
success: 'green',
|
|
63
|
-
warning: 'orange',
|
|
64
|
-
danger: 'red'
|
|
65
|
-
};
|
|
66
|
-
|
|
67
59
|
var RootNotice = /*#__PURE__*/function (_Component) {
|
|
68
60
|
_inherits(RootNotice, _Component);
|
|
69
61
|
|
|
@@ -126,9 +118,11 @@ function Label(_ref11) {
|
|
|
126
118
|
var styles = _ref11.styles,
|
|
127
119
|
theme = _ref11.theme;
|
|
128
120
|
var SLabel = Box;
|
|
129
|
-
var useTheme = isCustomTheme(theme) ?
|
|
121
|
+
var useTheme = isCustomTheme(theme) ? 'custom' : theme;
|
|
122
|
+
var color = resolveColor(theme);
|
|
130
123
|
return _ref7 = sstyled(styles), /*#__PURE__*/React.createElement(SLabel, _ref7.cn("SLabel", _objectSpread({}, _assignProps2({
|
|
131
|
-
"use:theme": useTheme
|
|
124
|
+
"use:theme": useTheme,
|
|
125
|
+
"color": color
|
|
132
126
|
}, _ref2))));
|
|
133
127
|
}
|
|
134
128
|
|
|
@@ -157,7 +151,7 @@ function CloseIcon(_ref14) {
|
|
|
157
151
|
var styles = _ref14.styles;
|
|
158
152
|
var SCloseIcon = Box;
|
|
159
153
|
return _ref10 = sstyled(styles), /*#__PURE__*/React.createElement(SCloseIcon, _ref10.cn("SCloseIcon", _objectSpread({}, _assignProps5({
|
|
160
|
-
"tag":
|
|
154
|
+
"tag": Close,
|
|
161
155
|
"color": "stone",
|
|
162
156
|
"interactive": true,
|
|
163
157
|
"aria-label": "Close alert"
|
package/lib/es6/Notice.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Notice.js"],"names":["React","createComponent","Component","sstyled","Root","Box","
|
|
1
|
+
{"version":3,"sources":["../../src/Notice.js"],"names":["React","createComponent","Component","sstyled","Root","Box","Close","resolveColor","FadeInOut","isCustomTheme","theme","includes","RootNotice","asProps","SNotice","Children","styles","hidden","color","useTheme","style","use","duration","Label","SLabel","Actions","SActions","Content","SContent","CloseIcon","SCloseIcon"],"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';\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 use: 'secondary',\n theme: 'info',\n duration: 200,\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 } = this.asProps;\n const color = resolveColor(theme);\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\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} color=\"stone\" 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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/NoticeSmart.js"],"names":["React","createComponent","Component","Root","isNode","Notice","NoticeSmart","SNoticeSmart","asProps","Children","label","actions","closable","onClose","theme"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,eAAP,IAA0BC,SAA1B,EAAqCC,IAArC,QAAiD,eAAjD;AACA,OAAOC,MAAP,MAAmB,2BAAnB;AACA,OAAOC,MAAP,MAAmB,UAAnB;;IAEMC,W;;;;;;;;;;;;;WAOJ,kBAAS;AAAA;;AACP,UAAMC,YAAY,GAGMF,MAHxB;
|
|
1
|
+
{"version":3,"sources":["../../src/NoticeSmart.js"],"names":["React","createComponent","Component","Root","isNode","Notice","NoticeSmart","SNoticeSmart","asProps","Children","label","actions","closable","onClose","theme"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,eAAP,IAA0BC,SAA1B,EAAqCC,IAArC,QAAiD,eAAjD;AACA,OAAOC,MAAP,MAAmB,2BAAnB;AACA,OAAOC,MAAP,MAAmB,UAAnB;;IAEMC,W;;;;;;;;;;;;;WAOJ,kBAAS;AAAA;;AACP,UAAMC,YAAY,GAGMF,MAHxB;AACA,0BAAwD,KAAKG,OAA7D;AAAA,UAAQC,QAAR,iBAAQA,QAAR;AAAA,UAAkBC,KAAlB,iBAAkBA,KAAlB;AAAA,UAAyBC,OAAzB,iBAAyBA,OAAzB;AAAA,UAAkCC,QAAlC,iBAAkCA,QAAlC;AAAA,UAA4CC,OAA5C,iBAA4CA,OAA5C;AACA,0BACE,oBAAC,YAAD,0BACGT,MAAM,CAACM,KAAD,CAAN,iBAAiB,oBAAC,MAAD,CAAQ,KAAR,QAAeA,KAAf,CADpB,eAEE,oBAAC,MAAD,CAAQ,OAAR,qBACE,oBAAC,QAAD,OADF,EAEGN,MAAM,CAACO,OAAD,CAAN,iBAAmB,oBAAC,MAAD,CAAQ,OAAR,QAAiBA,OAAjB,CAFtB,CAFF,EAMGC,QAAQ,iBAAI,oBAAC,MAAD,CAAQ,SAAR;AAAkB,QAAA,OAAO,EAAEC;AAA3B,QANf,CADF;AAUD;;;;EApBuBX,S;;gBAApBI,W,iBACiB,a;;gBADjBA,W,kBAGkB;AACpBQ,EAAAA,KAAK,EAAE;AADa,C;;AAoBxB,eAAeb,eAAe,CAACK,WAAD,CAA9B","sourcesContent":["import React from 'react';\nimport createComponent, { Component, Root } from '@semcore/core';\nimport isNode from '@semcore/utils/lib/isNode';\nimport Notice from './Notice';\n\nclass NoticeSmart extends Component {\n static displayName = 'NoticeSmart';\n\n static defaultProps = {\n theme: 'info',\n };\n\n render() {\n const SNoticeSmart = Root;\n const { Children, label, actions, closable, onClose } = this.asProps;\n return (\n <SNoticeSmart render={Notice}>\n {isNode(label) && <Notice.Label>{label}</Notice.Label>}\n <Notice.Content>\n <Children />\n {isNode(actions) && <Notice.Actions>{actions}</Notice.Actions>}\n </Notice.Content>\n {closable && <Notice.CloseIcon onClick={onClose} />}\n </SNoticeSmart>\n );\n }\n}\n\nexport default createComponent(NoticeSmart);\n"],"file":"NoticeSmart.js"}
|
|
@@ -64,8 +64,24 @@ SLabel {
|
|
|
64
64
|
display: inline-flex;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
SLabel[theme] {
|
|
68
|
-
color: var(--
|
|
67
|
+
SLabel[theme='danger'] {
|
|
68
|
+
color: var(--red);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
SLabel[theme='info'] {
|
|
72
|
+
color: var(--stone);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
SLabel[theme='success'] {
|
|
76
|
+
color: var(--green);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
SLabel[theme='warning'] {
|
|
80
|
+
color: var(--light-orange);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
SLabel[theme='custom'] {
|
|
84
|
+
color: var(--color);
|
|
69
85
|
}
|
|
70
86
|
|
|
71
87
|
SCloseIcon {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/notice",
|
|
3
3
|
"description": "SEMRush Notice Component",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.2.1",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -16,13 +16,18 @@
|
|
|
16
16
|
"@semcore/animation": "^1",
|
|
17
17
|
"@semcore/utils": "^3.15",
|
|
18
18
|
"@semcore/flex-box": "^4",
|
|
19
|
-
"@semcore/icon": "^2"
|
|
19
|
+
"@semcore/icon": "^2.16"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@semcore/core": "^1.11",
|
|
23
23
|
"react": "16.8 - 17"
|
|
24
24
|
},
|
|
25
25
|
"jest": {
|
|
26
|
-
"preset": "jest-preset-ui"
|
|
26
|
+
"preset": "@semcore/jest-preset-ui"
|
|
27
|
+
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/semrush/intergalactic.git",
|
|
31
|
+
"directory": "semcore/notice"
|
|
27
32
|
}
|
|
28
33
|
}
|
package/src/Notice.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import createComponent, { Component, sstyled, Root } from '@semcore/core';
|
|
3
3
|
import { Box } from '@semcore/flex-box';
|
|
4
|
-
import
|
|
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
7
|
|
|
@@ -11,8 +11,6 @@ function isCustomTheme(theme) {
|
|
|
11
11
|
return !['danger', 'warning', 'success', 'info'].includes(theme);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const THEME_LABEL = { info: 'stone', success: 'green', warning: 'orange', danger: 'red' };
|
|
15
|
-
|
|
16
14
|
class RootNotice extends Component {
|
|
17
15
|
static displayName = 'Notice';
|
|
18
16
|
static style = style;
|
|
@@ -51,8 +49,9 @@ class RootNotice extends Component {
|
|
|
51
49
|
|
|
52
50
|
function Label({ styles, theme }) {
|
|
53
51
|
const SLabel = Root;
|
|
54
|
-
const useTheme = isCustomTheme(theme) ?
|
|
55
|
-
|
|
52
|
+
const useTheme = isCustomTheme(theme) ? 'custom' : theme;
|
|
53
|
+
const color = resolveColor(theme);
|
|
54
|
+
return sstyled(styles)(<SLabel render={Box} use:theme={useTheme} color={color} />);
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
function Actions({ styles }) {
|
|
@@ -68,7 +67,7 @@ function Content({ styles }) {
|
|
|
68
67
|
function CloseIcon({ styles }) {
|
|
69
68
|
const SCloseIcon = Root;
|
|
70
69
|
return sstyled(styles)(
|
|
71
|
-
<SCloseIcon render={Box} tag={
|
|
70
|
+
<SCloseIcon render={Box} tag={Close} color="stone" interactive aria-label="Close alert" />,
|
|
72
71
|
);
|
|
73
72
|
}
|
|
74
73
|
|
|
@@ -64,8 +64,24 @@ SLabel {
|
|
|
64
64
|
display: inline-flex;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
SLabel[theme] {
|
|
68
|
-
color: var(--
|
|
67
|
+
SLabel[theme='danger'] {
|
|
68
|
+
color: var(--red);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
SLabel[theme='info'] {
|
|
72
|
+
color: var(--stone);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
SLabel[theme='success'] {
|
|
76
|
+
color: var(--green);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
SLabel[theme='warning'] {
|
|
80
|
+
color: var(--light-orange);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
SLabel[theme='custom'] {
|
|
84
|
+
color: var(--color);
|
|
69
85
|
}
|
|
70
86
|
|
|
71
87
|
SCloseIcon {
|