@semcore/notice-bubble 3.2.2 → 3.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
+ ## [3.3.2] - 2022-03-05
6
+
7
+ ### Changed
8
+
9
+ - Version patch update due to children dependencies update (`@semcore/animation` [1.4.0 ~> 1.4.1]).
10
+
11
+ ## [3.3.1] - 2022-02-24
12
+
13
+ ### Added
14
+
15
+ - Added repository field to package.json file.
16
+
17
+ ## [3.3.0] - 2022-01-18
18
+
19
+ ### Changed
20
+
21
+ - Up version icons and use new icon.
22
+
5
23
  ## [3.2.2] - 2021-8-26
6
24
 
7
25
  ### Fixed
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
4
 
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
@@ -43,35 +43,42 @@ var _isNode = _interopRequireDefault(require("@semcore/utils/lib/isNode"));
43
43
 
44
44
  var _assignProps2 = require("@semcore/utils/lib/assignProps");
45
45
 
46
- var _xs = _interopRequireDefault(require("@semcore/icon/lib/Close/xs"));
46
+ var _m = _interopRequireDefault(require("@semcore/icon/Close/m"));
47
47
 
48
48
  var _utils = require("./utils");
49
49
 
50
+ var _excluded = ["action", "forwardRef", "styles", "onMouseEnter", "onMouseLeave", "children"],
51
+ _excluded2 = ["action", "children", "styles", "forwardRef"];
52
+
53
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
54
+
55
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
56
+
50
57
  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); }; }
51
58
 
52
59
  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; } }
53
60
 
54
- 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; }
61
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
55
62
 
56
- 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; }
63
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
57
64
 
58
65
  /*__reshadow-styles__:"./style/notice-bubble.shadow.css"*/
59
66
  var style = (
60
67
  /*__reshadow_css_start__*/
61
68
  _core.sstyled.insert(
62
69
  /*__inner_css_start__*/
63
- ".___SInfo_1t051_gg_,.___SView_1t051_gg_,.___SWarning_1t051_gg_{position:relative;margin-bottom:12px;padding:12px 24px 12px 12px;width:100%;min-height:42px;border-radius:3px;overflow:hidden;box-sizing:border-box}.___SInfo_1t051_gg_{background:#333}.___SWarning_1t051_gg_{background:#ff7f00}.___SMessage_1t051_gg_{font-size:12px;color:#fff;line-height:1.5}.___SDismiss_1t051_gg_{cursor:pointer;position:absolute;right:0;top:0;padding:8px;color:#757575}.___SDismiss_1t051_gg_:hover{color:#ccc}.___SAction_1t051_gg_{margin-top:8px}.___SNoticeBubble_1t051_gg_{width:300px;position:fixed;z-index:1010;right:10px;top:10px}@media (max-width:767px){.___SNoticeBubble_1t051_gg_{width:calc(100% - 20px)}}"
70
+ ".___SInfo_1qnlw_gg_,.___SView_1qnlw_gg_,.___SWarning_1qnlw_gg_{position:relative;margin-bottom:12px;padding:12px 24px 12px 12px;width:100%;min-height:42px;border-radius:3px;overflow:hidden;box-sizing:border-box}.___SInfo_1qnlw_gg_{background:#333333}.___SWarning_1qnlw_gg_{background:#ff7f00}.___SMessage_1qnlw_gg_{font-size:12px;color:#fff;line-height:1.5}.___SDismiss_1qnlw_gg_{cursor:pointer;position:absolute;right:0;top:0;padding:8px;color:#757575}.___SDismiss_1qnlw_gg_:hover{color:#cccccc}.___SAction_1qnlw_gg_{margin-top:8px}.___SNoticeBubble_1qnlw_gg_{width:300px;position:fixed;z-index:1010;right:10px;top:10px}@media (max-width:767px){.___SNoticeBubble_1qnlw_gg_{width:calc(100% - 20px)}}"
64
71
  /*__inner_css_end__*/
65
72
  , "1nxod8h_gg_")
66
73
  /*__reshadow_css_end__*/
67
74
  , {
68
- "__SInfo": "___SInfo_1t051_gg_",
69
- "__SView": "___SView_1t051_gg_",
70
- "__SWarning": "___SWarning_1t051_gg_",
71
- "__SMessage": "___SMessage_1t051_gg_",
72
- "__SDismiss": "___SDismiss_1t051_gg_",
73
- "__SAction": "___SAction_1t051_gg_",
74
- "__SNoticeBubble": "___SNoticeBubble_1t051_gg_"
75
+ "__SInfo": "___SInfo_1qnlw_gg_",
76
+ "__SView": "___SView_1qnlw_gg_",
77
+ "__SWarning": "___SWarning_1qnlw_gg_",
78
+ "__SMessage": "___SMessage_1qnlw_gg_",
79
+ "__SDismiss": "___SDismiss_1qnlw_gg_",
80
+ "__SAction": "___SAction_1qnlw_gg_",
81
+ "__SNoticeBubble": "___SNoticeBubble_1qnlw_gg_"
75
82
  });
76
83
  var animationNotice = (
77
84
  /*__reshadow_css_start__*/
@@ -271,7 +278,7 @@ var ViewInfo = /*#__PURE__*/function (_Component2) {
271
278
  onMouseEnter = _this$props.onMouseEnter,
272
279
  onMouseLeave = _this$props.onMouseLeave,
273
280
  children = _this$props.children,
274
- other = (0, _objectWithoutProperties2["default"])(_this$props, ["action", "forwardRef", "styles", "onMouseEnter", "onMouseLeave", "children"]);
281
+ other = (0, _objectWithoutProperties2["default"])(_this$props, _excluded);
275
282
  return _ref4 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SInfo, _ref4.cn("SInfo", _objectSpread(_objectSpread({
276
283
  "role": "alert"
277
284
  }, other), {}, {
@@ -282,7 +289,7 @@ var ViewInfo = /*#__PURE__*/function (_Component2) {
282
289
  "title": "Close",
283
290
  "onClick": this.handlerClose,
284
291
  "aria-label": "Close alert"
285
- }), /*#__PURE__*/_react["default"].createElement(_xs["default"], _ref4.cn("CloseXS", {}))), /*#__PURE__*/_react["default"].createElement(SMessage, _ref4.cn("SMessage", {}), children), (0, _isNode["default"])(actionNode) ? /*#__PURE__*/_react["default"].createElement(SAction, _ref4.cn("SAction", {}), actionNode) : null);
292
+ }), /*#__PURE__*/_react["default"].createElement(_m["default"], _ref4.cn("CloseIcon", {}))), /*#__PURE__*/_react["default"].createElement(SMessage, _ref4.cn("SMessage", {}), children), (0, _isNode["default"])(actionNode) ? /*#__PURE__*/_react["default"].createElement(SAction, _ref4.cn("SAction", {}), actionNode) : null);
286
293
  }
287
294
  }]);
288
295
  return ViewInfo;
