@semcore/notice 3.0.0 → 3.2.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 CHANGED
@@ -2,6 +2,34 @@
2
2
 
3
3
  CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
+ ## [3.2.0] - 2022-01-18
6
+
7
+ ### Changed
8
+
9
+ - Up version icons and use new icon.
10
+
11
+ ## [3.1.2] - 2021-12-08
12
+
13
+ ### Changed
14
+
15
+ - Moved SLabel colors to style
16
+
17
+ ## [3.1.1] - 2021-8-26
18
+
19
+ ### Changed
20
+
21
+ - Add 'sideEffect=false' for more optimal build via webpack
22
+
23
+ ## [3.1.0] - 2021-07-05
24
+
25
+ ### Changed
26
+
27
+ - Version of dependence `@semcore/core` has been changed to `1.11`.
28
+ - Improved performance. Removed one component wrapper.
29
+ - The style processing system has been changed.
30
+ - Removed the ability to apply media styles via a plugin `babel-plugin-react-semcore`.
31
+ - [A11y] added role for `Alert` and aria-label for `Close`.
32
+
5
33
  ## [3.0.0] - 2021-03-15
6
34
 
7
35
  ### BREAK
package/lib/cjs/Notice.js CHANGED
@@ -21,81 +21,56 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
21
21
 
22
22
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
23
 
24
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
24
+ var _core = _interopRequireWildcard(require("@semcore/core"));
25
25
 
26
26
  var _react = _interopRequireDefault(require("react"));
27
27
 
28
- var _core = _interopRequireWildcard(require("@semcore/core"));
29
-
30
28
  var _flexBox = require("@semcore/flex-box");
31
29
 
32
- var _xs = _interopRequireDefault(require("@semcore/icon/lib/Close/xs"));
30
+ var _m = _interopRequireDefault(require("@semcore/icon/Close/m"));
33
31
 
34
32
  var _color = _interopRequireDefault(require("@semcore/utils/lib/color"));
35
33
 
36
34
  var _animation = require("@semcore/animation");
37
35
 
36
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
37
+
38
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
39
+
38
40
  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); }; }
39
41
 
40
42
  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; } }
41
43
 
42
44
  /*__reshadow-styles__:"./style/notice.shadow.css"*/
