@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/lib/es6/Notice.js CHANGED
@@ -4,76 +4,58 @@ import _inherits from "@babel/runtime/helpers/inherits";
4
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
6
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
- import _extends from "@babel/runtime/helpers/extends";
7
+ import { sstyled as _sstyled } from "@semcore/core";
8
+ import { assignProps as _assignProps5 } from "@semcore/core";
9
+ import { assignProps as _assignProps4 } from "@semcore/core";
10
+ import { assignProps as _assignProps3 } from "@semcore/core";
11
+ import { assignProps as _assignProps2 } from "@semcore/core";
12
+ import { assignProps as _assignProps } from "@semcore/core";
13
+
14
+ 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; }
15
+
16
+ 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) { _defineProperty(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; }
8
17
 
9
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); }; }
10
19
 
11
20
  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; } }
12
21
 
13
22
  import React from 'react';
14
- import createComponent, { Component, styled, css, __css__, set, create, map } from '@semcore/core';
23
+ import createComponent, { Component, sstyled, Root } from '@semcore/core';
15
24
  import { Box } from '@semcore/flex-box';
16
- import CloseXS from '@semcore/icon/lib/Close/xs';
25
+ import Close from '@semcore/icon/Close/m';
17
26
  import resolveColor from '@semcore/utils/lib/color';
18
27
  import { FadeInOut } from '@semcore/animation';
19
28
 
20
29
  /*__reshadow-styles__:"./style/notice.shadow.css"*/
21
- var _ref = (
30
+ var style = (
22
31
  /*__reshadow_css_start__*/
23
- __css__(
32
+ _sstyled.insert(
24
33
  /*__inner_css_start__*/
25
- ".___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}"
34
+ ".___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)}"
26
35
  /*__inner_css_end__*/
27
- , "7ukgx9_gg_")
36
+ , "1du3pp1_gg_")
28
37
  /*__reshadow_css_end__*/
29
38
  , {
30
- "__SNotice": "___SNotice_13gnh_gg_",
31
- "_use": "__use_13gnh_gg_",
32
- "_use_primary": "__use_primary_13gnh_gg_",
33
- "_use_secondary": "__use_secondary_13gnh_gg_",
34
- "_theme": "__theme_13gnh_gg_",
35
- "_theme_info": "__theme_info_13gnh_gg_",
36
- "_theme_danger": "__theme_danger_13gnh_gg_",
37
- "_theme_warning": "__theme_warning_13gnh_gg_",
38
- "_theme_success": "__theme_success_13gnh_gg_",
39
- "__SContent": "___SContent_13gnh_gg_",
40
- "__SActions": "___SActions_13gnh_gg_",
41
- "__SLabel": "___SLabel_13gnh_gg_",
42
- "__SCloseIcon": "___SCloseIcon_13gnh_gg_"
43
- }),
44
- style = _extends({}, _ref);
45
-
46
- if (false) {
47
- /*__reshadow_css_start__*/
48
- __css__(
49
- /*__inner_css_start__*/
50
- "@media (max-width: 768px) {.___SNotice_13gnh_gg_ {\n font-size: 15.6px;\n}}"
51
- /*__inner_css_end__*/
52
- , "10d6lwe_gg_")
53
- /*__reshadow_css_end__*/
54
- ;
55
- }
39
+ "__SNotice": "___SNotice_1tywf_gg_",
40
+ "_use_primary": "_use_primary_1tywf_gg_",
41
+ "_use_secondary": "_use_secondary_1tywf_gg_",
42
+ "_theme_info": "_theme_info_1tywf_gg_",
43
+ "_theme_danger": "_theme_danger_1tywf_gg_",
44
+ "_theme_warning": "_theme_warning_1tywf_gg_",
45
+ "_theme_success": "_theme_success_1tywf_gg_",
46
+ "__SContent": "___SContent_1tywf_gg_",
47
+ "__SActions": "___SActions_1tywf_gg_",
48
+ "__SLabel": "___SLabel_1tywf_gg_",
49
+ "_theme_custom": "_theme_custom_1tywf_gg_",
50
+ "--color": "--color_1du3pp1",
51
+ "__SCloseIcon": "___SCloseIcon_1tywf_gg_",
52
+ "--backgroundColor": "--backgroundColor_1du3pp1"
53
+ });
56
54
 