@@ -311,7 +318,7 @@ var ViewWarning = /*#__PURE__*/function (_ViewInfo) {
311
318
  children = _this$props2.children,
312
319
  styles = _this$props2.styles,
313
320
  forwardRef = _this$props2.forwardRef,
314
- other = (0, _objectWithoutProperties2["default"])(_this$props2, ["action", "children", "styles", "forwardRef"]);
321
+ other = (0, _objectWithoutProperties2["default"])(_this$props2, _excluded2);
315
322
  return _ref5 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SWarning, _ref5.cn("SWarning", _objectSpread({
316
323
  "ref": forwardRef,
317
324
  "role": "alert"
@@ -389,7 +396,7 @@ var NoticeBubbleWarningView = /*#__PURE__*/function (_NoticeBubbleView) {
389
396
  return _super5.apply(this, arguments);
390
397
  }
391
398
 
392
- return NoticeBubbleWarningView;
399
+ return (0, _createClass2["default"])(NoticeBubbleWarningView);
393
400
  }(NoticeBubbleView);
394
401
 
395
402
  (0, _defineProperty2["default"])(NoticeBubbleWarningView, "defaultProps", {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/NoticeBubble.js"],"names":["animationNotice","sstyled","Notices","props","styles","data","tag","SView","ViewInfo","map","notice","uid","visible","undefined","NoticeBubbleContainerRoot","notices","warnings","_unsubscribe","info","filter","type","warning","setState","manager","counter","addListener","handleChange","SNoticeBubble","Box","asProps","Children","disablePortal","state","ViewWarning","Component","style","e","clearTimer","timer","pause","resume","duration","Timer","handlerClose","clear","SInfo","SMessage","SAction","SDismiss","actionNode","action","forwardRef","onMouseEnter","onMouseLeave","children","other","handlerMouseEnter","handlerMouseLeave","SWarning","NoticeBubbleView","_notice","add","remove","update","NoticeBubbleWarningView","NoticeBubbleContainer","Info","Warning","NoticeBubble","NoticeBubbleWarning"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAHA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAMA,eAAe;AAAA;AAAGC,oBAAH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAArB;;AAoBA,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAACC,KAAD,EAAW;AAAA,MACjBC,MADiB,GAC4BD,KAD5B,CACjBC,MADiB;AAAA,oBAC4BD,KAD5B,CACTE,IADS;AAAA,MACTA,IADS,4BACF,EADE;AAAA,mBAC4BF,KAD5B,CACEG,GADF;AAAA,MACOC,KADP,2BACeC,QADf;AAGzB,SAAOH,IAAI,CAACI,GAAL,CAAS,UAACC,MAAD,EAAY;AAAA;;AAC1B,mBAAO,mBAAQN,MAAR,CAAP,eACE,gCAAC,oBAAD;AAAA,aACOM,MAAM,CAACC,GADd;AAAA,iBAE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IAAM0C,qBAAqB,GAAG,sBAAgBnD,yBAAhB,EAA2C;AACvEoD,EAAAA,IAAI,EAAEP,gBADiE;AAEvEQ,EAAAA,OAAO,EAAEH;AAF8D,CAA3C,CAA9B;AAKA,IAAMI,YAAY,GAAGH,qBAAqB,CAACC,IAA3C;;AACA,IAAMG,mBAAmB,GAAGJ,qBAAqB,CAACE,OAAlD;;eAIeF,qB","sourcesContent":["import React from 'react';\nimport Portal from '@semcore/portal';\nimport manager from './NoticeBubbleManager';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Animation } from '@semcore/animation';\nimport { Box } from '@semcore/flex-box';\nimport fire from '@semcore/utils/lib/fire';\nimport isNode from '@semcore/utils/lib/isNode';\nimport { callAllEventHandlers } from '@semcore/utils/lib/assignProps';\nimport CloseXS from '@semcore/icon/lib/Close/xs';\nimport { Timer } from './utils';\n\nimport style from './style/notice-bubble.shadow.css';\n\nconst animationNotice = sstyled.css`\n @keyframes enter {\n from {\n transform: translate(100%, 0);\n }\n to {\n transform: translate(0, 0);\n }\n }\n\n @keyframes exit {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n }\n`;\n\nconst Notices = (props) => {\n const { styles, data = [], tag: SView = ViewInfo } = props;\n\n return data.map((notice) => {\n return sstyled(styles)(\n <Animation\n key={notice.uid}\n visible={notice.visible === undefined ? true : notice.visible}\n duration={250}\n keyframes={[animationNotice['@enter'], animationNotice['@exit']]}\n >\n <SView {...notice} styles={notice.styles || styles} />\n </Animation>,\n );\n });\n};\n\n/**\n * ```js\n * import { NoticeBubble } from \"@semcore/notice-bubble\"\n * ```\n *\n * Container is a portal (React.Portal) in the body, inserted once into any part of the application\n * and subscribes to manager updates(NoticeBubbleManager)\n * */\n\nclass NoticeBubbleContainerRoot extends Component {\n static displayName = 'NoticeBubbleContainer';\n static style = style;\n static defaultProps = {\n manager,\n };\n\n _unsubscribe = null;\n\n state = {\n notices: [],\n warnings: [],\n };\n\n constructor(props) {\n super(props);\n props.manager.counter = 0;\n this._unsubscribe = props.manager.addListener(this.handleChange);\n }\n\n componentWillUnmount = () => {\n if (this._unsubscribe) {\n this._unsubscribe();\n }\n };\n\n handleChange = (notices) => {\n const info = notices.filter((notice) => notice.type === 'info');\n const warning = notices.filter((notice) => notice.type === 'warning');\n\n this.setState({ notices: info, warnings: warning });\n };\n\n render() {\n const SNoticeBubble = Root;\n const { Children, styles, disablePortal } = this.asProps;\n const { notices, warnings } = this.state;\n\n return sstyled(styles)(\n <Portal disablePortal={disablePortal}>\n <SNoticeBubble render={Box}>\n <Children />\n <Notices styles={styles} data={warnings} tag={ViewWarning} />\n <Notices styles={styles} data={notices} tag={ViewInfo} />\n </SNoticeBubble>\n </Portal>,\n );\n }\n}\n/**\n * ```js\n * import { NoticeBubble } from \"@semcore/notice-bubble\"\n * <NoticeBubble.Info/>\n * ```\n *\n * View component, the appearance of the notice\n * */\nclass ViewInfo extends Component {\n timer = null;\n\n componentDidMount() {\n const { duration } = this.props;\n if (duration) {\n this.timer = new Timer(this.handlerClose, duration);\n }\n }\n\n componentWillUnmount() {\n this.clearTimer();\n }\n\n clearTimer() {\n if (this.timer) {\n this.timer.clear();\n this.timer = null;\n }\n }\n\n handlerClose = (e) => {\n // because call not only click\n fire(this, 'onClose', e);\n this.clearTimer();\n };\n\n handlerMouseEnter = () => {\n if (this.timer) {\n this.timer.pause();\n }\n };\n\n handlerMouseLeave = () => {\n if (this.timer) {\n this.timer.resume();\n }\n };\n\n render() {\n const SInfo = Box;\n const SMessage = 'div';\n const SAction = 'div';\n const SDismiss = 'div';\n const {\n action: actionNode,\n forwardRef,\n styles,\n onMouseEnter,\n onMouseLeave,\n children,\n ...other\n } = this.props;\n\n return sstyled(styles)(\n <SInfo\n role=\"alert\"\n {...other}\n ref={forwardRef}\n onMouseEnter={callAllEventHandlers(onMouseEnter, this.handlerMouseEnter)}\n onMouseLeave={callAllEventHandlers(onMouseLeave, this.handlerMouseLeave)}\n >\n <SDismiss title=\"Close\" onClick={this.handlerClose} aria-label=\"Close alert\">\n <CloseXS />\n </SDismiss>\n <SMessage>{children}</SMessage>\n {isNode(actionNode) ? <SAction>{actionNode}</SAction> : null}\n </SInfo>,\n );\n }\n}\n\nclass ViewWarning extends ViewInfo {\n static defaultProps = {\n type: 'warning',\n duration: 0,\n };\n\n render() {\n const SWarning = Box;\n const SMessage = 'div';\n const SAction = 'div';\n const { action: actionNode, children, styles, forwardRef, ...other } = this.props;\n\n return sstyled(styles)(\n <SWarning ref={forwardRef} role=\"alert\" {...other}>\n <SMessage>{children}</SMessage>\n {isNode(actionNode) ? <SAction>{actionNode}</SAction> : null}\n </SWarning>,\n );\n }\n}\n\nclass NoticeBubbleView extends Component {\n static defaultProps = {\n duration: 5000,\n type: 'info',\n manager,\n };\n\n _notice = null;\n\n componentDidMount() {\n this._notice = this.asProps.manager.add(this.asProps);\n }\n\n componentWillUnmount() {\n if (this._notice) {\n this._notice.remove();\n }\n }\n\n componentDidUpdate() {\n if (this._notice) {\n this._notice.update(this.asProps);\n }\n }\n\n render() {\n return null;\n }\n}\n\nclass NoticeBubbleWarningView extends NoticeBubbleView {\n static defaultProps = {\n duration: 5000,\n type: 'warning',\n manager,\n };\n}\n\nconst NoticeBubbleContainer = createComponent(NoticeBubbleContainerRoot, {\n Info: NoticeBubbleView,\n Warning: NoticeBubbleWarningView,\n});\n\nconst NoticeBubble = NoticeBubbleContainer.Info;\nconst NoticeBubbleWarning = NoticeBubbleContainer.Warning;\n\nexport { NoticeBubble, NoticeBubbleWarning };\n\nexport default NoticeBubbleContainer;\n"],"file":"NoticeBubble.js"}
1
+ {"version":3,"sources":["../../src/NoticeBubble.js"],"names":["animationNotice","sstyled","Notices","props","styles","data","tag","SView","ViewInfo","map","notice","uid","visible","undefined","NoticeBubbleContainerRoot","notices","warnings","_unsubscribe","info","filter","type","warning","setState","manager","counter","addListener","handleChange","SNoticeBubble","Box","asProps","Children","disablePortal","state","ViewWarning","Component","style","e","clearTimer","timer","pause","resume","duration","Timer","handlerClose","clear","SInfo","SMessage","SAction","SDismiss","actionNode","action","forwardRef","onMouseEnter","onMouseLeave","children","other","handlerMouseEnter","handlerMouseLeave","SWarning","NoticeBubbleView","_notice","add","remove","update","NoticeBubbleWarningView","NoticeBubbleContainer","Info","Warning","NoticeBubble","NoticeBubbleWarning"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAHA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAMA,eAAe;AAAA;AAAGC,oBAAH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAArB;;AAoBA,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAACC,KAAD,EAAW;AACzB,MAAQC,MAAR,GAAqDD,KAArD,CAAQC,MAAR;AAAA,oBAAqDD,KAArD,CAAgBE,IAAhB;AAAA,MAAgBA,IAAhB,4BAAuB,EAAvB;AAAA,mBAAqDF,KAArD,CAA2BG,GAA3B;AAAA,MAAgCC,KAAhC,2BAAwCC,QAAxC;AAEA,SAAOH,IAAI,CAACI,GAAL,CAAS,UAACC,MAAD,EAAY;AAAA;;AAC1B,mBAAO,mBAAQN,MAAR,CAAP,eACE,gCAAC,oBAAD;AAAA,aACOM,MAAM,CAACC,GADd;AAAA,iBAEWD,MAAM,CAACE,OAAP,KAAmBC,SAAnB,GAA+B,IAA/B,GAAsCH,MAAM,CAACE,OAFxD;AAAA,kBAGY,GAHZ;AAAA,mBAIa,CAACZ,eAAe,CAAC,QAAD,CAAhB,EAA4BA,eAAe,CAAC,OAAD,CAA3C;AAJb,qBAME,gCAAC,KAAD,oDAAWU,MAAX;AAAA,gBAA2BA,MAAM,CAACN,MAAP,IAAiBA;AAA5C,QANF,CADF;AAUD,GAXM,CAAP;AAYD,CAfD;AAiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;IAEMU,yB;;;;;AAcJ,qCA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AUA,UAAV,CAArB,GAAuD,IAF1D,CADF;AAMD;;;EAlBuBzC,Q;;iCAApByB,W,kBACkB;AACpBb,EAAAA,IAAI,EAAE,SADc;AAEpBqB,EAAAA,QAAQ,EAAE;AAFU,C;;IAoBlBkB,gB;;;;;;;;;;;;;;;iGAOM,I;;;;;;WAEV,6BAAoB;AAClB,WAAKC,OAAL,GAAe,KAAK/B,OAAL,CAAaN,OAAb,CAAqBsC,GAArB,CAAyB,KAAKhC,OAA9B,CAAf;AACD;;;WAED,gCAAuB;AACrB,UAAI,KAAK+B,OAAT,EAAkB;AAChB,aAAKA,OAAL,CAAaE,MAAb;AACD;AACF;;;WAED,8BAAqB;AACnB,UAAI,KAAKF,OAAT,EAAkB;AAChB,aAAKA,OAAL,CAAaG,MAAb,CAAoB,KAAKlC,OAAzB;AACD;AACF;;;WAED,kBAAS;AACP,aAAO,IAAP;AACD;;;EA3B4BK,e;;iCAAzByB,gB,kBACkB;AACpBlB,EAAAA,QAAQ,EAAE,IADU;AAEpBrB,EAAAA,IAAI,EAAE,MAFc;AAGpBG,EAAAA,OAAO,EAAPA;AAHoB,C;;IA6BlByC,uB;;;;;;;;;;;EAAgCL,gB;;iCAAhCK,uB,kBACkB;AACpBvB,EAAAA,QAAQ,EAAE,IADU;AAEpBrB,EAAAA,IAAI,EAAE,SAFc;AAGpBG,EAAAA,OAAO,EAAPA;AAHoB,C;AAOxB,IAAM0C,qBAAqB,GAAG,sBAAgBnD,yBAAhB,EAA2C;AACvEoD,EAAAA,IAAI,EAAEP,gBADiE;AAEvEQ,EAAAA,OAAO,EAAEH;AAF8D,CAA3C,CAA9B;AAKA,IAAMI,YAAY,GAAGH,qBAAqB,CAACC,IAA3C;;AACA,IAAMG,mBAAmB,GAAGJ,qBAAqB,CAACE,OAAlD;;eAIeF,qB","sourcesContent":["import React from 'react';\nimport Portal from '@semcore/portal';\nimport manager from './NoticeBubbleManager';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Animation } from '@semcore/animation';\nimport { Box } from '@semcore/flex-box';\nimport fire from '@semcore/utils/lib/fire';\nimport isNode from '@semcore/utils/lib/isNode';\nimport { callAllEventHandlers } from '@semcore/utils/lib/assignProps';\nimport CloseIcon from '@semcore/icon/Close/m';\nimport { Timer } from './utils';\n\nimport style from './style/notice-bubble.shadow.css';\n\nconst animationNotice = sstyled.css`\n @keyframes enter {\n from {\n transform: translate(100%, 0);\n }\n to {\n transform: translate(0, 0);\n }\n }\n\n @keyframes exit {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n }\n`;\n\nconst Notices = (props) => {\n const { styles, data = [], tag: SView = ViewInfo } = props;\n\n return data.map((notice) => {\n return sstyled(styles)(\n <Animation\n key={notice.uid}\n visible={notice.visible === undefined ? true : notice.visible}\n duration={250}\n keyframes={[animationNotice['@enter'], animationNotice['@exit']]}\n >\n <SView {...notice} styles={notice.styles || styles} />\n </Animation>,\n );\n });\n};\n\n/**\n * ```js\n * import { NoticeBubble } from \"@semcore/notice-bubble\"\n * ```\n *\n * Container is a portal (React.Portal) in the body, inserted once into any part of the application\n * and subscribes to manager updates(NoticeBubbleManager)\n * */\n\nclass NoticeBubbleContainerRoot extends Component {\n static displayName = 'NoticeBubbleContainer';\n static style = style;\n static defaultProps = {\n manager,\n };\n\n _unsubscribe = null;\n\n state = {\n notices: [],\n warnings: [],\n };\n\n constructor(props) {\n super(props);\n props.manager.counter = 0;\n this._unsubscribe = props.manager.addListener(this.handleChange);\n }\n\n componentWillUnmount = () => {\n if (this._unsubscribe) {\n this._unsubscribe();\n }\n };\n\n handleChange = (notices) => {\n const info = notices.filter((notice) => notice.type === 'info');\n const warning = notices.filter((notice) => notice.type === 'warning');\n\n this.setState({ notices: info, warnings: warning });\n };\n\n render() {\n const SNoticeBubble = Root;\n const { Children, styles, disablePortal } = this.asProps;\n const { notices, warnings } = this.state;\n\n return sstyled(styles)(\n <Portal disablePortal={disablePortal}>\n <SNoticeBubble render={Box}>\n <Children />\n <Notices styles={styles} data={warnings} tag={ViewWarning} />\n <Notices styles={styles} data={notices} tag={ViewInfo} />\n </SNoticeBubble>\n </Portal>,\n );\n }\n}\n/**\n * ```js\n * import { NoticeBubble } from \"@semcore/notice-bubble\"\n * <NoticeBubble.Info/>\n * ```\n *\n * View component, the appearance of the notice\n * */\nclass ViewInfo extends Component {\n timer = null;\n\n componentDidMount() {\n const { duration } = this.props;\n if (duration) {\n this.timer = new Timer(this.handlerClose, duration);\n }\n }\n\n componentWillUnmount() {\n this.clearTimer();\n }\n\n clearTimer() {\n if (this.timer) {\n this.timer.clear();\n this.timer = null;\n }\n }\n\n handlerClose = (e) => {\n // because call not only click\n fire(this, 'onClose', e);\n this.clearTimer();\n };\n\n handlerMouseEnter = () => {\n if (this.timer) {\n this.timer.pause();\n }\n };\n\n handlerMouseLeave = () => {\n if (this.timer) {\n this.timer.resume();\n }\n };\n\n render() {\n const SInfo = Box;\n const SMessage = 'div';\n const SAction = 'div';\n const SDismiss = 'div';\n const {\n action: actionNode,\n forwardRef,\n styles,\n onMouseEnter,\n onMouseLeave,\n children,\n ...other\n } = this.props;\n\n return sstyled(styles)(\n <SInfo\n role=\"alert\"\n {...other}\n ref={forwardRef}\n onMouseEnter={callAllEventHandlers(onMouseEnter, this.handlerMouseEnter)}\n onMouseLeave={callAllEventHandlers(onMouseLeave, this.handlerMouseLeave)}\n >\n <SDismiss title=\"Close\" onClick={this.handlerClose} aria-label=\"Close alert\">\n <CloseIcon />\n </SDismiss>\n <SMessage>{children}</SMessage>\n {isNode(actionNode) ? <SAction>{actionNode}</SAction> : null}\n </SInfo>,\n );\n }\n}\n\nclass ViewWarning extends ViewInfo {\n static defaultProps = {\n type: 'warning',\n duration: 0,\n };\n\n render() {\n const SWarning = Box;\n const SMessage = 'div';\n const SAction = 'div';\n const { action: actionNode, children, styles, forwardRef, ...other } = this.props;\n\n return sstyled(styles)(\n <SWarning ref={forwardRef} role=\"alert\" {...other}>\n <SMessage>{children}</SMessage>\n {isNode(actionNode) ? <SAction>{actionNode}</SAction> : null}\n </SWarning>,\n );\n }\n}\n\nclass NoticeBubbleView extends Component {\n static defaultProps = {\n duration: 5000,\n type: 'info',\n manager,\n };\n\n _notice = null;\n\n componentDidMount() {\n this._notice = this.asProps.manager.add(this.asProps);\n }\n\n componentWillUnmount() {\n if (this._notice) {\n this._notice.remove();\n }\n }\n\n componentDidUpdate() {\n if (this._notice) {\n this._notice.update(this.asProps);\n }\n }\n\n render() {\n return null;\n }\n}\n\nclass NoticeBubbleWarningView extends NoticeBubbleView {\n static defaultProps = {\n duration: 5000,\n type: 'warning',\n manager,\n };\n}\n\nconst NoticeBubbleContainer = createComponent(NoticeBubbleContainerRoot, {\n Info: NoticeBubbleView,\n Warning: NoticeBubbleWarningView,\n});\n\nconst NoticeBubble = NoticeBubbleContainer.Info;\nconst NoticeBubbleWarning = NoticeBubbleContainer.Warning;\n\nexport { NoticeBubble, NoticeBubbleWarning };\n\nexport default NoticeBubbleContainer;\n"],"file":"NoticeBubble.js"}
@@ -17,9 +17,9 @@ var _eventEmitter = _interopRequireDefault(require("@semcore/utils/lib/eventEmit
17
17
 
18
18
  var _assignProps = require("@semcore/utils/lib/assignProps");
19
19
 
20
- 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; }
20
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
21
21
 
22
- 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; }
22
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
23
23
 
24
24
  var EVENT_NAME = 'CHANGE';
25
25
 
package/lib/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
3
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -43,6 +43,11 @@ Object.keys(_NoticeBubbleManager).forEach(function (key) {
43
43
  }
44
44
  });
45
45
  });
46
+
47
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
48
+
49
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
50
+
46
51
  var _default = _NoticeBubbleManager["default"];
47
52
  exports["default"] = _default;
48
53
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.js"],"names":["NoticeBubbleManager"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;eAEeA,+B","sourcesContent":["import { default as NoticeBubbleContainer } from './NoticeBubble';\nexport * from './NoticeBubble';\n\nimport { default as NoticeBubbleManager } from './NoticeBubbleManager';\n\nexport * from './NoticeBubbleManager';\n\nexport default NoticeBubbleManager;\nexport { NoticeBubbleContainer };\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/index.js"],"names":["NoticeBubbleManager"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;eAEeA,+B","sourcesContent":["import { default as NoticeBubbleContainer } from './NoticeBubble';\nexport * from './NoticeBubble';\n\nimport { default as NoticeBubbleManager } from './NoticeBubbleManager';\n\nexport * from './NoticeBubbleManager';\n\nexport default NoticeBubbleManager;\nexport { NoticeBubbleContainer };\n"],"file":"index.js"}
@@ -8,14 +8,16 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
9
  import { sstyled as _sstyled } from "@semcore/core";
10
10
  import { assignProps as _assignProps } from "@semcore/core";
11
+ var _excluded = ["action", "forwardRef", "styles", "onMouseEnter", "onMouseLeave", "children"],
12
+ _excluded2 = ["action", "children", "styles", "forwardRef"];
11
13
 
12
14
  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); }; }
13
15
 
14
16
  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; } }