43
- var _ref = (
45
+ var style = (
44
46
  /*__reshadow_css_start__*/
45
- (0, _core.__css__)(
47
+ _core.sstyled.insert(
46
48
  /*__inner_css_start__*/
47
- ".___SNotice_13gnh_gg_{display:flex;font-size:12px;line-height:1.5;box-sizing:border-box}.___SNotice_13gnh_gg_.__use_13gnh_gg_.__use_primary_13gnh_gg_{padding:8px 32px}.___SNotice_13gnh_gg_.__use_13gnh_gg_.__use_secondary_13gnh_gg_{padding:15px;border-style:solid;border-width:1px;border-radius:2px}.___SNotice_13gnh_gg_.__theme_13gnh_gg_.__theme_info_13gnh_gg_{background-color:rgba(43,148,225,.15)}.___SNotice_13gnh_gg_.__use_13gnh_gg_.__use_secondary_13gnh_gg_.__theme_13gnh_gg_.__theme_info_13gnh_gg_{border-color:rgba(43,148,225,.25)}.___SNotice_13gnh_gg_.__theme_13gnh_gg_.__theme_danger_13gnh_gg_{background-color:rgba(237,45,45,.1)}.___SNotice_13gnh_gg_.__use_13gnh_gg_.__use_secondary_13gnh_gg_.__theme_13gnh_gg_.__theme_danger_13gnh_gg_{border-color:rgba(237,45,45,.2)}.___SNotice_13gnh_gg_.__theme_13gnh_gg_.__theme_warning_13gnh_gg_{background-color:rgba(249,177,89,.15)}.___SNotice_13gnh_gg_.__use_13gnh_gg_.__use_secondary_13gnh_gg_.__theme_13gnh_gg_.__theme_warning_13gnh_gg_{border-color:rgba(249,177,89,.4)}.___SNotice_13gnh_gg_.__theme_13gnh_gg_.__theme_success_13gnh_gg_{background-color:rgba(79,174,51,.15)}.___SNotice_13gnh_gg_.__use_13gnh_gg_.__use_secondary_13gnh_gg_.__theme_13gnh_gg_.__theme_success_13gnh_gg_{border-color:rgba(79,174,51,.3)}.___SContent_13gnh_gg_{flex:1 1 auto;width:100%}.___SActions_13gnh_gg_{flex-shrink:0;margin-top:12px}.___SLabel_13gnh_gg_{margin-right:8px;display:inline-flex}.___SLabel_13gnh_gg_.__theme_13gnh_gg_.__theme_info_13gnh_gg_{color:#a6b0b3}.___SLabel_13gnh_gg_.__theme_13gnh_gg_.__theme_success_13gnh_gg_{color:#4fae33}.___SLabel_13gnh_gg_.__theme_13gnh_gg_.__theme_warning_13gnh_gg_{color:#ff7f00}.___SLabel_13gnh_gg_.__theme_13gnh_gg_.__theme_danger_13gnh_gg_{color:#ed2d2d}.___SCloseIcon_13gnh_gg_{flex-shrink:0;margin-left:16px}"
49
+ ".___SNotice_1tywf_gg_{display:flex;font-size:12px;line-height:1.5;box-sizing:border-box}.___SNotice_1tywf_gg_._use_primary_1tywf_gg_{padding:8px 32px}.___SNotice_1tywf_gg_._use_secondary_1tywf_gg_{padding:15px;border-style:solid;border-width:1px;border-radius:2px}.___SNotice_1tywf_gg_._theme_info_1tywf_gg_{background-color:rgba(43,148,225,.15)}.___SNotice_1tywf_gg_._theme_info_1tywf_gg_._use_secondary_1tywf_gg_{border-color:rgba(43,148,225,.25)}.___SNotice_1tywf_gg_._theme_danger_1tywf_gg_{background-color:rgba(237,45,45,.1)}.___SNotice_1tywf_gg_._theme_danger_1tywf_gg_._use_secondary_1tywf_gg_{border-color:rgba(237,45,45,.2)}.___SNotice_1tywf_gg_._theme_warning_1tywf_gg_{background-color:rgba(249,177,89,.15)}.___SNotice_1tywf_gg_._theme_warning_1tywf_gg_._use_secondary_1tywf_gg_{border-color:rgba(249,177,89,.4)}.___SNotice_1tywf_gg_._theme_success_1tywf_gg_{background-color:rgba(79,174,51,.15)}.___SNotice_1tywf_gg_._theme_success_1tywf_gg_._use_secondary_1tywf_gg_{border-color:rgba(79,174,51,.3)}.___SContent_1tywf_gg_{flex:1 1 auto;width:100%}.___SActions_1tywf_gg_{flex-shrink:0;margin-top:12px}.___SLabel_1tywf_gg_{margin-right:8px;display:inline-flex}.___SLabel_1tywf_gg_._theme_danger_1tywf_gg_{color:#ed2d2d}.___SLabel_1tywf_gg_._theme_info_1tywf_gg_{color:#a6b0b3}.___SLabel_1tywf_gg_._theme_success_1tywf_gg_{color:#4fae33}.___SLabel_1tywf_gg_._theme_warning_1tywf_gg_{color:#f9b159}.___SLabel_1tywf_gg_._theme_custom_1tywf_gg_{color:var(--color_1du3pp1)}.___SCloseIcon_1tywf_gg_{flex-shrink:0;margin-left:16px}.___SNotice_1tywf_gg_._theme_custom_1tywf_gg_{background-color:var(--backgroundColor_1du3pp1)}.___SNotice_1tywf_gg_._theme_custom_1tywf_gg_._use_secondary_1tywf_gg_{border-color:var(--backgroundColor_1du3pp1)}"
48
50
  /*__inner_css_end__*/
49
- , "7ukgx9_gg_")
51
+ , "1du3pp1_gg_")
50
52
  /*__reshadow_css_end__*/
51
53
  , {
52
- "__SNotice": "___SNotice_13gnh_gg_",
53
- "_use": "__use_13gnh_gg_",
54
- "_use_primary": "__use_primary_13gnh_gg_",
55
- "_use_secondary": "__use_secondary_13gnh_gg_",
56
- "_theme": "__theme_13gnh_gg_",
57
- "_theme_info": "__theme_info_13gnh_gg_",
58
- "_theme_danger": "__theme_danger_13gnh_gg_",
59
- "_theme_warning": "__theme_warning_13gnh_gg_",
60
- "_theme_success": "__theme_success_13gnh_gg_",
61
- "__SContent": "___SContent_13gnh_gg_",
62
- "__SActions": "___SActions_13gnh_gg_",
63
- "__SLabel": "___SLabel_13gnh_gg_",
64
- "__SCloseIcon": "___SCloseIcon_13gnh_gg_"
65
- }),
66
- style = (0, _extends2["default"])({}, _ref);
67
-
68
- if (false) {
69
- /*__reshadow_css_start__*/
70
- (0, _core.__css__)(
71
- /*__inner_css_start__*/
72
- "@media (max-width: 768px) {.___SNotice_13gnh_gg_ {\n font-size: 15.6px;\n}}"
73
- /*__inner_css_end__*/
74
- , "10d6lwe_gg_")
75
- /*__reshadow_css_end__*/
76
- ;
77
- }
54
+ "__SNotice": "___SNotice_1tywf_gg_",
55
+ "_use_primary": "_use_primary_1tywf_gg_",
56
+ "_use_secondary": "_use_secondary_1tywf_gg_",
57
+ "_theme_info": "_theme_info_1tywf_gg_",
58
+ "_theme_danger": "_theme_danger_1tywf_gg_",
59
+ "_theme_warning": "_theme_warning_1tywf_gg_",
60
+ "_theme_success": "_theme_success_1tywf_gg_",
61
+ "__SContent": "___SContent_1tywf_gg_",
62
+ "__SActions": "___SActions_1tywf_gg_",
63
+ "__SLabel": "___SLabel_1tywf_gg_",
64
+ "_theme_custom": "_theme_custom_1tywf_gg_",
65
+ "--color": "--color_1du3pp1",
66
+ "__SCloseIcon": "___SCloseIcon_1tywf_gg_",
67
+ "--backgroundColor": "--backgroundColor_1du3pp1"
68
+ });
78
69
 