57
55
  function isCustomTheme(theme) {
58
56
  return !['danger', 'warning', 'success', 'info'].includes(theme);
59
57
  }
60
58
 
61
- var styled_c8 = create([(
62
- /*__reshadow_css_start__*/
63
- __css__(
64
- /*__inner_css_start__*/
65
- ".___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)}"
66
- /*__inner_css_end__*/
67
- , "f664o2_gg_")
68
- /*__reshadow_css_end__*/
69
- , {
70
- "__SNotice": "___SNotice_118cq_gg_",
71
- "_theme": "__theme_118cq_gg_",
72
- "_theme_custom": "__theme_custom_118cq_gg_",
73
- "_use": "__use_118cq_gg_",
74
- "_use_secondary": "__use_secondary_118cq_gg_"
75
- })]);
76
-
77
59
  var RootNotice = /*#__PURE__*/function (_Component) {
78
60
  _inherits(RootNotice, _Component);
79
61
 
@@ -96,23 +78,23 @@ var RootNotice = /*#__PURE__*/function (_Component) {
96
78
  }, {
97
79
  key: "render",
98
80
  value: function render() {
99
- var SNotice = this.Root;
81
+ var _ref = this ? this.asProps : arguments[0],
82
+ _ref6;
83
+
84
+ var SNotice = FadeInOut;
100
85
  var _this$asProps = this.asProps,
86
+ Children = _this$asProps.Children,
101
87
  styles = _this$asProps.styles,
102
88
  hidden = _this$asProps.hidden,
103
- theme = _this$asProps.theme,
104
- use = _this$asProps.use;
89
+ theme = _this$asProps.theme;
105
90
  var color = resolveColor(theme);
106
91
  var useTheme = isCustomTheme(theme) ? 'custom' : theme;
107
- return styled((set([styled_c8, styles], {
108
- "--applr9_0": color
109
- }), /*#__PURE__*/React.createElement(SNotice, map("SNotice", {
110
- render: FadeInOut,
111
- visible: !hidden,
112
- use: use,
113
- theme: useTheme,
114
- $$style: styled.$$style
115
- }))));
92
+ return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SNotice, _ref6.cn("SNotice", _objectSpread({}, _assignProps({
93
+ "visible": !hidden,
94
+ "use:theme": useTheme,
95
+ "backgroundColor": color,
96
+ "role": "alert"
97
+ }, _ref))), /*#__PURE__*/React.createElement(Children, _ref6.cn("Children", {})));
116
98
  }
117
99
  }]);
118
100
 
@@ -129,49 +111,51 @@ _defineProperty(RootNotice, "defaultProps", {
129
111
  duration: 200
130
112
  });
131
113
 
