@semcore/notice 2.1.0 → 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/lib/es6/Notice.js CHANGED
@@ -1,73 +1,60 @@
1
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
2
  import _createClass from "@babel/runtime/helpers/createClass";
4
3
  import _inherits from "@babel/runtime/helpers/inherits";
5
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
6
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
- 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; }
9
17
 
10
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); }; }
11
19
 
12
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
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; } }
13
21
 
14
22
  import React from 'react';
15
- import { CSSTransition } from 'react-transition-group';
16
- import createComponent, { Component, styled, css, __css__, set, create, map } from '@semcore/core';
23
+ import createComponent, { Component, sstyled, Root } from '@semcore/core';
17
24
  import { Box } from '@semcore/flex-box';
18
- import CloseAltS from '@semcore/icon/lib/CloseAlt/s';
19
- import logger from '@semcore/utils/lib/logger';
25
+ import CloseXS from '@semcore/icon/lib/Close/xs';
26
+ import resolveColor from '@semcore/utils/lib/color';
27
+ import { FadeInOut } from '@semcore/animation';
20
28
 
21
29
  /*__reshadow-styles__:"./style/notice.shadow.css"*/
22
- var _ref = (
30
+ var style = (
23
31
  /*__reshadow_css_start__*/
24
- __css__(
32
+ _sstyled.insert(
25
33
  /*__inner_css_start__*/
26
- ".___SNotice_65f22_gg_{display:flex;padding:15px;font-size:12px;line-height:1.5;border-style:solid;border-width:1px;border-radius:2px}.___SNotice_65f22_gg_.__theme_65f22_gg_.__theme_info_65f22_gg_{background-color:rgba(43,148,225,.15);border-color:rgba(43,148,225,.25)}.___SNotice_65f22_gg_.__theme_65f22_gg_.__theme_danger_65f22_gg_{background-color:rgba(237,45,45,.1);border-color:rgba(237,45,45,.2)}.___SNotice_65f22_gg_.__theme_65f22_gg_.__theme_warning_65f22_gg_{background-color:rgba(249,177,89,.15);border-color:rgba(249,177,89,.4)}.___SNotice_65f22_gg_.__theme_65f22_gg_.__theme_success_65f22_gg_{background-color:rgba(79,174,51,.15);border-color:rgba(79,174,51,.3)}.___SContent_65f22_gg_{flex:1 1 auto;width:100%}.___SActions_65f22_gg_{flex-shrink:0;margin-top:12px}.___SActions_65f22_gg_>*+*{margin-left:8px}.___SLabel_65f22_gg_{margin-right:8px;display:inline-flex}.___SLabel_65f22_gg_.__theme_65f22_gg_.__theme_info_65f22_gg_{color:#a6b0b3}.___SLabel_65f22_gg_.__theme_65f22_gg_.__theme_success_65f22_gg_{color:#4fae33}.___SLabel_65f22_gg_.__theme_65f22_gg_.__theme_warning_65f22_gg_{color:#ff7f00}.___SLabel_65f22_gg_.__theme_65f22_gg_.__theme_danger_65f22_gg_{color:#ed2d2d}.___SCloseIcon_65f22_gg_{flex-shrink:0;margin-left:16px}._animate--enter_9dgwb_gg_{opacity:.01}._animate--enter-active_14hjw_gg_,._animate--exit_r5265_gg_{opacity:1}._animate--exit-active_1mg3z_gg_{opacity:.01}"
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)}"
27
35
  /*__inner_css_end__*/
28
- , "158wooy_gg_")
36
+ , "1du3pp1_gg_")
29
37
  /*__reshadow_css_end__*/