79
70
  function isCustomTheme(theme) {
80
71
  return !['danger', 'warning', 'success', 'info'].includes(theme);
81
72
  }
82
73
 
83
- var styled_c8 = (0, _core.create)([(
84
- /*__reshadow_css_start__*/
85
- (0, _core.__css__)(
86
- /*__inner_css_start__*/
87
- ".___SNotice_118cq_gg_.__theme_118cq_gg_.__theme_custom_118cq_gg_{background-color:var(--applr9_0)}.___SNotice_118cq_gg_.__theme_118cq_gg_.__theme_custom_118cq_gg_.__use_118cq_gg_.__use_secondary_118cq_gg_{border-color:var(--applr9_0)}"
88
- /*__inner_css_end__*/
89
- , "f664o2_gg_")
90
- /*__reshadow_css_end__*/
91
- , {
92
- "__SNotice": "___SNotice_118cq_gg_",
93
- "_theme": "__theme_118cq_gg_",
94
- "_theme_custom": "__theme_custom_118cq_gg_",
95
- "_use": "__use_118cq_gg_",
96
- "_use_secondary": "__use_secondary_118cq_gg_"
97
- })]);
98
-
99
74
  var RootNotice = /*#__PURE__*/function (_Component) {
100
75
  (0, _inherits2["default"])(RootNotice, _Component);
101
76
 
@@ -117,23 +92,23 @@ var RootNotice = /*#__PURE__*/function (_Component) {
117
92
  }, {
118
93
  key: "render",
119
94
  value: function render() {
120
- var SNotice = this.Root;
95
+ var _ref = this ? this.asProps : arguments[0],
96
+ _ref6;
97
+
98
+ var SNotice = _animation.FadeInOut;
121
99
  var _this$asProps = this.asProps,
100
+ Children = _this$asProps.Children,
122
101
  styles = _this$asProps.styles,
123
102
  hidden = _this$asProps.hidden,
124
- theme = _this$asProps.theme,
125
- use = _this$asProps.use;
103
+ theme = _this$asProps.theme;
126
104
  var color = (0, _color["default"])(theme);
127
105
  var useTheme = isCustomTheme(theme) ? 'custom' : theme;
128
- return (0, _core.styled)(((0, _core.set)([styled_c8, styles], {
129
- "--applr9_0": color
130
- }), /*#__PURE__*/_react["default"].createElement(SNotice, (0, _core.map)("SNotice", {
131
- render: _animation.FadeInOut,
132
- visible: !hidden,
133
- use: use,
134
- theme: useTheme,
135
- $$style: _core.styled.$$style
136
- }))));
106
+ return _ref6 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SNotice, _ref6.cn("SNotice", _objectSpread({}, (0, _core.assignProps)({
107
+ "visible": !hidden,
108
+ "use:theme": useTheme,
109
+ "backgroundColor": color,
110
+ "role": "alert"
111
+ }, _ref))), /*#__PURE__*/_react["default"].createElement(Children, _ref6.cn("Children", {})));
137
112
  }
138
113
  }]);