15
17
 
16
- 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; }
18
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
17
19
 
18
- 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; }
20
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
19
21
 
20
22
  import React from 'react';
21
23
  import Portal from '@semcore/portal';
@@ -26,7 +28,7 @@ import { Box } from '@semcore/flex-box';
26
28
  import fire from '@semcore/utils/lib/fire';
27
29
  import isNode from '@semcore/utils/lib/isNode';
28
30
  import { callAllEventHandlers } from '@semcore/utils/lib/assignProps';
29
- import CloseXS from '@semcore/icon/lib/Close/xs';
31
+ import CloseIcon from '@semcore/icon/Close/m';
30
32
  import { Timer } from './utils';
31
33
 
32
34
  /*__reshadow-styles__:"./style/notice-bubble.shadow.css"*/
@@ -34,18 +36,18 @@ var style = (
34
36
  /*__reshadow_css_start__*/
35
37
  _sstyled.insert(
36
38
  /*__inner_css_start__*/
37
- ".___SInfo_1t051_gg_,.___SView_1t051_gg_,.___SWarning_1t051_gg_{position:relative;margin-bottom:12px;padding:12px 24px 12px 12px;width:100%;min-height:42px;border-radius:3px;overflow:hidden;box-sizing:border-box}.___SInfo_1t051_gg_{background:#333}.___SWarning_1t051_gg_{background:#ff7f00}.___SMessage_1t051_gg_{font-size:12px;color:#fff;line-height:1.5}.___SDismiss_1t051_gg_{cursor:pointer;position:absolute;right:0;top:0;padding:8px;color:#757575}.___SDismiss_1t051_gg_:hover{color:#ccc}.___SAction_1t051_gg_{margin-top:8px}.___SNoticeBubble_1t051_gg_{width:300px;position:fixed;z-index:1010;right:10px;top:10px}@media (max-width:767px){.___SNoticeBubble_1t051_gg_{width:calc(100% - 20px)}}"
39
+ ".___SInfo_1qnlw_gg_,.___SView_1qnlw_gg_,.___SWarning_1qnlw_gg_{position:relative;margin-bottom:12px;padding:12px 24px 12px 12px;width:100%;min-height:42px;border-radius:3px;overflow:hidden;box-sizing:border-box}.___SInfo_1qnlw_gg_{background:#333333}.___SWarning_1qnlw_gg_{background:#ff7f00}.___SMessage_1qnlw_gg_{font-size:12px;color:#fff;line-height:1.5}.___SDismiss_1qnlw_gg_{cursor:pointer;position:absolute;right:0;top:0;padding:8px;color:#757575}.___SDismiss_1qnlw_gg_:hover{color:#cccccc}.___SAction_1qnlw_gg_{margin-top:8px}.___SNoticeBubble_1qnlw_gg_{width:300px;position:fixed;z-index:1010;right:10px;top:10px}@media (max-width:767px){.___SNoticeBubble_1qnlw_gg_{width:calc(100% - 20px)}}"
38
40
  /*__inner_css_end__*/
39
41
  , "1nxod8h_gg_")
40
42
  /*__reshadow_css_end__*/
41
43
  , {
42
- "__SInfo": "___SInfo_1t051_gg_",
43
- "__SView": "___SView_1t051_gg_",
44
- "__SWarning": "___SWarning_1t051_gg_",
45
- "__SMessage": "___SMessage_1t051_gg_",
46
- "__SDismiss": "___SDismiss_1t051_gg_",
47
- "__SAction": "___SAction_1t051_gg_",
48
- "__SNoticeBubble": "___SNoticeBubble_1t051_gg_"
44
+ "__SInfo": "___SInfo_1qnlw_gg_",
45
+ "__SView": "___SView_1qnlw_gg_",
46
+ "__SWarning": "___SWarning_1qnlw_gg_",
47
+ "__SMessage": "___SMessage_1qnlw_gg_",
48
+ "__SDismiss": "___SDismiss_1qnlw_gg_",
49
+ "__SAction": "___SAction_1qnlw_gg_",
50
+ "__SNoticeBubble": "___SNoticeBubble_1qnlw_gg_"
49
51
  });