30
38
  , {
31
- "__SNotice": "___SNotice_65f22_gg_",
32
- "_theme": "__theme_65f22_gg_",
33
- "_theme_info": "__theme_info_65f22_gg_",
34
- "_theme_danger": "__theme_danger_65f22_gg_",
35
- "_theme_warning": "__theme_warning_65f22_gg_",
36
- "_theme_success": "__theme_success_65f22_gg_",
37
- "__SContent": "___SContent_65f22_gg_",
38
- "__SActions": "___SActions_65f22_gg_",
39
- "__SLabel": "___SLabel_65f22_gg_",
40
- "__SCloseIcon": "___SCloseIcon_65f22_gg_",
41
- "animate--enter": "_animate--enter_9dgwb_gg_",
42
- "animate--enter-active": "_animate--enter-active_14hjw_gg_",
43
- "animate--exit": "_animate--exit_r5265_gg_",
44
- "animate--exit-active": "_animate--exit-active_1mg3z_gg_"
45
- }),
46
- style = _extends({}, _ref);
47
-
48
- if (false) {
49
- /*__reshadow_css_start__*/
50
- __css__(
51
- /*__inner_css_start__*/
52
- "@media (max-width: 768px) {.___SNotice_65f22_gg_ {\n padding: 19.5px;\n font-size: 15.6px;\n}\n\n.___SActions_65f22_gg_ {\n margin-top: 15.6px\n}\n\n.___SActions_65f22_gg_ > * + * {\n margin-left: 10.4px;\n }\n\n.___SLabel_65f22_gg_ {\n margin-right: 10.4px;\n}\n\n.___SCloseIcon_65f22_gg_ {\n margin-left: 20.8px;\n}}"
53
- /*__inner_css_end__*/
54
- , "5yj58v_gg_")
55
- /*__reshadow_css_end__*/
56
- ;
57
- }
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"
53
+ });
58
54
 
59
- var styled_c8 = create([(
60
- /*__reshadow_css_start__*/
61
- __css__(
62
- /*__inner_css_start__*/
63
- "._animate--enter-active_6p638_gg_,._animate--exit-active_tr6oy_gg_{transition:opacity var(--13urk6b_0) ease-out}"
64
- /*__inner_css_end__*/
65
- , "d6h9sm_gg_")
66
- /*__reshadow_css_end__*/
67
- , {
68
- "animate--exit-active": "_animate--exit-active_tr6oy_gg_",
69
- "animate--enter-active": "_animate--enter-active_6p638_gg_"
70
- })]);
55
+ function isCustomTheme(theme) {
56
+ return !['danger', 'warning', 'success', 'info'].includes(theme);
57
+ }
71
58
 
72
59
  var RootNotice = /*#__PURE__*/function (_Component) {
73
60
  _inherits(RootNotice, _Component);
@@ -91,35 +78,23 @@ var RootNotice = /*#__PURE__*/function (_Component) {
91
78
  }, {
92
79
  key: "render",
93
80
  value: function render() {
94
- var SNotice = this.Root;
81
+ var _ref = this ? this.asProps : arguments[0],
82
+ _ref6;
95
83
 
84
+ var SNotice = FadeInOut;
96
85
  var _this$asProps = this.asProps,
86
+ Children = _this$asProps.Children,
97
87
  styles = _this$asProps.styles,
98
88
  hidden = _this$asProps.hidden,
99
- theme = _this$asProps.theme,
100
- duration = _this$asProps.duration,
101
- invisible = _this$asProps.invisible,
102
- other = _objectWithoutProperties(_this$asProps, ["styles", "hidden", "theme", "duration", "invisible"]);
103
-
104
- logger.warn(invisible !== undefined, "Свойство 'invisible' является устаревшим, используйте 'hidden'", other['data-ui-name'] || RootNotice.displayName);
105
- var transitionDuration = "".concat(duration, "ms");
106
- return styled((set([styled_c8, styles], {
107
- "--13urk6b_0": transitionDuration
108
- }), /*#__PURE__*/React.createElement(CSSTransition, map("CSSTransition", {
109
- "in": invisible !== undefined ? !invisible : !hidden,
110
- timeout: duration,
111
- classNames: {
112
- enterActive: styled.styles['animate--enter-active'],
113
- exitActive: styled.styles['animate--exit-active'],
114
- enter: styled.styles['animate--enter'],
115
- exit: styled.styles['animate--exit']
116
- },
117
- unmountOnExit: true,
118
- $$style: styled.$$style
119
- }), /*#__PURE__*/React.createElement(SNotice, map("SNotice", {
120
- render: Box,
121
- theme: theme
122
- })))));
89
+ theme = _this$asProps.theme;
90
+ var color = resolveColor(theme);
91
+ var useTheme = isCustomTheme(theme) ? 'custom' : theme;
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", {})));
123
98
  }
124
99
  }]);