132
- var styled_12c = create([]);
133
-
134
- function Label(_ref2) {
135
- var SLabel = _ref2.Root,
136
- styles = _ref2.styles,
137
- theme = _ref2.theme;
138
- return styled((set([styled_12c, styles]), /*#__PURE__*/React.createElement(SLabel, map("SLabel", {
139
- render: Box,
140
- theme: !isCustomTheme(theme) && theme
141
- }))));
114
+ function Label(_ref11) {
115
+ var _ref2 = this ? this.asProps : arguments[0],
116
+ _ref7;
117
+
118
+ var styles = _ref11.styles,
119
+ theme = _ref11.theme;
120
+ var SLabel = Box;
121
+ var useTheme = isCustomTheme(theme) ? 'custom' : theme;
122
+ var color = resolveColor(theme);
123
+ return _ref7 = sstyled(styles), /*#__PURE__*/React.createElement(SLabel, _ref7.cn("SLabel", _objectSpread({}, _assignProps2({
124
+ "use:theme": useTheme,
125
+ "color": color
126
+ }, _ref2))));
142
127
  }
143
128
 
144
- var styled_190 = create([]);
129
+ function Actions(_ref12) {
130
+ var _ref3 = this ? this.asProps : arguments[0],
131
+ _ref8;
145
132
 
146
- function Actions(_ref3) {
147
- var SActions = _ref3.Root,
148
- styles = _ref3.styles;
149
- return styled((set([styled_190, styles]), /*#__PURE__*/React.createElement(SActions, map("SActions", {
150
- render: Box
151
- }))));
133
+ var styles = _ref12.styles;
134
+ var SActions = Box;
135
+ return _ref8 = sstyled(styles), /*#__PURE__*/React.createElement(SActions, _ref8.cn("SActions", _objectSpread({}, _assignProps3({}, _ref3))));
152
136
  }
153
137
 
154
- var styled_1f4 = create([]);
138
+ function Content(_ref13) {
139
+ var _ref4 = this ? this.asProps : arguments[0],
140
+ _ref9;
155
141
 
156
- function Content(_ref4) {
157
- var SContent = _ref4.Root,
158
- styles = _ref4.styles;
159
- return styled((set([styled_1f4, styles]), /*#__PURE__*/React.createElement(SContent, map("SContent", {
160
- render: Box
161
- }))));
142
+ var styles = _ref13.styles;
143
+ var SContent = Box;
144
+ return _ref9 = sstyled(styles), /*#__PURE__*/React.createElement(SContent, _ref9.cn("SContent", _objectSpread({}, _assignProps4({}, _ref4))));
162
145
  }
163
146
 
164
- var styled_258 = create([]);
165
-
166
- function CloseIcon(_ref5) {
167
- var SCloseIcon = _ref5.Root,
168
- styles = _ref5.styles;
169
- return styled((set([styled_258, styles]), /*#__PURE__*/React.createElement(SCloseIcon, map("SCloseIcon", {
170
- render: Box,
171
- tag: CloseXS,
172
- color: "stone",
173
- interactive: true
174
- }))));
147
+ function CloseIcon(_ref14) {
148
+ var _ref5 = this ? this.asProps : arguments[0],
149
+ _ref10;
150
+
151
+ var styles = _ref14.styles;
152
+ var SCloseIcon = Box;
153
+ return _ref10 = sstyled(styles), /*#__PURE__*/React.createElement(SCloseIcon, _ref10.cn("SCloseIcon", _objectSpread({}, _assignProps5({
154
+ "tag": Close,
155
+ "color": "stone",
156
+ "interactive": true,
157
+ "aria-label": "Close alert"
158
+ }, _ref5))));
175
159
  }
176
160
 
177
161
  export default createComponent(RootNotice, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Notice.js"],"names":["React","createComponent","Component","styled","Box","CloseXS","resolveColor","FadeInOut","isCustomTheme","theme","includes","RootNotice","asProps","SNotice","Root","styles","hidden","use","color","useTheme","style","duration","Label","SLabel","Actions","SActions","Content","SContent","CloseIcon","SCloseIcon"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,eAAP,IAA0BC,SAA1B,EAAqCC,MAArC,wCAAmD,eAAnD;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;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,GAAGZ,YAAY,CAACG,KAAD,CAA1B;AACA,UAAMU,QAAQ,GAAGX,aAAa,CAACC,KAAD,CAAb,GAAuB,QAAvB,GAAkCA,KAAnD;AAEA,aAAO,wBAAOM,MAAP;AAAA,sBAEiBG;AAFjB,uBAQL,oBAAC,OAAD;AAAA,gBAAiBX,SAAjB;AAAA,iBAAqC,CAACS,MAAtC;AAAA,aAAmDC,GAAnD;AAAA,eAA+DE,QAA/D;AAAA;AAAA,SARK,EAAP;AASD;;;;EA/BsBjB,S;;gBAAnBS,U,iBACiB,Q;;gBADjBA,U,WAEWS,K;;gBAFXT,U,kBAGkB;AACpBM,EAAAA,GAAG,EAAE,WADe;AAEpBR,EAAAA,KAAK,EAAE,MAFa;AAGpBY,EAAAA,QAAQ,EAAE;AAHU,C;;;;AA+BxB,SAASC,KAAT,QAAgD;AAAA,MAAzBC,MAAyB,SAA/BT,IAA+B;AAAA,MAAjBC,MAAiB,SAAjBA,MAAiB;AAAA,MAATN,KAAS,SAATA,KAAS;AAC9C,SAAO,yBAAOM,MAAP,iBAAe,oBAAC,MAAD;AAAA,YAAgBX,GAAhB;AAAA,WAA4B,CAACI,aAAa,CAACC,KAAD,CAAd,IAAyBA;AAArD,KAAf,EAAP;AACD;;;;AAED,SAASe,OAAT,QAA6C;AAAA,MAApBC,QAAoB,SAA1BX,IAA0B;AAAA,MAAVC,MAAU,SAAVA,MAAU;AAC3C,SAAO,yBAAOA,MAAP,iBAAe,oBAAC,QAAD;AAAA,YAAkBX;AAAlB,KAAf,EAAP;AACD;;;;AAED,SAASsB,OAAT,QAA6C;AAAA,MAApBC,QAAoB,SAA1Bb,IAA0B;AAAA,MAAVC,MAAU,SAAVA,MAAU;AAC3C,SAAO,yBAAOA,MAAP,iBAAe,oBAAC,QAAD;AAAA,YAAkBX;AAAlB,KAAf,EAAP;AACD;;;;AAED,SAASwB,SAAT,QAAiD;AAAA,MAAtBC,UAAsB,SAA5Bf,IAA4B;AAAA,MAAVC,MAAU,SAAVA,MAAU;AAC/C,SAAO,yBAAOA,MAAP,iBAAe,oBAAC,UAAD;AAAA,YAAoBX,GAApB;AAAA,SAA8BC,OAA9B;AAAA,WAA6C,OAA7C;AAAA;AAAA,KAAf,EAAP;AACD;;AAED,eAAeJ,eAAe,CAACU,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, 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":["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"}
@@ -4,13 +4,14 @@ import _inherits from "@babel/runtime/helpers/inherits";
4
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
6
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
+ import { assignProps as _assignProps } from "@semcore/core";
7
8
 
8
9
  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); }; }
9
10
 
10
11
  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; } }