139
114
  return RootNotice;
@@ -146,49 +121,52 @@ var RootNotice = /*#__PURE__*/function (_Component) {
146
121
  theme: 'info',
147
122
  duration: 200
148
123
  });
149
- var styled_12c = (0, _core.create)([]);
150
-
151
- function Label(_ref2) {
152
- var SLabel = _ref2.Root,
153
- styles = _ref2.styles,
154
- theme = _ref2.theme;
155
- return (0, _core.styled)(((0, _core.set)([styled_12c, styles]), /*#__PURE__*/_react["default"].createElement(SLabel, (0, _core.map)("SLabel", {
156
- render: _flexBox.Box,
157
- theme: !isCustomTheme(theme) && theme
158
- }))));
124
+
125
+ function Label(_ref11) {
126
+ var _ref2 = this ? this.asProps : arguments[0],
127
+ _ref7;
128
+
129
+ var styles = _ref11.styles,
130
+ theme = _ref11.theme;
131
+ var SLabel = _flexBox.Box;
132
+ var useTheme = isCustomTheme(theme) ? 'custom' : theme;
133
+ var color = (0, _color["default"])(theme);
134
+ return _ref7 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SLabel, _ref7.cn("SLabel", _objectSpread({}, (0, _core.assignProps)({
135
+ "use:theme": useTheme,
136
+ "color": color
137
+ }, _ref2))));
159
138
  }
160
139
 
161
- var styled_190 = (0, _core.create)([]);
140
+ function Actions(_ref12) {
141
+ var _ref3 = this ? this.asProps : arguments[0],
142
+ _ref8;
162
143
 
163
- function Actions(_ref3) {
164
- var SActions = _ref3.Root,
165
- styles = _ref3.styles;
166
- return (0, _core.styled)(((0, _core.set)([styled_190, styles]), /*#__PURE__*/_react["default"].createElement(SActions, (0, _core.map)("SActions", {
167
- render: _flexBox.Box
168
- }))));
144
+ var styles = _ref12.styles;
145
+ var SActions = _flexBox.Box;
146
+ return _ref8 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SActions, _ref8.cn("SActions", _objectSpread({}, (0, _core.assignProps)({}, _ref3))));
169
147
  }
170
148
 