125
100
 
@@ -131,53 +106,56 @@ _defineProperty(RootNotice, "displayName", 'Notice');
131
106
  _defineProperty(RootNotice, "style", style);
132
107
 
133
108
  _defineProperty(RootNotice, "defaultProps", {
109
+ use: 'secondary',
134
110
  theme: 'info',
135
111
  duration: 200
136
112
  });
137
113
 
138
- var styled_12c = create([]);
139
-
140
- function Label(props) {
141
- var SLabel = props.Root,
142
- styles = props.styles,
143
- theme = props.theme;
144
- return styled((set([styled_12c, styles]), /*#__PURE__*/React.createElement(SLabel, map("SLabel", {
145
- render: Box,
146
- theme: theme
147
- }))));
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))));
148
127
  }
149
128
 
150
- var styled_190 = create([]);
129
+ function Actions(_ref12) {
130
+ var _ref3 = this ? this.asProps : arguments[0],
131
+ _ref8;
151
132
 
152
- function Actions(props) {
153
- var SActions = props.Root,
154
- styles = props.styles;
155
- return styled((set([styled_190, styles]), /*#__PURE__*/React.createElement(SActions, map("SActions", {
156
- render: Box
157
- }))));
133
+ var styles = _ref12.styles;
134
+ var SActions = Box;
135
+ return _ref8 = sstyled(styles), /*#__PURE__*/React.createElement(SActions, _ref8.cn("SActions", _objectSpread({}, _assignProps3({}, _ref3))));
158
136
  }
159
137
 
160
- var styled_1f4 = create([]);
138
+ function Content(_ref13) {
139
+ var _ref4 = this ? this.asProps : arguments[0],
140
+ _ref9;
161
141
 
162
- function Content(props) {
163
- var SContent = props.Root,
164
- styles = props.styles;
165
- return styled((set([styled_1f4, styles]), /*#__PURE__*/React.createElement(SContent, map("SContent", {
166
- render: Box
167
- }))));
142
+ var styles = _ref13.styles;
143
+ var SContent = Box;
144
+ return _ref9 = sstyled(styles), /*#__PURE__*/React.createElement(SContent, _ref9.cn("SContent", _objectSpread({}, _assignProps4({}, _ref4))));
168
145
  }
169
146
 
170
- var styled_258 = create([]);
171
-
172
- function CloseIcon(props) {
173
- var SCloseIcon = props.Root,
174
- styles = props.styles;
175
- return styled((set([styled_258, styles]), /*#__PURE__*/React.createElement(SCloseIcon, map("SCloseIcon", {
176
- render: Box,
177
- tag: CloseAltS,
178
- color: "stone",
179
- interactive: true
180
- }))));
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": CloseXS,
155
+ "color": "stone",
156
+ "interactive": true,
157
+ "aria-label": "Close alert"
158
+ }, _ref5))));
181
159
  }
182
160
 
