@semcore/notice 3.1.1 → 3.1.2
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 +6 -0
- package/lib/cjs/Notice.js +20 -26
- package/lib/cjs/Notice.js.map +1 -1
- package/lib/cjs/style/notice.shadow.css +18 -2
- package/lib/es6/Notice.js +20 -26
- package/lib/es6/Notice.js.map +1 -1
- package/lib/es6/style/notice.shadow.css +18 -2
- package/package.json +1 -1
- package/src/Notice.js +3 -4
- package/src/style/notice.shadow.css +18 -2
package/CHANGELOG.md
CHANGED
package/lib/cjs/Notice.js
CHANGED
|
@@ -46,39 +46,31 @@ var style = (
|
|
|
46
46
|
/*__reshadow_css_start__*/
|
|
47
47
|
_core.sstyled.insert(
|
|
48
48
|
/*__inner_css_start__*/
|
|
49
|
-
".
|
|
49
|
+
".___SNotice_1cprg_gg_{display:flex;font-size:12px;line-height:1.5;box-sizing:border-box}.___SNotice_1cprg_gg_._use_primary_1cprg_gg_{padding:8px 32px}.___SNotice_1cprg_gg_._use_secondary_1cprg_gg_{padding:15px;border-style:solid;border-width:1px;border-radius:2px}.___SNotice_1cprg_gg_._theme_info_1cprg_gg_{background-color:rgba(43,148,225,.15)}.___SNotice_1cprg_gg_._theme_info_1cprg_gg_._use_secondary_1cprg_gg_{border-color:rgba(43,148,225,.25)}.___SNotice_1cprg_gg_._theme_danger_1cprg_gg_{background-color:rgba(237,45,45,.1)}.___SNotice_1cprg_gg_._theme_danger_1cprg_gg_._use_secondary_1cprg_gg_{border-color:rgba(237,45,45,.2)}.___SNotice_1cprg_gg_._theme_warning_1cprg_gg_{background-color:rgba(249,177,89,.15)}.___SNotice_1cprg_gg_._theme_warning_1cprg_gg_._use_secondary_1cprg_gg_{border-color:rgba(249,177,89,.4)}.___SNotice_1cprg_gg_._theme_success_1cprg_gg_{background-color:rgba(79,174,51,.15)}.___SNotice_1cprg_gg_._theme_success_1cprg_gg_._use_secondary_1cprg_gg_{border-color:rgba(79,174,51,.3)}.___SContent_1cprg_gg_{flex:1 1 auto;width:100%}.___SActions_1cprg_gg_{flex-shrink:0;margin-top:12px}.___SLabel_1cprg_gg_{margin-right:8px;display:inline-flex}.___SLabel_1cprg_gg_._theme_danger_1cprg_gg_{color:#ed2d2d}.___SLabel_1cprg_gg_._theme_info_1cprg_gg_{color:#a6b0b3}.___SLabel_1cprg_gg_._theme_success_1cprg_gg_{color:#4fae33}.___SLabel_1cprg_gg_._theme_warning_1cprg_gg_{color:#f9b159}.___SLabel_1cprg_gg_._theme_custom_1cprg_gg_{color:var(--color_1du3pp1)}.___SCloseIcon_1cprg_gg_{flex-shrink:0;margin-left:16px}.___SNotice_1cprg_gg_._theme_custom_1cprg_gg_{background-color:var(--backgroundColor_1du3pp1)}.___SNotice_1cprg_gg_._theme_custom_1cprg_gg_._use_secondary_1cprg_gg_{border-color:var(--backgroundColor_1du3pp1)}"
|
|
50
50
|
/*__inner_css_end__*/
|
|
51
|
-
, "
|
|
51
|
+
, "1du3pp1_gg_")
|
|
52
52
|
/*__reshadow_css_end__*/
|
|
53
53
|
, {
|
|
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"
|
|
54
|
+
"__SNotice": "___SNotice_1cprg_gg_",
|
|
55
|
+
"_use_primary": "_use_primary_1cprg_gg_",
|
|
56
|
+
"_use_secondary": "_use_secondary_1cprg_gg_",
|
|
57
|
+
"_theme_info": "_theme_info_1cprg_gg_",
|
|
58
|
+
"_theme_danger": "_theme_danger_1cprg_gg_",
|
|
59
|
+
"_theme_warning": "_theme_warning_1cprg_gg_",
|
|
60
|
+
"_theme_success": "_theme_success_1cprg_gg_",
|
|
61
|
+
"__SContent": "___SContent_1cprg_gg_",
|
|
62
|
+
"__SActions": "___SActions_1cprg_gg_",
|
|
63
|
+
"__SLabel": "___SLabel_1cprg_gg_",
|
|
64
|
+
"_theme_custom": "_theme_custom_1cprg_gg_",
|
|
65
|
+
"--color": "--color_1du3pp1",
|
|
66
|
+
"__SCloseIcon": "___SCloseIcon_1cprg_gg_",
|
|
67
|
+
"--backgroundColor": "--backgroundColor_1du3pp1"
|
|
69
68
|
});
|
|
70
69
|
|
|
71
70
|
function isCustomTheme(theme) {
|
|
72
71
|
return !['danger', 'warning', 'success', 'info'].includes(theme);
|
|
73
72
|
}
|
|
74
73
|
|
|
75
|
-
var THEME_LABEL = {
|
|
76
|
-
info: 'stone',
|
|
77
|
-
success: 'green',
|
|
78
|
-
warning: 'orange',
|
|
79
|
-
danger: 'red'
|
|
80
|
-
};
|
|
81
|
-
|
|
82
74
|
var RootNotice = /*#__PURE__*/function (_Component) {
|
|
83
75
|
(0, _inherits2["default"])(RootNotice, _Component);
|
|
84
76
|
|
|
@@ -137,9 +129,11 @@ function Label(_ref11) {
|
|
|
137
129
|
var styles = _ref11.styles,
|
|
138
130
|
theme = _ref11.theme;
|
|
139
131
|
var SLabel = _flexBox.Box;
|
|
140
|
-
var useTheme = isCustomTheme(theme) ?
|
|
132
|
+
var useTheme = isCustomTheme(theme) ? 'custom' : theme;
|
|
133
|
+
var color = (0, _color["default"])(theme);
|
|
141
134
|
return _ref7 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SLabel, _ref7.cn("SLabel", _objectSpread({}, (0, _core.assignProps)({
|
|
142
|
-
"use:theme": useTheme
|
|
135
|
+
"use:theme": useTheme,
|
|
136
|
+
"color": color
|
|
143
137
|
}, _ref2))));
|
|
144
138
|
}
|
|
145
139
|
|
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","CloseXS"],"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;AAAA,UACNF,KADM,GACI,KAAKG,OADT,CACNH,KADM;AAEd,aAAO;AACLA,QAAAA,KAAK,EAALA;AADK,OAAP;AAGD;;;WAED,kBAAS;AAAA;AAAA;;AACP,UAAMI,OAAO,GAODC,oBAPZ;AADO,0BAEqC,KAAKF,OAF1C;AAAA,UAECG,QAFD,iBAECA,QAFD;AAAA,UAEWC,MAFX,iBAEWA,MAFX;AAAA,UAEmBC,MAFnB,iBAEmBA,MAFnB;AAAA,UAE2BR,KAF3B,iBAE2BA,KAF3B;AAGP,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,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AAA,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 CloseXS from '@semcore/icon/lib/Close/xs';\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={CloseXS} 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"}
|
|
@@ -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
|
@@ -31,39 +31,31 @@ var style = (
|
|
|
31
31
|
/*__reshadow_css_start__*/
|
|
32
32
|
_sstyled.insert(
|
|
33
33
|
/*__inner_css_start__*/
|
|
34
|
-
".
|
|
34
|
+
".___SNotice_1cprg_gg_{display:flex;font-size:12px;line-height:1.5;box-sizing:border-box}.___SNotice_1cprg_gg_._use_primary_1cprg_gg_{padding:8px 32px}.___SNotice_1cprg_gg_._use_secondary_1cprg_gg_{padding:15px;border-style:solid;border-width:1px;border-radius:2px}.___SNotice_1cprg_gg_._theme_info_1cprg_gg_{background-color:rgba(43,148,225,.15)}.___SNotice_1cprg_gg_._theme_info_1cprg_gg_._use_secondary_1cprg_gg_{border-color:rgba(43,148,225,.25)}.___SNotice_1cprg_gg_._theme_danger_1cprg_gg_{background-color:rgba(237,45,45,.1)}.___SNotice_1cprg_gg_._theme_danger_1cprg_gg_._use_secondary_1cprg_gg_{border-color:rgba(237,45,45,.2)}.___SNotice_1cprg_gg_._theme_warning_1cprg_gg_{background-color:rgba(249,177,89,.15)}.___SNotice_1cprg_gg_._theme_warning_1cprg_gg_._use_secondary_1cprg_gg_{border-color:rgba(249,177,89,.4)}.___SNotice_1cprg_gg_._theme_success_1cprg_gg_{background-color:rgba(79,174,51,.15)}.___SNotice_1cprg_gg_._theme_success_1cprg_gg_._use_secondary_1cprg_gg_{border-color:rgba(79,174,51,.3)}.___SContent_1cprg_gg_{flex:1 1 auto;width:100%}.___SActions_1cprg_gg_{flex-shrink:0;margin-top:12px}.___SLabel_1cprg_gg_{margin-right:8px;display:inline-flex}.___SLabel_1cprg_gg_._theme_danger_1cprg_gg_{color:#ed2d2d}.___SLabel_1cprg_gg_._theme_info_1cprg_gg_{color:#a6b0b3}.___SLabel_1cprg_gg_._theme_success_1cprg_gg_{color:#4fae33}.___SLabel_1cprg_gg_._theme_warning_1cprg_gg_{color:#f9b159}.___SLabel_1cprg_gg_._theme_custom_1cprg_gg_{color:var(--color_1du3pp1)}.___SCloseIcon_1cprg_gg_{flex-shrink:0;margin-left:16px}.___SNotice_1cprg_gg_._theme_custom_1cprg_gg_{background-color:var(--backgroundColor_1du3pp1)}.___SNotice_1cprg_gg_._theme_custom_1cprg_gg_._use_secondary_1cprg_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_1cprg_gg_",
|
|
40
|
+
"_use_primary": "_use_primary_1cprg_gg_",
|
|
41
|
+
"_use_secondary": "_use_secondary_1cprg_gg_",
|
|
42
|
+
"_theme_info": "_theme_info_1cprg_gg_",
|
|
43
|
+
"_theme_danger": "_theme_danger_1cprg_gg_",
|
|
44
|
+
"_theme_warning": "_theme_warning_1cprg_gg_",
|
|
45
|
+
"_theme_success": "_theme_success_1cprg_gg_",
|
|
46
|
+
"__SContent": "___SContent_1cprg_gg_",
|
|
47
|
+
"__SActions": "___SActions_1cprg_gg_",
|
|
48
|
+
"__SLabel": "___SLabel_1cprg_gg_",
|
|
49
|
+
"_theme_custom": "_theme_custom_1cprg_gg_",
|
|
50
|
+
"--color": "--color_1du3pp1",
|
|
51
|
+
"__SCloseIcon": "___SCloseIcon_1cprg_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
|
|
package/lib/es6/Notice.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Notice.js"],"names":["React","createComponent","Component","sstyled","Root","Box","CloseXS","resolveColor","FadeInOut","isCustomTheme","theme","includes","
|
|
1
|
+
{"version":3,"sources":["../../src/Notice.js"],"names":["React","createComponent","Component","sstyled","Root","Box","CloseXS","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":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,eAAP,IAA0BC,SAA1B,EAAqCC,OAArC,EAA8CC,IAA9C,QAA0D,eAA1D;AACA,SAASC,GAAT,QAAoB,mBAApB;AACA,OAAOC,OAAP,MAAoB,4BAApB;AACA,OAAOC,YAAP,MAAyB,0BAAzB;AACA,SAASC,SAAT,QAA0B,oBAA1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;WASJ,yBAAgB;AAAA,UACNF,KADM,GACI,KAAKG,OADT,CACNH,KADM;AAEd,aAAO;AACLA,QAAAA,KAAK,EAALA;AADK,OAAP;AAGD;;;WAED,kBAAS;AAAA;AAAA;;AACP,UAAMI,OAAO,GAODN,SAPZ;AADO,0BAEqC,KAAKK,OAF1C;AAAA,UAECE,QAFD,iBAECA,QAFD;AAAA,UAEWC,MAFX,iBAEWA,MAFX;AAAA,UAEmBC,MAFnB,iBAEmBA,MAFnB;AAAA,UAE2BP,KAF3B,iBAE2BA,KAF3B;AAGP,UAAMQ,KAAK,GAAGX,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AASa,SAAT,SAA+B;AAAA;AAAA;;AAAA,MAAVb,MAAU,UAAVA,MAAU;AAC7B,MAAMc,UAAU,GAEMzB,GAFtB;AACA,kBAAOF,OAAO,CAACa,MAAD,CAAd,eACE,oBAAC,UAAD;AAAA,WAA8BV,OAA9B;AAAA,aAA6C,OAA7C;AAAA;AAAA,kBAA4E;AAA5E,cADF;AAGD;;AAED,eAAeL,eAAe,CAACW,UAAD,EAAa;AACzCW,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 CloseXS from '@semcore/icon/lib/Close/xs';\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={CloseXS} 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"}
|
|
@@ -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
package/src/Notice.js
CHANGED
|
@@ -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 }) {
|
|
@@ -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 {
|