171
- var styled_1f4 = (0, _core.create)([]);
149
+ function Content(_ref13) {
150
+ var _ref4 = this ? this.asProps : arguments[0],
151
+ _ref9;
172
152
 
173
- function Content(_ref4) {
174
- var SContent = _ref4.Root,
175
- styles = _ref4.styles;
176
- return (0, _core.styled)(((0, _core.set)([styled_1f4, styles]), /*#__PURE__*/_react["default"].createElement(SContent, (0, _core.map)("SContent", {
177
- render: _flexBox.Box
178
- }))));
153
+ var styles = _ref13.styles;
154
+ var SContent = _flexBox.Box;
155
+ return _ref9 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SContent, _ref9.cn("SContent", _objectSpread({}, (0, _core.assignProps)({}, _ref4))));
179
156
  }
180
157
 
181
- var styled_258 = (0, _core.create)([]);
182
-
183
- function CloseIcon(_ref5) {
184
- var SCloseIcon = _ref5.Root,
185
- styles = _ref5.styles;
186
- return (0, _core.styled)(((0, _core.set)([styled_258, styles]), /*#__PURE__*/_react["default"].createElement(SCloseIcon, (0, _core.map)("SCloseIcon", {
187
- render: _flexBox.Box,
188
- tag: _xs["default"],
189
- color: "stone",
190
- interactive: true
191
- }))));
158
+ function CloseIcon(_ref14) {
159
+ var _ref5 = this ? this.asProps : arguments[0],
160
+ _ref10;
161
+
162
+ var styles = _ref14.styles;
163
+ var SCloseIcon = _flexBox.Box;
164
+ return _ref10 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SCloseIcon, _ref10.cn("SCloseIcon", _objectSpread({}, (0, _core.assignProps)({
165
+ "tag": _m["default"],
166
+ "color": "stone",
167
+ "interactive": true,
168
+ "aria-label": "Close alert"
169
+ }, _ref5))));
192
170
  }
193
171
 
194
172
  var _default = (0, _core["default"])(RootNotice, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Notice.js"],"names":["isCustomTheme","theme","includes","RootNotice","asProps","SNotice","Root","styles","hidden","use","color","useTheme","FadeInOut","Component","style","duration","Label","SLabel","Box","Actions","SActions","Content","SContent","CloseIcon","SCloseIcon","CloseXS"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;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;AACP,UAAMI,OAAO,GAAG,KAAKC,IAArB;AADO,0BAEgC,KAAKF,OAFrC;AAAA,UAECG,MAFD,iBAECA,MAFD;AAAA,UAESC,MAFT,iBAESA,MAFT;AAAA,UAEiBP,KAFjB,iBAEiBA,KAFjB;AAAA,UAEwBQ,GAFxB,iBAEwBA,GAFxB;AAGP,UAAMC,KAAK,GAAG,uBAAaT,KAAb,CAAd;AACA,UAAMU,QAAQ,GAAGX,aAAa,CAACC,KAAD,CAAb,GAAuB,QAAvB,GAAkCA,KAAnD;AAEA,aAAO,8CAAOM,MAAP;AAAA,sBAEiBG;AAFjB,uBAQL,gCAAC,OAAD;AAAA,gBAAiBE,oBAAjB;AAAA,iBAAqC,CAACJ,MAAtC;AAAA,aAAmDC,GAAnD;AAAA,eAA+DE,QAA/D;AAAA;AAAA,SARK,EAAP;AASD;;;EA/BsBE,e;;iCAAnBV,U,iBAC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 'react';\nimport createComponent, { Component, styled } 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 = this.Root;\n const { styles, hidden, theme, use } = this.asProps;\n const color = resolveColor(theme);\n const useTheme = isCustomTheme(theme) ? 'custom' : theme;\n\n return styled(styles)`\n SNotice[theme='custom'] {\n background-color: ${color};\n\n &[use='secondary'] {\n border-color: ${color};\n }\n }\n `(<SNotice render={FadeInOut} visible={!hidden} use={use} theme={useTheme} />);\n }\n}\n\nfunction Label({ Root: SLabel, styles, theme }) {\n return styled(styles)(<SLabel render={Box} theme={!isCustomTheme(theme) && theme} />);\n}\n\nfunction Actions({ Root: SActions, styles }) {\n return styled(styles)(<SActions render={Box} />);\n}\n\nfunction Content({ Root: SContent, styles }) {\n return styled(styles)(<SContent render={Box} />);\n}\n\nfunction CloseIcon({ Root: SCloseIcon, styles }) {\n return styled(styles)(<SCloseIcon render={Box} tag={CloseXS} color=\"stone\" interactive />);\n}\n\nexport default createComponent(RootNotice, {\n Label,\n Actions,\n Content,\n CloseIcon,\n});\n"],"file":"Notice.js"}
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;;;;;;;;;;;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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"}
@@ -21,10 +21,10 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
21
21
 