183
161
  export default createComponent(RootNotice, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Notice.tsx"],"names":["React","CSSTransition","createComponent","Component","styled","Box","CloseAltS","logger","RootNotice","theme","asProps","SNotice","Root","styles","hidden","duration","invisible","other","warn","undefined","displayName","transitionDuration","enterActive","exitActive","enter","exit","style","Label","props","SLabel","Actions","SActions","Content","SContent","CloseIcon","SCloseIcon"],"mappings":";;;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAqD,OAArD;AACA,SAASC,aAAT,QAA8B,wBAA9B;AACA,OAAOC,eAAP,IACEC,SADF,EAKEC,MALF,wCAMO,qBANP;AAOA,SAASC,GAAT,QAA+B,yBAA/B;AAEA,OAAOC,SAAP,MAAsB,oCAAtB;AACA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,OAAO,EAAPA,OAFY;AAGZE,EAAAA,OAAO,EAAPA,OAHY;AAIZE,EAAAA,SAAS,EAATA;AAJY,CATgB,CAA9B","sourcesContent":["import React, { HTMLAttributes, SVGAttributes } from 'react';\nimport { CSSTransition } from 'react-transition-group';\nimport createComponent, {\n Component,\n IFunctionProps,\n Merge,\n PropGetter,\n styled,\n} from '@semcore/core';\nimport { Box, IBoxProps } from '@semcore/flex-box';\nimport { IIconProps } from '@semcore/icon';\nimport CloseAltS from '@semcore/icon/lib/CloseAlt/s';\nimport logger from '@semcore/utils/lib/logger';\n\nimport style from './style/notice.shadow.css';\n\nexport type NoticeTheme = 'danger' | 'warning' | 'success' | 'info';\n\nexport interface INoticeProps extends IBoxProps {\n /** Property for managing visibility of Notice */\n hidden?: boolean;\n /**\n * Notice theme\n * @default info\n */\n theme?: NoticeTheme;\n /** Duration of animation, ms\n * @default 200\n */\n duration?: number;\n /**\n * Property for managing visibility of Notice\n * @deprecated v2.0.0 {@link INoticeProps.hidden}\n * */\n invisible?: boolean;\n}\n\nexport interface INoticeLabelProps extends IBoxProps {\n theme?: NoticeTheme;\n}\n\nexport interface INoticeContext extends INoticeProps {\n getLabelProps: PropGetter<RootNotice['getLabelProps']>;\n}\n\nclass RootNotice extends Component<INoticeProps> {\n static displayName = 'Notice';\n static style = style;\n static defaultProps = {\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, duration, invisible, ...other } = this.asProps;\n\n logger.warn(\n invisible !== undefined,\n \"Свойство 'invisible' является устаревшим, используйте 'hidden'\",\n other['data-ui-name'] || RootNotice.displayName,\n );\n\n const transitionDuration = `${duration}ms`;\n return styled(styles)`\n .animate--exit-active,\n .animate--enter-active {\n transition: opacity ${transitionDuration} ease-out;\n }\n `(\n <CSSTransition\n in={invisible !== undefined ? !invisible : !hidden}\n timeout={duration}\n classNames={{\n enterActive: styled.styles['animate--enter-active'],\n exitActive: styled.styles['animate--exit-active'],\n enter: styled.styles['animate--enter'],\n exit: styled.styles['animate--exit'],\n }}\n unmountOnExit\n >\n <SNotice render={Box} theme={theme} />\n </CSSTransition>,\n );\n }\n}\n\nfunction Label(props: IFunctionProps<INoticeLabelProps>) {\n const { Root: SLabel, styles, theme } = props;\n return styled(styles)(<SLabel render={Box} theme={theme} />);\n}\n\nfunction Actions(props: IFunctionProps<IBoxProps>) {\n const { Root: SActions, styles } = props;\n return styled(styles)(<SActions render={Box} />);\n}\n\nfunction Content(props: IFunctionProps<IBoxProps>) {\n const { Root: SContent, styles } = props;\n return styled(styles)(<SContent render={Box} />);\n}\n\nfunction CloseIcon(props: IFunctionProps<IBoxProps & IIconProps>) {\n const { Root: SCloseIcon, styles } = props;\n return styled(styles)(<SCloseIcon render={Box} tag={CloseAltS} color=\"stone\" interactive />);\n}\n\nexport default createComponent<\n Merge<INoticeProps, HTMLAttributes<HTMLDivElement>>,\n {\n Label: Merge<INoticeLabelProps, HTMLAttributes<HTMLDivElement>>;\n Actions: Merge<IBoxProps, HTMLAttributes<HTMLDivElement>>;\n Content: Merge<IBoxProps, HTMLAttributes<HTMLDivElement>>;\n CloseIcon: Merge<IBoxProps & IIconProps, SVGAttributes<SVGElement>>;\n },\n INoticeContext\n>(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","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,QAAo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jBA,MAAiB;AAAA,MAATN,KAAS,UAATA,KAAS;AAChC,MAAMc,MAAM,GAG2BnB,GAHvC;AACA,MAAMc,QAAQ,GAAGV,aAAa,CAACC,KAAD,CAAb,GAAuB,QAAvB,GAAkCA,KAAnD;AACA,MAAMQ,KAAK,GAAGX,YAAY,CAACG,KAAD,CAA1B;AACA,iBAAOP,OAAO,CAACa,MAAD,CAAd,eAAuB,oBAAC,MAAD;AAAA,iBAAgCG,QAAhC;AAAA,aAAiDD;AAAjD,cAAvB;AACD;;AAED,SAASO,OAAT,SAA6B;AAAA;AAAA;;AAAA,MAAVT,MAAU,UAAVA,MAAU;AAC3B,MAAMU,QAAQ,GAC2BrB,GADzC;AACA,iBAAOF,OAAO,CAACa,MAAD,CAAd,eAAuB,oBAAC,QAAD,oEAAvB;AACD;;AAED,SAASW,OAAT,SAA6B;AAAA;AAAA;;AAAA,MAAVX,MAAU,UAAVA,MAAU;AAC3B,MAAMY,QAAQ,GAC2BvB,GADzC;AACA,iBAAOF,OAAO,CAACa,MAAD,CAAd,eAAuB,oBAAC,QAAD,oEAAvB;AACD;;AAED,SAASa,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"}
@@ -4,15 +4,16 @@ 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
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
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
- import Notice from '../Notice';
16
+ import Notice from './Notice';
16
17
 
17
18
  var NoticeSmart = /*#__PURE__*/function (_Component) {
18
19
  _inherits(NoticeSmart, _Component);
@@ -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
  }
@@ -53,4 +54,4 @@ _defineProperty(NoticeSmart, "defaultProps", {
53
54
  });
54
55
 
55
56
  export default createComponent(NoticeSmart);
56
- //# sourceMappingURL=index.js.map
57
+ //# sourceMappingURL=NoticeSmart.js.map
@@ -0,0 +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;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"}
package/lib/es6/index.js CHANGED
@@ -1,7 +1,4 @@
1
- import { default as NoticeSmart } from './NoticeSmart';
2
- export * from './NoticeSmart';
3
1
  import { default as Notice } from './Notice';
4
- export * from './Notice';
5
2
  export default Notice;
6
- export { NoticeSmart };
3
+ export { default as NoticeSmart } from './NoticeSmart';
7
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.tsx"],"names":["default","NoticeSmart","Notice"],"mappings":"AAAA,SAASA,OAAO,IAAIC,WAApB,QAAuC,eAAvC;AAEA,cAAc,eAAd;AAEA,SAASD,OAAO,IAAIE,MAApB,QAAkC,UAAlC;AAEA,cAAc,UAAd;AAEA,eAAeA,MAAf;AACA,SAASD,WAAT","sourcesContent":["import { default as NoticeSmart } from './NoticeSmart';\n\nexport * from './NoticeSmart';\n\nimport { default as Notice } from './Notice';\n\nexport * from './Notice';\n\nexport default Notice;\nexport { NoticeSmart };\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/index.js"],"names":["default","Notice","NoticeSmart"],"mappings":"AAAA,SAASA,OAAO,IAAIC,MAApB,QAAkC,UAAlC;AAEA,eAAeA,MAAf;AACA,SAASD,OAAO,IAAIE,WAApB,QAAuC,eAAvC","sourcesContent":["import { default as Notice } from './Notice';\n\nexport default Notice;\nexport { default as NoticeSmart } from './NoticeSmart';\n"],"file":"index.js"}
@@ -2,9 +2,17 @@
2
2
 
3
3
  SNotice {
4
4
  display: flex;
5
- padding: media(15px);
6
5
  font-size: var(--fs-100);
7
6
  line-height: var(--lh-100);
7
+ box-sizing: border-box;
8
+ }
9
+
10
+ SNotice[use='primary'] {
11
+ padding: 8px 32px;
12
+ }
13
+
14
+ SNotice[use='secondary'] {
15
+ padding: 15px;
8
16
  border-style: solid;
9
17
  border-width: 1px;
10
18
  border-radius: 2px;
@@ -12,22 +20,33 @@ SNotice {
12
20
 
13
21
  SNotice[theme='info'] {
14
22
  background-color: color-mod(var(--light-blue) alpha(15%));
15
- border-color: color-mod(var(--light-blue) alpha(25%));
23
+
24
+ &[use='secondary'] {
25
+ border-color: color-mod(var(--light-blue) alpha(25%));
26
+ }
16
27
  }
17
28
 
18
29
  SNotice[theme='danger'] {
19
30
  background-color: color-mod(var(--red) alpha(10%));
20
- border-color: color-mod(var(--red) alpha(20%));
31
+
32
+ &[use='secondary'] {
33
+ border-color: color-mod(var(--red) alpha(20%));
34
+ }
21
35
  }
22
36
 
23
37
  SNotice[theme='warning'] {
24
38
  background-color: color-mod(var(--light-orange) alpha(15%));
25
- border-color: color-mod(var(--light-orange) alpha(40%));
39
+
40
+ &[use='secondary'] {
41
+ border-color: color-mod(var(--light-orange) alpha(40%));
42
+ }
26
43
  }
27
44
 
28
45
  SNotice[theme='success'] {
29
46
  background-color: color-mod(var(--green) alpha(15%));
30
- border-color: color-mod(var(--green) alpha(30%));
47
+ &[use='secondary'] {
48
+ border-color: color-mod(var(--green) alpha(30%));
49
+ }
31
50
  }
32
51
 
33
52
  SContent {
@@ -37,18 +56,18 @@ SContent {
37
56
 
38
57
  SActions {
39
58
  flex-shrink: 0;
40
- margin-top: media(12px);
41
-
42
- & > * + * {
43
- margin-left: media(8px);
44
- }
59
+ margin-top: 12px;
45
60
  }
46
61
 
47
62
  SLabel {
48
- margin-right: media(8px);
63
+ margin-right: 8px;
49
64
  display: inline-flex;
50
65
  }
51
66
 
67
+ SLabel[theme='danger'] {
68
+ color: var(--red);
69
+ }
70
+
52
71
  SLabel[theme='info'] {
53
72
  color: var(--stone);
54
73
  }
@@ -58,27 +77,22 @@ SLabel[theme='success'] {
58
77
  }
59
78
 
60
79
  SLabel[theme='warning'] {
61
- color: var(--orange);
80
+ color: var(--light-orange);
62
81
  }
63
82
 
64
- SLabel[theme='danger'] {
65
- color: var(--red);
83
+ SLabel[theme='custom'] {
84
+ color: var(--color);
66
85
  }
67
86
 
68
87
  SCloseIcon {
69
88
  flex-shrink: 0;
70
- margin-left: media(16px);
89
+ margin-left: 16px;
71
90
  }
72
91
 
73
- .animate--enter {
74
- opacity: 0.01;
75
- }
92
+ SNotice[theme='custom'] {
93
+ background-color: var(--backgroundColor);
76
94
 
77
- .animate--enter-active,
78
- .animate--exit {
79
- opacity: 1;
80
- }
81
-
82
- .animate--exit-active {
83
- opacity: 0.01;
95
+ &[use='secondary'] {
96
+ border-color: var(--backgroundColor);
97
+ }
84
98
  }
@@ -1,6 +1,63 @@
1
- import { default as NoticeSmart } from './NoticeSmart';
2
- export * from './NoticeSmart';
3
- import { default as Notice } from './Notice';
4
- export * from './Notice';
5
- export default Notice;
1
+ import { CProps, PropGetterFn, ReturnEl } from '@semcore/core';
2
+ import { Box, IBoxProps } from '@semcore/flex-box';
3
+ import { IIconProps } from '@semcore/icon';
4
+
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
+ }
33
+
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
+
6
62
  export { NoticeSmart };
63
+ export default Notice;
package/package.json CHANGED
@@ -1,27 +1,25 @@
1
1
  {
2
2
  "name": "@semcore/notice",
3
3
  "description": "SEMRush Notice Component",
4
- "version": "2.1.0",
4
+ "version": "3.1.2",
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": {
14
- "build": "build",
12
+ "build": "build --source=js",
15
13
  "test": "jest"
16
14
  },
17
15
  "dependencies": {
16
+ "@semcore/animation": "^1",
18
17
  "@semcore/utils": "^3.15",
19
18
  "@semcore/flex-box": "^4",
20
- "@semcore/icon": "^2",
21
- "react-transition-group": "^4.4"
19
+ "@semcore/icon": "^2"
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": {