50
52
  var animationNotice = (
51
53
  /*__reshadow_css_start__*/
@@ -260,7 +262,7 @@ var ViewInfo = /*#__PURE__*/function (_Component2) {
260
262
  onMouseEnter = _this$props.onMouseEnter,
261
263
  onMouseLeave = _this$props.onMouseLeave,
262
264
  children = _this$props.children,
263
- other = _objectWithoutProperties(_this$props, ["action", "forwardRef", "styles", "onMouseEnter", "onMouseLeave", "children"]);
265
+ other = _objectWithoutProperties(_this$props, _excluded);
264
266
 
265
267
  return _ref4 = sstyled(styles), /*#__PURE__*/React.createElement(SInfo, _ref4.cn("SInfo", _objectSpread(_objectSpread({
266
268
  "role": "alert"
@@ -272,7 +274,7 @@ var ViewInfo = /*#__PURE__*/function (_Component2) {
272
274
  "title": "Close",
273
275
  "onClick": this.handlerClose,
274
276
  "aria-label": "Close alert"
275
- }), /*#__PURE__*/React.createElement(CloseXS, _ref4.cn("CloseXS", {}))), /*#__PURE__*/React.createElement(SMessage, _ref4.cn("SMessage", {}), children), isNode(actionNode) ? /*#__PURE__*/React.createElement(SAction, _ref4.cn("SAction", {}), actionNode) : null);
277
+ }), /*#__PURE__*/React.createElement(CloseIcon, _ref4.cn("CloseIcon", {}))), /*#__PURE__*/React.createElement(SMessage, _ref4.cn("SMessage", {}), children), isNode(actionNode) ? /*#__PURE__*/React.createElement(SAction, _ref4.cn("SAction", {}), actionNode) : null);
276
278
  }