11
12
 
12
13
  import React from 'react';
13
- import createComponent, { Component } from '@semcore/core';
14
+ import createComponent, { Component, Root } from '@semcore/core';
14
15
  import isNode from '@semcore/utils/lib/isNode';
15
16
  import Notice from './Notice';
16
17
 
@@ -28,16 +29,16 @@ var NoticeSmart = /*#__PURE__*/function (_Component) {
28
29
  _createClass(NoticeSmart, [{
29
30
  key: "render",
30
31
  value: function render() {
31
- var SNoticeSmart = this.Root;
32
+ var _ref = this ? this.asProps : arguments[0];
33
+
34
+ var SNoticeSmart = Notice;
32
35
  var _this$asProps = this.asProps,
33
36
  Children = _this$asProps.Children,
34
37
  label = _this$asProps.label,
35
38
  actions = _this$asProps.actions,
36
39
  closable = _this$asProps.closable,
37
40
  onClose = _this$asProps.onClose;
38
- return /*#__PURE__*/React.createElement(SNoticeSmart, {
39
- render: Notice
40
- }, isNode(label) && /*#__PURE__*/React.createElement(Notice.Label, null, label), /*#__PURE__*/React.createElement(Notice.Content, null, /*#__PURE__*/React.createElement(Children, null), isNode(actions) && /*#__PURE__*/React.createElement(Notice.Actions, null, actions)), closable && /*#__PURE__*/React.createElement(Notice.CloseIcon, {
41
+ return /*#__PURE__*/React.createElement(SNoticeSmart, _assignProps({}, _ref), isNode(label) && /*#__PURE__*/React.createElement(Notice.Label, null, label), /*#__PURE__*/React.createElement(Notice.Content, null, /*#__PURE__*/React.createElement(Children, null), isNode(actions) && /*#__PURE__*/React.createElement(Notice.Actions, null, actions)), closable && /*#__PURE__*/React.createElement(Notice.CloseIcon, {
41
42
  onClick: onClose
42
43
  }));
43
44
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/NoticeSmart.js"],"names":["React","createComponent","Component","isNode","Notice","NoticeSmart","SNoticeSmart","Root","asProps","Children","label","actions","closable","onClose","theme"],"mappings":";;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,eAAP,IAA0BC,SAA1B,QAA2C,eAA3C;AACA,OAAOC,MAAP,MAAmB,2BAAnB;AACA,OAAOC,MAAP,MAAmB,UAAnB;;IAEMC,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,oBAAC,YAAD;AAAc,QAAA,MAAM,EAAET;AAAtB,SACGD,MAAM,CAACO,KAAD,CAAN,iBAAiB,oBAAC,MAAD,CAAQ,KAAR,QAAeA,KAAf,CADpB,eAEE,oBAAC,MAAD,CAAQ,OAAR,qBACE,oBAAC,QAAD,OADF,EAEGP,MAAM,CAACQ,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;;gBAApBG,W,iBACiB,a;;gBADjBA,W,kBAGkB;AACpBS,EAAAA,KAAK,EAAE;AADa,C;;AAoBxB,eAAeb,eAAe,CAACI,WAAD,CAA9B","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":["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;AADO,0BAEiD,KAAKG,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,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"}
@@ -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
+ }
@@ -1,7 +1,63 @@
1
- import { default as Notice } from './Notice';
1
+ import { CProps, PropGetterFn, ReturnEl } from '@semcore/core';
2
+ import { Box, IBoxProps } from '@semcore/flex-box';
3
+ import { IIconProps } from '@semcore/icon';
2
4
 
3
- export default Notice;
4
- export * from './Notice';
5
+ export type NoticeTheme = 'danger' | 'warning' | 'success' | 'info' | string;
6
+ export type NoticeUse = 'primary' | 'secondary';
7
+
8
+ export interface INoticeProps extends IBoxProps {
9
+ /** Property for managing visibility of Notice */
10
+ hidden?: boolean;
11
+ /** Notice type
12
+ * @default secondary
13
+ */
14
+ use?: NoticeUse;
15
+ /**
16
+ * Notice theme
17
+ * @default info
18
+ */
19
+ theme?: NoticeTheme;
20
+ /** Duration of animation, ms
21
+ * @default 200
22
+ */
23
+ duration?: number;
24
+ }
25
+
26
+ export interface INoticeLabelProps extends IBoxProps {
27
+ theme?: NoticeTheme;
28
+ }
29
+
30
+ export interface INoticeContext {
31
+ getLabelProps: PropGetterFn;
32
+ }
5
33
 
6
- export { default as NoticeSmart } from './NoticeSmart';
7
- export * from './NoticeSmart';
34
+ export interface INoticeSmartProps extends INoticeProps {
35
+ /**
36
+ * A custom element for additional information
37
+ */
38
+ label?: React.ReactNode;
39
+ /**
40
+ * Custom action element
41
+ */
42
+ actions?: React.ReactNode;
43
+ /**
44
+ * Adds a Close icon
45
+ */
46
+ closable?: boolean;
47
+ /**
48
+ * Callback on a click on the close button
49
+ */
50
+ onClose?: (event: React.SyntheticEvent) => void;
51
+ }
52
+
53
+ declare const Notice: (<T>(props: CProps<INoticeProps & T, INoticeContext>) => ReturnEl) & {
54
+ Label: <T>(props: INoticeLabelProps & T) => ReturnEl;
55
+ Actions: typeof Box;
56
+ Content: typeof Box;
57
+ CloseIcon: <T>(props: IIconProps & T) => ReturnEl;
58
+ };
59
+
60
+ declare const NoticeSmart: <T>(props: CProps<INoticeSmartProps & T>) => ReturnEl;
61
+
62
+ export { NoticeSmart };
63
+ export default Notice;
package/package.json CHANGED
@@ -1,13 +1,11 @@
1
1
  {
2
2
  "name": "@semcore/notice",
3
3
  "description": "SEMRush Notice Component",
4
- "version": "3.0.0",
4
+ "version": "3.2.0",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
8
- "sideEffects": [
9
- "lib/*/Notice.js"
10
- ],
8
+ "sideEffects": false,
11
9
  "author": "Roman Lysov <r.lysov@semrush.com>",
12
10
  "license": "MIT",
13
11
  "scripts": {
@@ -18,10 +16,10 @@
18
16
  "@semcore/animation": "^1",
19
17
  "@semcore/utils": "^3.15",
20
18
  "@semcore/flex-box": "^4",
21
- "@semcore/icon": "^2"
19
+ "@semcore/icon": "^2.16"
22
20
  },
23
21
  "peerDependencies": {
24
- "@semcore/core": "^1",
22
+ "@semcore/core": "^1.11",
25
23
  "react": "16.8 - 17"
26
24
  },
27
25
  "jest": {
package/src/Notice.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import createComponent, { Component, styled } from '@semcore/core';
2
+ import createComponent, { Component, sstyled, Root } from '@semcore/core';
3
3
  import { Box } from '@semcore/flex-box';
4
- import CloseXS from '@semcore/icon/lib/Close/xs';
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
 
@@ -28,37 +28,47 @@ class RootNotice extends Component {
28
28
  }
29
29
 
30
30
  render() {
31
- const SNotice = this.Root;
32
- const { styles, hidden, theme, use } = this.asProps;
31
+ const SNotice = Root;
32
+ const { Children, styles, hidden, theme } = this.asProps;
33
33
  const color = resolveColor(theme);
34
34
  const useTheme = isCustomTheme(theme) ? 'custom' : theme;
35
35
 
36
- return styled(styles)`
37
- SNotice[theme='custom'] {
38
- background-color: ${color};
39
-
40
- &[use='secondary'] {
41
- border-color: ${color};
42
- }
43
- }
44
- `(<SNotice render={FadeInOut} visible={!hidden} use={use} theme={useTheme} />);
36
+ return sstyled(styles)(
37
+ <SNotice
38
+ render={FadeInOut}
39
+ visible={!hidden}
40
+ use:theme={useTheme}
41
+ backgroundColor={color}
42
+ role="alert"
43
+ >
44
+ <Children />
45
+ </SNotice>,
46
+ );
45
47
  }
46
48
  }
47
49
 
48
- function Label({ Root: SLabel, styles, theme }) {
49
- return styled(styles)(<SLabel render={Box} theme={!isCustomTheme(theme) && theme} />);
50
+ function Label({ styles, theme }) {
51
+ const SLabel = Root;
52
+ const useTheme = isCustomTheme(theme) ? 'custom' : theme;
53
+ const color = resolveColor(theme);
54
+ return sstyled(styles)(<SLabel render={Box} use:theme={useTheme} color={color} />);
50
55
  }
51
56
 
52
- function Actions({ Root: SActions, styles }) {
53
- return styled(styles)(<SActions render={Box} />);
57
+ function Actions({ styles }) {
58
+ const SActions = Root;
59
+ return sstyled(styles)(<SActions render={Box} />);
54
60
  }
55
61
 
56
- function Content({ Root: SContent, styles }) {
57
- return styled(styles)(<SContent render={Box} />);
62
+ function Content({ styles }) {
63
+ const SContent = Root;
64
+ return sstyled(styles)(<SContent render={Box} />);
58
65
  }
59
66
 
60
- function CloseIcon({ Root: SCloseIcon, styles }) {
61
- return styled(styles)(<SCloseIcon render={Box} tag={CloseXS} color="stone" interactive />);
67
+ function CloseIcon({ styles }) {
68
+ const SCloseIcon = Root;
69
+ return sstyled(styles)(
70
+ <SCloseIcon render={Box} tag={Close} color="stone" interactive aria-label="Close alert" />,
71
+ );
62
72
  }
63
73
 
64
74
  export default createComponent(RootNotice, {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import createComponent, { Component } from '@semcore/core';
2
+ import createComponent, { Component, Root } from '@semcore/core';
3
3
  import isNode from '@semcore/utils/lib/isNode';
4
4
  import Notice from './Notice';
5
5
 
@@ -11,7 +11,7 @@ class NoticeSmart extends Component {
11
11
  };
12
12
 
13
13
  render() {
14
- const SNoticeSmart = this.Root;
14
+ const SNoticeSmart = Root;
15
15
  const { Children, label, actions, closable, onClose } = this.asProps;
16
16
  return (
17
17
  <SNoticeSmart render={Notice}>