22
22
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
23
 
24
- var _react = _interopRequireDefault(require("react"));
25
-
26
24
  var _core = _interopRequireWildcard(require("@semcore/core"));
27
25
 
26
+ var _react = _interopRequireDefault(require("react"));
27
+
28
28
  var _isNode = _interopRequireDefault(require("@semcore/utils/lib/isNode"));
29
29
 
30
30
  var _Notice = _interopRequireDefault(require("./Notice"));
@@ -46,16 +46,16 @@ var NoticeSmart = /*#__PURE__*/function (_Component) {
46
46
  (0, _createClass2["default"])(NoticeSmart, [{
47
47
  key: "render",
48
48
  value: function render() {
49
- var SNoticeSmart = this.Root;
49
+ var _ref = this ? this.asProps : arguments[0];
50
+
51
+ var SNoticeSmart = _Notice["default"];
50
52
  var _this$asProps = this.asProps,
51
53
  Children = _this$asProps.Children,
52
54
  label = _this$asProps.label,
53
55
  actions = _this$asProps.actions,
54
56
  closable = _this$asProps.closable,
55
57
  onClose = _this$asProps.onClose;
56
- return /*#__PURE__*/_react["default"].createElement(SNoticeSmart, {
57
- render: _Notice["default"]
58
- }, (0, _isNode["default"])(label) && /*#__PURE__*/_react["default"].createElement(_Notice["default"].Label, null, label), /*#__PURE__*/_react["default"].createElement(_Notice["default"].Content, null, /*#__PURE__*/_react["default"].createElement(Children, null), (0, _isNode["default"])(actions) && /*#__PURE__*/_react["default"].createElement(_Notice["default"].Actions, null, actions)), closable && /*#__PURE__*/_react["default"].createElement(_Notice["default"].CloseIcon, {
58
+ return /*#__PURE__*/_react["default"].createElement(SNoticeSmart, (0, _core.assignProps)({}, _ref), (0, _isNode["default"])(label) && /*#__PURE__*/_react["default"].createElement(_Notice["default"].Label, null, label), /*#__PURE__*/_react["default"].createElement(_Notice["default"].Content, null, /*#__PURE__*/_react["default"].createElement(Children, null), (0, _isNode["default"])(actions) && /*#__PURE__*/_react["default"].createElement(_Notice["default"].Actions, null, actions)), closable && /*#__PURE__*/_react["default"].createElement(_Notice["default"].CloseIcon, {
59
59
  onClick: onClose
60
60
  }));
61
61
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/NoticeSmart.js"],"names":["NoticeSmart","SNoticeSmart","Root","asProps","Children","label","actions","closable","onClose","Notice","Component","theme"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;IAEMA,W;;;;;;;;;;;;WAOJ,kBAAS;AACP,UAAMC,YAAY,GAAG,KAAKC,IAA1B;AADO,0BAEiD,KAAKC,OAFtD;AAAA,UAECC,QAFD,iBAECA,QAFD;AAAA,UAEWC,KAFX,iBAEWA,KAFX;AAAA,UAEkBC,OAFlB,iBAEkBA,OAFlB;AAAA,UAE2BC,QAF3B,iBAE2BA,QAF3B;AAAA,UAEqCC,OAFrC,iBAEqCA,OAFrC;AAGP,0BACE,gCAAC,YAAD;AAAc,QAAA,MAAM,EAAEC;AAAtB,SACG,wBAAOJ,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;;;EApBuBE,e;;iCAApBV,W,iBACiB,a;iCADjBA,W,kBAGkB;AACpBW,EAAAA,KAAK,EAAE;AADa,C;;eAoBT,sBAAgBX,WAAhB,C","sourcesContent":["import React from 'react';\nimport createComponent, { Component } 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 = this.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"}
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;AADO,0BAEiD,KAAKC,OAFtD;AAAA,UAECC,QAFD,iBAECA,QAFD;AAAA,UAEWC,KAFX,iBAEWA,KAFX;AAAA,UAEkBC,OAFlB,iBAEkBA,OAFlB;AAAA,UAE2BC,QAF3B,iBAE2BA,QAF3B;AAAA,UAEqCC,OAFrC,iBAEqCA,OAFrC;AAGP,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"}
@@ -20,34 +20,33 @@ SNotice[use='secondary'] {
20
20
 
21
21
  SNotice[theme='info'] {
22
22
  background-color: color-mod(var(--light-blue) alpha(15%));
23
- }
24
23
 
25
- SNotice[use='secondary'][theme='info'] {
26
- border-color: color-mod(var(--light-blue) alpha(25%));
24
+ &[use='secondary'] {
25
+ border-color: color-mod(var(--light-blue) alpha(25%));
26
+ }
27
27
  }
28
28
 
29
29
  SNotice[theme='danger'] {
30
30
  background-color: color-mod(var(--red) alpha(10%));
31
- }
32
31
 
33
- SNotice[use='secondary'][theme='danger'] {
34
- border-color: color-mod(var(--red) alpha(20%));
32
+ &[use='secondary'] {
33
+ border-color: color-mod(var(--red) alpha(20%));
34
+ }
35
35
  }
36
36
 
37
37
  SNotice[theme='warning'] {
38
38
  background-color: color-mod(var(--light-orange) alpha(15%));
39
- }
40
39
 
41
- SNotice[use='secondary'][theme='warning'] {
42
- border-color: color-mod(var(--light-orange) alpha(40%));
40
+ &[use='secondary'] {
41
+ border-color: color-mod(var(--light-orange) alpha(40%));
42
+ }
43
43
  }
44
44
 
45
45
  SNotice[theme='success'] {
46
46
  background-color: color-mod(var(--green) alpha(15%));
47
- }
48
-
49
- SNotice[use='secondary'][theme='success'] {
50
- border-color: color-mod(var(--green) alpha(30%));
47
+ &[use='secondary'] {
48
+ border-color: color-mod(var(--green) alpha(30%));
49
+ }
51
50
  }
52
51
 
53
52
  SContent {
@@ -65,6 +64,10 @@ SLabel {
65
64
  display: inline-flex;
66
65
  }
67
66
 
67
+ SLabel[theme='danger'] {
68
+ color: var(--red);
69
+ }
70
+
68
71
  SLabel[theme='info'] {
69
72
  color: var(--stone);
70
73
  }
@@ -74,14 +77,22 @@ SLabel[theme='success'] {
74
77
  }
75
78
 
76
79
  SLabel[theme='warning'] {
77
- color: var(--orange);
80
+ color: var(--light-orange);
78
81
  }
79
82
 
80
- SLabel[theme='danger'] {
81
- color: var(--red);
83
+ SLabel[theme='custom'] {
84
+ color: var(--color);
82
85
  }
83
86
 
84
87
  SCloseIcon {
85
88
  flex-shrink: 0;
86
89
  margin-left: 16px;
87
90
  }
91
+
92
+ SNotice[theme='custom'] {
93
+ background-color: var(--backgroundColor);
94
+
95
+ &[use='secondary'] {
96
+ border-color: var(--backgroundColor);
97
+ }
98
+ }