277
279
  }]);
278
280
 
@@ -304,7 +306,7 @@ var ViewWarning = /*#__PURE__*/function (_ViewInfo) {
304
306
  children = _this$props2.children,
305
307
  styles = _this$props2.styles,
306
308
  forwardRef = _this$props2.forwardRef,
307
- other = _objectWithoutProperties(_this$props2, ["action", "children", "styles", "forwardRef"]);
309
+ other = _objectWithoutProperties(_this$props2, _excluded2);
308
310
 
309
311
  return _ref5 = sstyled(styles), /*#__PURE__*/React.createElement(SWarning, _ref5.cn("SWarning", _objectSpread({
310
312
  "ref": forwardRef,
@@ -388,7 +390,7 @@ var NoticeBubbleWarningView = /*#__PURE__*/function (_NoticeBubbleView) {
388
390
  return _super5.apply(this, arguments);
389
391
  }
390
392
 
391
- return NoticeBubbleWarningView;
393
+ return _createClass(NoticeBubbleWarningView);
392
394
  }(NoticeBubbleView);
393
395
 
394
396
  _defineProperty(NoticeBubbleWarningView, "defaultProps", {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/NoticeBubble.js"],"names":["React","Portal","manager","createComponent","Component","sstyled","Root","Animation","Box","fire","isNode","callAllEventHandlers","CloseXS","Timer","animationNotice","Notices","props","styles","data","tag","SView","ViewInfo","map","notice","uid","visible","undefined","NoticeBubbleContainerRoot","notices","warnings","_unsubscribe","info","filter","type","warning","setState","counter","addListener","handleChange","SNoticeBubble","asProps","Children","disablePortal","state","ViewWarning","style","e","clearTimer","timer","pause","resume","duration","handlerClose","clear","SInfo","SMessage","SAction","SDismiss","actionNode","action","forwardRef","onMouseEnter","onMouseLeave","children","other","handlerMouseEnter","handlerMouseLeave","SWarning","NoticeBubbleView","_notice","add","remove","update","NoticeBubbleWarningView","NoticeBubbleContainer","Info","Warning","NoticeBubble","NoticeBubbleWarning"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,OAAOC,OAAP,MAAoB,uBAApB;AACA,OAAOC,eAAP,IAA0BC,SAA1B,EAAqCC,OAArC,EAA8CC,IAA9C,QAA0D,eAA1D;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,GAAT,QAAoB,mBAApB;AACA,OAAOC,IAAP,MAAiB,yBAAjB;AACA,OAAOC,MAAP,MAAmB,2BAAnB;AACA,SAASC,oBAAT,QAAqC,gCAArC;AACA,OAAOC,OAAP,MAAoB,4BAApB;AACA,SAASC,KAAT,QAAsB,SAAtB;;;;;;;;;;;;;;;;;;;;AAIA,IAAMC,eAAe;AAAA;AAAGT,OAAO,OAAV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAArB;;AAoBA,IAAMU,OAAO,GAAG,SAAVA,OAAU,CAACC,KAAD,EAAW;AAAA,MACjBC,MADiB,GAC4BD,KAD5B,CACjBC,MADiB;AAAA,oBAC4BD,KAD5B,CACTE,IADS;AAAA,MACTA,IADS,4BACF,EADE;AAAA,mBAC4BF,KAD5B,CACEG,GADF;AAAA,MACOC,KADP,2BACeC,QADf;AAGzB,SAAOH,IAAI,CAACI,GAAL,CAAS,UAACC,MAAD,EAAY;AAAA;;AAC1B,mBAAOlB,OAAO,CAACY,MA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B,C;;IA6BlBuE,uB;;;;;;;;;;;;EAAgCL,gB;;gBAAhCK,uB,kBACkB;AACpBtB,EAAAA,QAAQ,EAAE,IADU;AAEpBlB,EAAAA,IAAI,EAAE,SAFc;AAGpB/B,EAAAA,OAAO,EAAPA;AAHoB,C;;AAOxB,IAAMwE,qBAAqB,GAAGvE,eAAe,CAACwB,yBAAD,EAA4B;AACvEgD,EAAAA,IAAI,EAAEP,gBADiE;AAEvEQ,EAAAA,OAAO,EAAEH;AAF8D,CAA5B,CAA7C;AAKA,IAAMI,YAAY,GAAGH,qBAAqB,CAACC,IAA3C;AACA,IAAMG,mBAAmB,GAAGJ,qBAAqB,CAACE,OAAlD;AAEA,SAASC,YAAT,EAAuBC,mBAAvB;AAEA,eAAeJ,qBAAf","sourcesContent":["import React from 'react';\nimport Portal from '@semcore/portal';\nimport manager from './NoticeBubbleManager';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Animation } from '@semcore/animation';\nimport { Box } from '@semcore/flex-box';\nimport fire from '@semcore/utils/lib/fire';\nimport isNode from '@semcore/utils/lib/isNode';\nimport { callAllEventHandlers } from '@semcore/utils/lib/assignProps';\nimport CloseXS from '@semcore/icon/lib/Close/xs';\nimport { Timer } from './utils';\n\nimport style from './style/notice-bubble.shadow.css';\n\nconst animationNotice = sstyled.css`\n @keyframes enter {\n from {\n transform: translate(100%, 0);\n }\n to {\n transform: translate(0, 0);\n }\n }\n\n @keyframes exit {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n }\n`;\n\nconst Notices = (props) => {\n const { styles, data = [], tag: SView = ViewInfo } = props;\n\n return data.map((notice) => {\n return sstyled(styles)(\n <Animation\n key={notice.uid}\n visible={notice.visible === undefined ? true : notice.visible}\n duration={250}\n keyframes={[animationNotice['@enter'], animationNotice['@exit']]}\n >\n <SView {...notice} styles={notice.styles || styles} />\n </Animation>,\n );\n });\n};\n\n/**\n * ```js\n * import { NoticeBubble } from \"@semcore/notice-bubble\"\n * ```\n *\n * Container is a portal (React.Portal) in the body, inserted once into any part of the application\n * and subscribes to manager updates(NoticeBubbleManager)\n * */\n\nclass NoticeBubbleContainerRoot extends Component {\n static displayName = 'NoticeBubbleContainer';\n static style = style;\n static defaultProps = {\n manager,\n };\n\n _unsubscribe = null;\n\n state = {\n notices: [],\n warnings: [],\n };\n\n constructor(props) {\n super(props);\n props.manager.counter = 0;\n this._unsubscribe = props.manager.addListener(this.handleChange);\n }\n\n componentWillUnmount = () => {\n if (this._unsubscribe) {\n this._unsubscribe();\n }\n };\n\n handleChange = (notices) => {\n const info = notices.filter((notice) => notice.type === 'info');\n const warning = notices.filter((notice) => notice.type === 'warning');\n\n this.setState({ notices: info, warnings: warning });\n };\n\n render() {\n const SNoticeBubble = Root;\n const { Children, styles, disablePortal } = this.asProps;\n const { notices, warnings } = this.state;\n\n return sstyled(styles)(\n <Portal disablePortal={disablePortal}>\n <SNoticeBubble render={Box}>\n <Children />\n <Notices styles={styles} data={warnings} tag={ViewWarning} />\n <Notices styles={styles} data={notices} tag={ViewInfo} />\n </SNoticeBubble>\n </Portal>,\n );\n }\n}\n/**\n * ```js\n * import { NoticeBubble } from \"@semcore/notice-bubble\"\n * <NoticeBubble.Info/>\n * ```\n *\n * View component, the appearance of the notice\n * */\nclass ViewInfo extends Component {\n timer = null;\n\n componentDidMount() {\n const { duration } = this.props;\n if (duration) {\n this.timer = new Timer(this.handlerClose, duration);\n }\n }\n\n componentWillUnmount() {\n this.clearTimer();\n }\n\n clearTimer() {\n if (this.timer) {\n this.timer.clear();\n this.timer = null;\n }\n }\n\n handlerClose = (e) => {\n // because call not only click\n fire(this, 'onClose', e);\n this.clearTimer();\n };\n\n handlerMouseEnter = () => {\n if (this.timer) {\n this.timer.pause();\n }\n };\n\n handlerMouseLeave = () => {\n if (this.timer) {\n this.timer.resume();\n }\n };\n\n render() {\n const SInfo = Box;\n const SMessage = 'div';\n const SAction = 'div';\n const SDismiss = 'div';\n const {\n action: actionNode,\n forwardRef,\n styles,\n onMouseEnter,\n onMouseLeave,\n children,\n ...other\n } = this.props;\n\n return sstyled(styles)(\n <SInfo\n role=\"alert\"\n {...other}\n ref={forwardRef}\n onMouseEnter={callAllEventHandlers(onMouseEnter, this.handlerMouseEnter)}\n onMouseLeave={callAllEventHandlers(onMouseLeave, this.handlerMouseLeave)}\n >\n <SDismiss title=\"Close\" onClick={this.handlerClose} aria-label=\"Close alert\">\n <CloseXS />\n </SDismiss>\n <SMessage>{children}</SMessage>\n {isNode(actionNode) ? <SAction>{actionNode}</SAction> : null}\n </SInfo>,\n );\n }\n}\n\nclass ViewWarning extends ViewInfo {\n static defaultProps = {\n type: 'warning',\n duration: 0,\n };\n\n render() {\n const SWarning = Box;\n const SMessage = 'div';\n const SAction = 'div';\n const { action: actionNode, children, styles, forwardRef, ...other } = this.props;\n\n return sstyled(styles)(\n <SWarning ref={forwardRef} role=\"alert\" {...other}>\n <SMessage>{children}</SMessage>\n {isNode(actionNode) ? <SAction>{actionNode}</SAction> : null}\n </SWarning>,\n );\n }\n}\n\nclass NoticeBubbleView extends Component {\n static defaultProps = {\n duration: 5000,\n type: 'info',\n manager,\n };\n\n _notice = null;\n\n componentDidMount() {\n this._notice = this.asProps.manager.add(this.asProps);\n }\n\n componentWillUnmount() {\n if (this._notice) {\n this._notice.remove();\n }\n }\n\n componentDidUpdate() {\n if (this._notice) {\n this._notice.update(this.asProps);\n }\n }\n\n render() {\n return null;\n }\n}\n\nclass NoticeBubbleWarningView extends NoticeBubbleView {\n static defaultProps = {\n duration: 5000,\n type: 'warning',\n manager,\n };\n}\n\nconst NoticeBubbleContainer = createComponent(NoticeBubbleContainerRoot, {\n Info: NoticeBubbleView,\n Warning: NoticeBubbleWarningView,\n});\n\nconst NoticeBubble = NoticeBubbleContainer.Info;\nconst NoticeBubbleWarning = NoticeBubbleContainer.Warning;\n\nexport { NoticeBubble, NoticeBubbleWarning };\n\nexport default NoticeBubbleContainer;\n"],"file":"NoticeBubble.js"}
1
+ {"version":3,"sources":["../../src/NoticeBubble.js"],"names":["React","Portal","manager","createComponent","Component","sstyled","Root","Animation","Box","fire","isNode","callAllEventHandlers","CloseIcon","Timer","animationNotice","Notices","props","styles","data","tag","SView","ViewInfo","map","notice","uid","visible","undefined","NoticeBubbleContainerRoot","notices","warnings","_unsubscribe","info","filter","type","warning","setState","counter","addListener","handleChange","SNoticeBubble","asProps","Children","disablePortal","state","ViewWarning","style","e","clearTimer","timer","pause","resume","duration","handlerClose","clear","SInfo","SMessage","SAction","SDismiss","actionNode","action","forwardRef","onMouseEnter","onMouseLeave","children","other","handlerMouseEnter","handlerMouseLeave","SWarning","NoticeBubbleView","_notice","add","remove","update","NoticeBubbleWarningView","NoticeBubbleContainer","Info","Warning","NoticeBubble","NoticeBubbleWarning"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,MAAP,MAAmB,iBAAnB;AACA,OAAOC,OAAP,MAAoB,uBAApB;AACA,OAAOC,eAAP,IAA0BC,SAA1B,EAAqCC,OAArC,EAA8CC,IAA9C,QAA0D,eAA1D;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,GAAT,QAAoB,mBAApB;AACA,OAAOC,IAAP,MAAiB,yBAAjB;AACA,OAAOC,MAAP,MAAmB,2BAAnB;AACA,SAASC,oBAAT,QAAqC,gCAArC;AACA,OAAOC,SAAP,MAAsB,uBAAtB;AACA,SAASC,KAAT,QAAsB,SAAtB;;;;;;;;;;;;;;;;;;;;AAIA,IAAMC,eAAe;AAAA;AAAGT,OAAO,OAAV;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAArB;;AAoBA,IAAMU,OAAO,GAAG,SAAVA,OAAU,CAACC,KAAD,EAAW;AACzB,MAAQC,MAAR,GAAqDD,KAArD,CAAQC,MAAR;AAAA,oBAAqDD,KAArD,CAAgBE,IAAhB;AAAA,MAAgBA,IAAhB,4BAAuB,EAAvB;AAAA,mBAA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;WAED,kBAAS;AACP,aAAO,IAAP;AACD;;;;EA3B4BpC,S;;gBAAzBgE,gB,kBACkB;AACpBjB,EAAAA,QAAQ,EAAE,IADU;AAEpBlB,EAAAA,IAAI,EAAE,MAFc;AAGpB/B,EAAAA,OAAO,EAAPA;AAHoB,C;;IA6BlBuE,uB;;;;;;;;;;;;EAAgCL,gB;;gBAAhCK,uB,kBACkB;AACpBtB,EAAAA,QAAQ,EAAE,IADU;AAEpBlB,EAAAA,IAAI,EAAE,SAFc;AAGpB/B,EAAAA,OAAO,EAAPA;AAHoB,C;;AAOxB,IAAMwE,qBAAqB,GAAGvE,eAAe,CAACwB,yBAAD,EAA4B;AACvEgD,EAAAA,IAAI,EAAEP,gBADiE;AAEvEQ,EAAAA,OAAO,EAAEH;AAF8D,CAA5B,CAA7C;AAKA,IAAMI,YAAY,GAAGH,qBAAqB,CAACC,IAA3C;AACA,IAAMG,mBAAmB,GAAGJ,qBAAqB,CAACE,OAAlD;AAEA,SAASC,YAAT,EAAuBC,mBAAvB;AAEA,eAAeJ,qBAAf","sourcesContent":["import React from 'react';\nimport Portal from '@semcore/portal';\nimport manager from './NoticeBubbleManager';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Animation } from '@semcore/animation';\nimport { Box } from '@semcore/flex-box';\nimport fire from '@semcore/utils/lib/fire';\nimport isNode from '@semcore/utils/lib/isNode';\nimport { callAllEventHandlers } from '@semcore/utils/lib/assignProps';\nimport CloseIcon from '@semcore/icon/Close/m';\nimport { Timer } from './utils';\n\nimport style from './style/notice-bubble.shadow.css';\n\nconst animationNotice = sstyled.css`\n @keyframes enter {\n from {\n transform: translate(100%, 0);\n }\n to {\n transform: translate(0, 0);\n }\n }\n\n @keyframes exit {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n }\n`;\n\nconst Notices = (props) => {\n const { styles, data = [], tag: SView = ViewInfo } = props;\n\n return data.map((notice) => {\n return sstyled(styles)(\n <Animation\n key={notice.uid}\n visible={notice.visible === undefined ? true : notice.visible}\n duration={250}\n keyframes={[animationNotice['@enter'], animationNotice['@exit']]}\n >\n <SView {...notice} styles={notice.styles || styles} />\n </Animation>,\n );\n });\n};\n\n/**\n * ```js\n * import { NoticeBubble } from \"@semcore/notice-bubble\"\n * ```\n *\n * Container is a portal (React.Portal) in the body, inserted once into any part of the application\n * and subscribes to manager updates(NoticeBubbleManager)\n * */\n\nclass NoticeBubbleContainerRoot extends Component {\n static displayName = 'NoticeBubbleContainer';\n static style = style;\n static defaultProps = {\n manager,\n };\n\n _unsubscribe = null;\n\n state = {\n notices: [],\n warnings: [],\n };\n\n constructor(props) {\n super(props);\n props.manager.counter = 0;\n this._unsubscribe = props.manager.addListener(this.handleChange);\n }\n\n componentWillUnmount = () => {\n if (this._unsubscribe) {\n this._unsubscribe();\n }\n };\n\n handleChange = (notices) => {\n const info = notices.filter((notice) => notice.type === 'info');\n const warning = notices.filter((notice) => notice.type === 'warning');\n\n this.setState({ notices: info, warnings: warning });\n };\n\n render() {\n const SNoticeBubble = Root;\n const { Children, styles, disablePortal } = this.asProps;\n const { notices, warnings } = this.state;\n\n return sstyled(styles)(\n <Portal disablePortal={disablePortal}>\n <SNoticeBubble render={Box}>\n <Children />\n <Notices styles={styles} data={warnings} tag={ViewWarning} />\n <Notices styles={styles} data={notices} tag={ViewInfo} />\n </SNoticeBubble>\n </Portal>,\n );\n }\n}\n/**\n * ```js\n * import { NoticeBubble } from \"@semcore/notice-bubble\"\n * <NoticeBubble.Info/>\n * ```\n *\n * View component, the appearance of the notice\n * */\nclass ViewInfo extends Component {\n timer = null;\n\n componentDidMount() {\n const { duration } = this.props;\n if (duration) {\n this.timer = new Timer(this.handlerClose, duration);\n }\n }\n\n componentWillUnmount() {\n this.clearTimer();\n }\n\n clearTimer() {\n if (this.timer) {\n this.timer.clear();\n this.timer = null;\n }\n }\n\n handlerClose = (e) => {\n // because call not only click\n fire(this, 'onClose', e);\n this.clearTimer();\n };\n\n handlerMouseEnter = () => {\n if (this.timer) {\n this.timer.pause();\n }\n };\n\n handlerMouseLeave = () => {\n if (this.timer) {\n this.timer.resume();\n }\n };\n\n render() {\n const SInfo = Box;\n const SMessage = 'div';\n const SAction = 'div';\n const SDismiss = 'div';\n const {\n action: actionNode,\n forwardRef,\n styles,\n onMouseEnter,\n onMouseLeave,\n children,\n ...other\n } = this.props;\n\n return sstyled(styles)(\n <SInfo\n role=\"alert\"\n {...other}\n ref={forwardRef}\n onMouseEnter={callAllEventHandlers(onMouseEnter, this.handlerMouseEnter)}\n onMouseLeave={callAllEventHandlers(onMouseLeave, this.handlerMouseLeave)}\n >\n <SDismiss title=\"Close\" onClick={this.handlerClose} aria-label=\"Close alert\">\n <CloseIcon />\n </SDismiss>\n <SMessage>{children}</SMessage>\n {isNode(actionNode) ? <SAction>{actionNode}</SAction> : null}\n </SInfo>,\n );\n }\n}\n\nclass ViewWarning extends ViewInfo {\n static defaultProps = {\n type: 'warning',\n duration: 0,\n };\n\n render() {\n const SWarning = Box;\n const SMessage = 'div';\n const SAction = 'div';\n const { action: actionNode, children, styles, forwardRef, ...other } = this.props;\n\n return sstyled(styles)(\n <SWarning ref={forwardRef} role=\"alert\" {...other}>\n <SMessage>{children}</SMessage>\n {isNode(actionNode) ? <SAction>{actionNode}</SAction> : null}\n </SWarning>,\n );\n }\n}\n\nclass NoticeBubbleView extends Component {\n static defaultProps = {\n duration: 5000,\n type: 'info',\n manager,\n };\n\n _notice = null;\n\n componentDidMount() {\n this._notice = this.asProps.manager.add(this.asProps);\n }\n\n componentWillUnmount() {\n if (this._notice) {\n this._notice.remove();\n }\n }\n\n componentDidUpdate() {\n if (this._notice) {\n this._notice.update(this.asProps);\n }\n }\n\n render() {\n return null;\n }\n}\n\nclass NoticeBubbleWarningView extends NoticeBubbleView {\n static defaultProps = {\n duration: 5000,\n type: 'warning',\n manager,\n };\n}\n\nconst NoticeBubbleContainer = createComponent(NoticeBubbleContainerRoot, {\n Info: NoticeBubbleView,\n Warning: NoticeBubbleWarningView,\n});\n\nconst NoticeBubble = NoticeBubbleContainer.Info;\nconst NoticeBubbleWarning = NoticeBubbleContainer.Warning;\n\nexport { NoticeBubble, NoticeBubbleWarning };\n\nexport default NoticeBubbleContainer;\n"],"file":"NoticeBubble.js"}
@@ -2,9 +2,9 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
 
5
- 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; }
5
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
6
 
7
- 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; }
7
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
8
 
9
9
  import EventEmitter from '@semcore/utils/lib/eventEmitter';
10
10
  import { callAllEventHandlers } from '@semcore/utils/lib/assignProps';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/notice-bubble",
3
3
  "description": "SEMRush NoticeBubble Component",
4
- "version": "3.2.2",
4
+ "version": "3.3.2",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@semcore/utils": "^3.24",
17
- "@semcore/icon": "^2",
17
+ "@semcore/icon": "^2.16",
18
18
  "@semcore/portal": "^2",
19
19
  "@semcore/flex-box": "^4",
20
20
  "@semcore/animation": "^1"
@@ -24,6 +24,11 @@
24
24
  "react": "16.8 - 17"
25
25
  },
26
26
  "jest": {
27
- "preset": "jest-preset-ui"
27
+ "preset": "@semcore/jest-preset-ui"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/semrush/intergalactic.git",
32
+ "directory": "semcore/notice-bubble"
28
33
  }
29
34
  }
@@ -7,7 +7,7 @@ import { Box } from '@semcore/flex-box';
7
7
  import fire from '@semcore/utils/lib/fire';
8
8
  import isNode from '@semcore/utils/lib/isNode';
9
9
  import { callAllEventHandlers } from '@semcore/utils/lib/assignProps';
10
- import CloseXS from '@semcore/icon/lib/Close/xs';
10
+ import CloseIcon from '@semcore/icon/Close/m';
11
11
  import { Timer } from './utils';
12
12
 
13
13
  import style from './style/notice-bubble.shadow.css';
@@ -178,7 +178,7 @@ class ViewInfo extends Component {
178
178
  onMouseLeave={callAllEventHandlers(onMouseLeave, this.handlerMouseLeave)}
179
179
  >
180
180
  <SDismiss title="Close" onClick={this.handlerClose} aria-label="Close alert">
181
- <CloseXS />
181
+ <CloseIcon />
182
182
  </SDismiss>
183
183
  <SMessage>{children}</SMessage>
184
184
  {isNode(actionNode) ? <SAction>{actionNode}</SAction> : null}