@semcore/notice-bubble 4.7.2 → 4.7.4

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,23 @@
2
2
 
3
3
  CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
+ ## [4.7.4] - 2023-03-23
6
+
7
+ ### Changed
8
+
9
+ - Version patch update due to children dependencies update (`@semcore/utils` [3.47.4 ~> 3.48.0], `@semcore/icon` [3.14.1 ~> 3.14.2], `@semcore/flex-box` [4.7.13 ~> 4.7.14], `@semcore/animation` [1.9.5 ~> 1.9.6]).
10
+
11
+ ## [4.7.3] - 2023-03-22
12
+
13
+ ### Fixed
14
+
15
+ - Default export typings wasn't corresponding to the runtime one.
16
+
17
+ ### Changed
18
+
19
+ - Added `noticeBubbleDefaultManager` export that is equal to the default export.
20
+ - Deprecated default export. `noticeBubbleDefaultManager` is recommended as a drop-in replacement.
21
+
5
22
  ## [4.7.2] - 2023-03-17
6
23
 
7
24
  ### Changed
@@ -60,21 +60,21 @@ var style = (
60
60
  /*__reshadow_css_start__*/
61
61
  _core.sstyled.insert(
62
62
  /*__inner_css_start__*/
63
- "@keyframes enter_1x4uc{0%{transform:translate(100%,0);max-height:0;overflow:hidden}to{transform:translate(0,0);max-height:100vh;overflow:hidden}}@keyframes exit_1x4uc{0%{max-height:100vh;overflow:hidden;opacity:1}to{max-height:0;overflow:hidden;opacity:0}}.___SBubble_1x4uc_gg_,.___SContent_1x4uc_gg_,.___SView_1x4uc_gg_{grid-gap:var(--intergalactic-spacing-2x, 8px);gap:var(--intergalactic-spacing-2x, 8px)}.___SBubble_1x4uc_gg_,.___SView_1x4uc_gg_{position:relative;margin-bottom:var(--intergalactic-spacing-3x, 12px);padding:var(--intergalactic-spacing-3x, 12px) calc(var(--intergalactic-spacing-6x, 24px) + var(--intergalactic-spacing-1x, 4px)) var(--intergalactic-spacing-3x, 12px) var(--intergalactic-spacing-3x, 12px);width:100%;border-radius:var(--intergalactic-popper-rounded, 6px);overflow:hidden;box-sizing:border-box;color:var(--intergalactic-text-primary-invert, #ffffff)}.___SBubble_1x4uc_gg_._type_info_1x4uc_gg_,.___SView_1x4uc_gg_._type_info_1x4uc_gg_{background:var(--intergalactic-bg-primary-invert, #191b23)}.___SBubble_1x4uc_gg_._type_warning_1x4uc_gg_,.___SView_1x4uc_gg_._type_warning_1x4uc_gg_{background:var(--intergalactic-bg-primary-critical, #ff4953)}.___SContent_1x4uc_gg_{flex-direction:column;flex:1}.___SMessage_1x4uc_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-100, 133%)}.___SDismiss_1x4uc_gg_{cursor:pointer;position:absolute;right:0;top:0;padding:var(--intergalactic-spacing-2x, 8px);color:var(--intergalactic-text-primary-invert, #ffffff)}@media (hover:hover){.___SDismiss_1x4uc_gg_:hover{color:var(--intergalactic-control-primary-invert-active, #e0e1e9)}}.___SNoticeBubble_1x4uc_gg_{width:300px;position:fixed;z-index:var(--intergalactic-z-index-notice-bubble, 999);right:var(--intergalactic-spacing-3x, 12px);top:var(--intergalactic-spacing-3x, 12px)}@media (max-width:767px){.___SNoticeBubble_1x4uc_gg_{width:calc(100% - var(--intergalactic-spacing-6x, 24px))}}.___SMessage_1x4uc_gg_ a{color:var(--intergalactic-text-link-invert, #8ecdff)}"
63
+ "@keyframes enter_1fb7y{0%{transform:translate(100%,0);max-height:0;overflow:hidden}to{transform:translate(0,0);max-height:100vh;overflow:hidden}}@keyframes exit_1fb7y{0%{max-height:100vh;overflow:hidden;opacity:1}to{max-height:0;overflow:hidden;opacity:0}}.___SBubble_1fb7y_gg_,.___SContent_1fb7y_gg_,.___SView_1fb7y_gg_{grid-gap:var(--intergalactic-spacing-2x, 8px);gap:var(--intergalactic-spacing-2x, 8px)}.___SBubble_1fb7y_gg_,.___SView_1fb7y_gg_{position:relative;margin-bottom:var(--intergalactic-spacing-3x, 12px);padding:var(--intergalactic-spacing-3x, 12px) calc(var(--intergalactic-spacing-6x, 24px) + var(--intergalactic-spacing-1x, 4px)) var(--intergalactic-spacing-3x, 12px) var(--intergalactic-spacing-3x, 12px);width:100%;border-radius:var(--intergalactic-popper-rounded, 6px);overflow:hidden;box-sizing:border-box;color:var(--intergalactic-text-primary-invert, #ffffff)}.___SBubble_1fb7y_gg_._type_info_1fb7y_gg_,.___SView_1fb7y_gg_._type_info_1fb7y_gg_{background:var(--intergalactic-bg-primary-invert, #191b23)}.___SBubble_1fb7y_gg_._type_warning_1fb7y_gg_,.___SView_1fb7y_gg_._type_warning_1fb7y_gg_{background:var(--intergalactic-bg-primary-critical, #ff4953)}.___SContent_1fb7y_gg_{flex-direction:column;flex:1}.___SMessage_1fb7y_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-100, 133%)}.___SDismiss_1fb7y_gg_{cursor:pointer;position:absolute;right:0;top:0;padding:var(--intergalactic-spacing-2x, 8px);color:var(--intergalactic-text-primary-invert, #ffffff)}@media (hover:hover){.___SDismiss_1fb7y_gg_:hover{color:var(--intergalactic-control-primary-invert-active, #e0e1e9)}}.___SNoticeBubble_1fb7y_gg_{width:300px;position:fixed;z-index:var(--intergalactic-z-index-notice-bubble, 999);right:var(--intergalactic-spacing-3x, 12px);top:var(--intergalactic-spacing-3x, 12px)}@media (max-width:767px){.___SNoticeBubble_1fb7y_gg_{width:calc(100% - var(--intergalactic-spacing-6x, 24px))}}.___SMessage_1fb7y_gg_ a{color:var(--intergalactic-text-link-invert, #8ecdff)}"
64
64
  /*__inner_css_end__*/
65
- , "1x4uc_gg_")
65
+ , "1fb7y_gg_")
66
66
  /*__reshadow_css_end__*/
67
67
  , {
68
- "__SBubble": "___SBubble_1x4uc_gg_",
69
- "__SView": "___SView_1x4uc_gg_",
70
- "_type_info": "_type_info_1x4uc_gg_",
71
- "_type_warning": "_type_warning_1x4uc_gg_",
72
- "__SContent": "___SContent_1x4uc_gg_",
73
- "__SMessage": "___SMessage_1x4uc_gg_",
74
- "__SDismiss": "___SDismiss_1x4uc_gg_",
75
- "__SNoticeBubble": "___SNoticeBubble_1x4uc_gg_",
76
- "@enter": "enter_1x4uc",
77
- "@exit": "exit_1x4uc"
68
+ "__SBubble": "___SBubble_1fb7y_gg_",
69
+ "__SView": "___SView_1fb7y_gg_",
70
+ "_type_info": "_type_info_1fb7y_gg_",
71
+ "_type_warning": "_type_warning_1fb7y_gg_",
72
+ "__SContent": "___SContent_1fb7y_gg_",
73
+ "__SMessage": "___SMessage_1fb7y_gg_",
74
+ "__SDismiss": "___SDismiss_1fb7y_gg_",
75
+ "__SNoticeBubble": "___SNoticeBubble_1fb7y_gg_",
76
+ "@enter": "enter_1fb7y",
77
+ "@exit": "exit_1fb7y"
78
78
  });
79
79
 
80
80
  var Notices = function Notices(props) {
@@ -116,8 +116,7 @@ var NoticeBubbleManager = /*#__PURE__*/function () {
116
116
  }();
117
117
 
118
118
  exports.NoticeBubbleManager = NoticeBubbleManager;
119
-
120
- var _default = new NoticeBubbleManager();
121
-
119
+ var noticeBubbleDefaultManager = new NoticeBubbleManager();
120
+ var _default = noticeBubbleDefaultManager;
122
121
  exports["default"] = _default;
123
122
  //# sourceMappingURL=NoticeBubbleManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NoticeBubbleManager.js","names":["EVENT_NAME","NoticeBubbleManager","emitter","EventEmitter","fn","subscribe","props","manager","type","onClose","callAllEventHandlers","remove","uid","emit","items","counter","item","createItem","visible","initialAnimation","undefined","push","update","bind","index","findIndex","setTimeout","splice"],"sources":["../../src/NoticeBubbleManager.js"],"sourcesContent":["import EventEmitter from '@semcore/utils/lib/eventEmitter';\nimport { callAllEventHandlers } from '@semcore/utils/lib/assignProps';\n\nconst EVENT_NAME = 'CHANGE';\n\nclass NoticeBubbleManager {\n items = [];\n emitter = null;\n counter = 0;\n\n constructor() {\n this.emitter = new EventEmitter();\n }\n\n addListener(fn) {\n return this.emitter.subscribe(EVENT_NAME, fn);\n }\n\n createItem(props) {\n const manager = this;\n\n return {\n type: 'info',\n ...props,\n onClose: callAllEventHandlers(props.onClose, () => {\n manager.remove(props.uid);\n }),\n };\n }\n\n emit() {\n this.emitter.emit(EVENT_NAME, this.items);\n }\n\n add(props) {\n const uid = this.counter++;\n const item = this.createItem({\n uid,\n visible: props.initialAnimation ? true : undefined,\n ...props,\n });\n this.items.push(item);\n this.emit();\n return {\n uid,\n update: this.update.bind(this, uid),\n remove: this.remove.bind(this, uid),\n };\n }\n\n update(uid, props) {\n const index = this.items.findIndex((item) => item.uid === uid);\n if (index !== -1) {\n this.items[index] = this.createItem({\n ...this.items[index],\n ...props,\n });\n this.emit();\n return true;\n }\n return false;\n }\n\n remove(uid) {\n const index = this.items.findIndex((item) => item.uid === uid);\n if (index !== -1) {\n this.items[index].visible = false;\n setTimeout(() => {\n const index = this.items.findIndex((item) => item.uid === uid);\n if (index !== -1) {\n this.items.splice(index, 1);\n this.emit();\n }\n }, 1000);\n this.emit();\n return true;\n }\n return false;\n }\n}\n\nexport { NoticeBubbleManager };\nexport default new NoticeBubbleManager();\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,UAAU,GAAG,QAAnB;;IAEMC,mB;EAKJ,+BAAc;IAAA;IAAA,gDAJN,EAIM;IAAA,kDAHJ,IAGI;IAAA,kDAFJ,CAEI;IACZ,KAAKC,OAAL,GAAe,IAAIC,wBAAJ,EAAf;EACD;;;;WAED,qBAAYC,EAAZ,EAAgB;MACd,OAAO,KAAKF,OAAL,CAAaG,SAAb,CAAuBL,UAAvB,EAAmCI,EAAnC,CAAP;IACD;;;WAED,oBAAWE,KAAX,EAAkB;MAChB,IAAMC,OAAO,GAAG,IAAhB;MAEA;QACEC,IAAI,EAAE;MADR,GAEKF,KAFL;QAGEG,OAAO,EAAE,IAAAC,iCAAA,EAAqBJ,KAAK,CAACG,OAA3B,EAAoC,YAAM;UACjDF,OAAO,CAACI,MAAR,CAA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AAC,CAAf,EAAkB;QAChB,KAAKV,KAAL,CAAWU,KAAX,EAAkBN,OAAlB,GAA4B,KAA5B;QACAQ,UAAU,CAAC,YAAM;UACf,IAAMF,KAAK,GAAG,KAAI,CAACV,KAAL,CAAWW,SAAX,CAAqB,UAACT,IAAD;YAAA,OAAUA,IAAI,CAACJ,GAAL,KAAaA,GAAvB;UAAA,CAArB,CAAd;;UACA,IAAIY,KAAK,KAAK,CAAC,CAAf,EAAkB;YAChB,KAAI,CAACV,KAAL,CAAWa,MAAX,CAAkBH,KAAlB,EAAyB,CAAzB;;YACA,KAAI,CAACX,IAAL;UACD;QACF,CANS,EAMP,IANO,CAAV;QAOA,KAAKA,IAAL;QACA,OAAO,IAAP;MACD;;MACD,OAAO,KAAP;IACD;;;;;;;eAIY,IAAIZ,mBAAJ,E"}
1
+ {"version":3,"file":"NoticeBubbleManager.js","names":["EVENT_NAME","NoticeBubbleManager","emitter","EventEmitter","fn","subscribe","props","manager","type","onClose","callAllEventHandlers","remove","uid","emit","items","counter","item","createItem","visible","initialAnimation","undefined","push","update","bind","index","findIndex","setTimeout","splice","noticeBubbleDefaultManager"],"sources":["../../src/NoticeBubbleManager.js"],"sourcesContent":["import EventEmitter from '@semcore/utils/lib/eventEmitter';\nimport { callAllEventHandlers } from '@semcore/utils/lib/assignProps';\n\nconst EVENT_NAME = 'CHANGE';\n\nclass NoticeBubbleManager {\n items = [];\n emitter = null;\n counter = 0;\n\n constructor() {\n this.emitter = new EventEmitter();\n }\n\n addListener(fn) {\n return this.emitter.subscribe(EVENT_NAME, fn);\n }\n\n createItem(props) {\n const manager = this;\n\n return {\n type: 'info',\n ...props,\n onClose: callAllEventHandlers(props.onClose, () => {\n manager.remove(props.uid);\n }),\n };\n }\n\n emit() {\n this.emitter.emit(EVENT_NAME, this.items);\n }\n\n add(props) {\n const uid = this.counter++;\n const item = this.createItem({\n uid,\n visible: props.initialAnimation ? true : undefined,\n ...props,\n });\n this.items.push(item);\n this.emit();\n return {\n uid,\n update: this.update.bind(this, uid),\n remove: this.remove.bind(this, uid),\n };\n }\n\n update(uid, props) {\n const index = this.items.findIndex((item) => item.uid === uid);\n if (index !== -1) {\n this.items[index] = this.createItem({\n ...this.items[index],\n ...props,\n });\n this.emit();\n return true;\n }\n return false;\n }\n\n remove(uid) {\n const index = this.items.findIndex((item) => item.uid === uid);\n if (index !== -1) {\n this.items[index].visible = false;\n setTimeout(() => {\n const index = this.items.findIndex((item) => item.uid === uid);\n if (index !== -1) {\n this.items.splice(index, 1);\n this.emit();\n }\n }, 1000);\n this.emit();\n return true;\n }\n return false;\n }\n}\n\nconst noticeBubbleDefaultManager = new NoticeBubbleManager();\n\nexport { NoticeBubbleManager };\nexport default noticeBubbleDefaultManager;\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,UAAU,GAAG,QAAnB;;IAEMC,mB;EAKJ,+BAAc;IAAA;IAAA,gDAJN,EAIM;IAAA,kDAHJ,IAGI;IAAA,kDAFJ,CAEI;IACZ,KAAKC,OAAL,GAAe,IAAIC,wBAAJ,EAAf;EACD;;;;WAED,qBAAYC,EAAZ,EAAgB;MACd,OAAO,KAAKF,OAAL,CAAaG,SAAb,CAAuBL,UAAvB,EAAmCI,EAAnC,CAAP;IACD;;;WAED,oBAAWE,KAAX,EAAkB;MAChB,IAAMC,OAAO,GAAG,IAAhB;MAEA;QACEC,IAAI,EAAE;MADR,GAEKF,KAFL;QAGEG,OAAO,EAAE,IAAAC,iCAAA,EAAqBJ,KAAK,CAACG,OAA3B,EAAoC,YAAM;UACjDF,OAAO,CAACI,MAAR,CAAeL,KAAK,CAACM,GAArB;QACD,CAFQ;MAHX;IAOD;;;WAED,gBAAO;MACL,KAAKV,OAAL,CAAaW,IAAb,CAAkBb,UAAlB,EAA8B,KAAKc,KAAnC;IACD;;;WAED,aAAIR,KAAJ,EAAW;MACT,IAAMM,GAAG,GAAG,KAAKG,OAAL,EAAZ;MACA,IAAMC,IAAI,GAAG,KAAK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AArB,CAAd;;UACA,IAAIY,KAAK,KAAK,CAAC,CAAf,EAAkB;YAChB,KAAI,CAACV,KAAL,CAAWa,MAAX,CAAkBH,KAAlB,EAAyB,CAAzB;;YACA,KAAI,CAACX,IAAL;UACD;QACF,CANS,EAMP,IANO,CAAV;QAOA,KAAKA,IAAL;QACA,OAAO,IAAP;MACD;;MACD,OAAO,KAAP;IACD;;;;;;AAGH,IAAMe,0BAA0B,GAAG,IAAI3B,mBAAJ,EAAnC;eAGe2B,0B"}
@@ -2,6 +2,11 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.noticeBubbleDefaultManager = exports["default"] = void 0;
9
+
5
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
6
11
 
7
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
@@ -16,4 +21,13 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
16
21
  var NoticeBubbleManager = /*#__PURE__*/(0, _createClass2["default"])(function NoticeBubbleManager() {
17
22
  (0, _classCallCheck2["default"])(this, NoticeBubbleManager);
18
23
  });
24
+ var noticeBubbleDefaultManager = new NoticeBubbleManager();
25
+ exports.noticeBubbleDefaultManager = noticeBubbleDefaultManager;
26
+
27
+ /**
28
+ * @deprecated Use `import { noticeBubbleDefaultManager } from ...` instead
29
+ */
30
+ var _default = new NoticeBubbleManager();
31
+
32
+ exports["default"] = _default;
19
33
  //# sourceMappingURL=index.d.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.js","names":["NoticeBubbleManager"],"sources":["../../src/index.d.ts"],"sourcesContent":["import { IPortalProps } from '@semcore/portal';\nimport { CProps, ReturnEl } from '@semcore/core';\nimport { IBoxProps } from '@semcore/flex-box';\n\nexport interface INoticeBubbleContainerProps extends IBoxProps, IPortalProps {\n /** Manager copy */\n manager?: INoticeBubbleManager;\n locale?: string;\n}\n\nexport interface INoticeBubbleProps extends IBoxProps {\n /**\n * Notice visibility.\n */\n visible?: boolean;\n /**\n * Control under the notice children.\n * */\n action?: React.ReactNode;\n /**\n * Callback triggered by \"Close\" icon click.\n * */\n onClose?: (e?: React.SyntheticEvent) => void;\n /**\n * Notice content.\n * */\n children: React.ReactNode;\n}\nexport interface INoticeBubbleInfoProps extends INoticeBubbleProps {\n readonly type?: 'info';\n /**\n * Notice display duration.\n */\n duration?: number;\n /**\n * Enables animation on first rendering.\n * @default false\n */\n initialAnimation?: boolean;\n}\n\nexport interface INoticeBubbleWarningProps extends INoticeBubbleProps {\n readonly type?: 'warning';\n /**\n * Notice display duration.\n */\n duration?: number;\n /**\n * Enables animation on first rendering.\n * @default false\n */\n initialAnimation?: boolean;\n}\n\nexport interface INoticeBubbleManager {\n /**\n * Creates and shows a notice.\n * */\n add: (props: INoticeBubbleInfoProps | INoticeBubbleWarningProps) => {\n uid: string;\n update: (\n props: Partial<INoticeBubbleInfoProps> | Partial<INoticeBubbleWarningProps>,\n ) => boolean;\n remove: () => boolean;\n };\n /**\n * Updates notice by uid.\n * */\n update: (\n uid: string,\n props: Partial<INoticeBubbleInfoProps> | Partial<INoticeBubbleWarningProps>,\n ) => boolean;\n /**\n * Removes notice by uid.\n * */\n remove: (uid: string) => boolean;\n}\n\n/**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\ndeclare const NoticeBubble: <T>(props: INoticeBubbleInfoProps & T) => ReturnEl;\n/**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\ndeclare const NoticeBubbleWarning: <T>(props: INoticeBubbleWarningProps & T) => ReturnEl;\ndeclare const NoticeBubbleContainer: (<T>(\n props: CProps<INoticeBubbleContainerProps & T>,\n) => ReturnEl) & {\n /**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\n Info: typeof NoticeBubble;\n\n /**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\n Warning: typeof NoticeBubbleWarning;\n};\ndeclare class NoticeBubbleManager implements INoticeBubbleManager {\n /**\n * Creates and shows a notice.\n * */\n add(props: INoticeBubbleInfoProps | INoticeBubbleWarningProps): {\n uid: string;\n update: (\n props: Partial<INoticeBubbleInfoProps> | Partial<INoticeBubbleWarningProps>,\n ) => boolean;\n remove: () => boolean;\n };\n /**\n * Updates notice by uid.\n * */\n update(\n uid: string,\n props: Partial<INoticeBubbleInfoProps> | Partial<INoticeBubbleWarningProps>,\n ): boolean;\n /**\n * Removes notice by uid.\n * */\n remove(uid: string): boolean;\n}\n\nexport { NoticeBubbleContainer, NoticeBubble, NoticeBubbleWarning, NoticeBubbleManager };\nexport default NoticeBubbleManager;\n"],"mappings":";;;;;;;;AA8EA;AACA;AACA;;AAEA;AACA;AACA;IAecA,mB"}
1
+ {"version":3,"file":"index.d.js","names":["NoticeBubbleManager","noticeBubbleDefaultManager"],"sources":["../../src/index.d.ts"],"sourcesContent":["import { IPortalProps } from '@semcore/portal';\nimport { CProps, ReturnEl } from '@semcore/core';\nimport { IBoxProps } from '@semcore/flex-box';\n\nexport interface INoticeBubbleContainerProps extends IBoxProps, IPortalProps {\n /** Manager copy */\n manager?: INoticeBubbleManager;\n locale?: string;\n}\n\nexport interface INoticeBubbleProps extends IBoxProps {\n /**\n * Notice visibility.\n */\n visible?: boolean;\n /**\n * Control under the notice children.\n * */\n action?: React.ReactNode;\n /**\n * Callback triggered by \"Close\" icon click.\n * */\n onClose?: (e?: React.SyntheticEvent) => void;\n /**\n * Notice content.\n * */\n children: React.ReactNode;\n}\nexport interface INoticeBubbleInfoProps extends INoticeBubbleProps {\n readonly type?: 'info';\n /**\n * Notice display duration.\n */\n duration?: number;\n /**\n * Enables animation on first rendering.\n * @default false\n */\n initialAnimation?: boolean;\n}\n\nexport interface INoticeBubbleWarningProps extends INoticeBubbleProps {\n readonly type?: 'warning';\n /**\n * Notice display duration.\n */\n duration?: number;\n /**\n * Enables animation on first rendering.\n * @default false\n */\n initialAnimation?: boolean;\n}\n\nexport interface INoticeBubbleManager {\n /**\n * Creates and shows a notice.\n * */\n add: (props: INoticeBubbleInfoProps | INoticeBubbleWarningProps) => {\n uid: string;\n update: (\n props: Partial<INoticeBubbleInfoProps> | Partial<INoticeBubbleWarningProps>,\n ) => boolean;\n remove: () => boolean;\n };\n /**\n * Updates notice by uid.\n * */\n update: (\n uid: string,\n props: Partial<INoticeBubbleInfoProps> | Partial<INoticeBubbleWarningProps>,\n ) => boolean;\n /**\n * Removes notice by uid.\n * */\n remove: (uid: string) => boolean;\n}\n\n/**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\ndeclare const NoticeBubble: <T>(props: INoticeBubbleInfoProps & T) => ReturnEl;\n/**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\ndeclare const NoticeBubbleWarning: <T>(props: INoticeBubbleWarningProps & T) => ReturnEl;\ndeclare const NoticeBubbleContainer: (<T>(\n props: CProps<INoticeBubbleContainerProps & T>,\n) => ReturnEl) & {\n /**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\n Info: typeof NoticeBubble;\n\n /**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\n Warning: typeof NoticeBubbleWarning;\n};\ndeclare class NoticeBubbleManager implements INoticeBubbleManager {\n /**\n * Creates and shows a notice.\n * */\n add(props: INoticeBubbleInfoProps | INoticeBubbleWarningProps): {\n uid: string;\n update: (\n props: Partial<INoticeBubbleInfoProps> | Partial<INoticeBubbleWarningProps>,\n ) => boolean;\n remove: () => boolean;\n };\n /**\n * Updates notice by uid.\n * */\n update(\n uid: string,\n props: Partial<INoticeBubbleInfoProps> | Partial<INoticeBubbleWarningProps>,\n ): boolean;\n /**\n * Removes notice by uid.\n * */\n remove(uid: string): boolean;\n}\n\nconst noticeBubbleDefaultManager = new NoticeBubbleManager();\n\nexport {\n NoticeBubbleContainer,\n NoticeBubble,\n NoticeBubbleWarning,\n NoticeBubbleManager,\n noticeBubbleDefaultManager,\n};\n/**\n * @deprecated Use `import { noticeBubbleDefaultManager } from ...` instead\n */\nexport default new NoticeBubbleManager();\n"],"mappings":";;;;;;;;;;;;;AA8EA;AACA;AACA;;AAEA;AACA;AACA;IAecA,mB;;;AAwBd,IAAMC,0BAA0B,GAAG,IAAID,mBAAJ,EAAnC;;;AASA;AACA;AACA;eACe,IAAIA,mBAAJ,E"}
package/lib/cjs/index.js CHANGED
@@ -6,7 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  var _exportNames = {
9
- NoticeBubbleContainer: true
9
+ NoticeBubbleContainer: true,
10
+ noticeBubbleDefaultManager: true
10
11
  };
11
12
  Object.defineProperty(exports, "NoticeBubbleContainer", {
12
13
  enumerable: true,
@@ -15,6 +16,12 @@ Object.defineProperty(exports, "NoticeBubbleContainer", {
15
16
  }
16
17
  });
17
18
  exports["default"] = void 0;
19
+ Object.defineProperty(exports, "noticeBubbleDefaultManager", {
20
+ enumerable: true,
21
+ get: function get() {
22
+ return _NoticeBubbleManager["default"];
23
+ }
24
+ });
18
25
 
19
26
  var _NoticeBubble = _interopRequireWildcard(require("./NoticeBubble"));
20
27
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["NoticeBubbleManager"],"sources":["../../src/index.js"],"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"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAEA;;AAEA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;eAEeA,+B"}
1
+ {"version":3,"file":"index.js","names":["noticeBubbleDefaultManager"],"sources":["../../src/index.js"],"sourcesContent":["import { default as NoticeBubbleContainer } from './NoticeBubble';\nexport * from './NoticeBubble';\n\nimport { default as noticeBubbleDefaultManager } from './NoticeBubbleManager';\n\nexport * from './NoticeBubbleManager';\n\nexport default noticeBubbleDefaultManager;\nexport { NoticeBubbleContainer, noticeBubbleDefaultManager };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAEA;;AAEA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;eAEeA,+B"}
@@ -29,21 +29,21 @@ var style = (
29
29
  /*__reshadow_css_start__*/
30
30
  _sstyled.insert(
31
31
  /*__inner_css_start__*/
32
- "@keyframes enter_1x4uc{0%{transform:translate(100%,0);max-height:0;overflow:hidden}to{transform:translate(0,0);max-height:100vh;overflow:hidden}}@keyframes exit_1x4uc{0%{max-height:100vh;overflow:hidden;opacity:1}to{max-height:0;overflow:hidden;opacity:0}}.___SBubble_1x4uc_gg_,.___SContent_1x4uc_gg_,.___SView_1x4uc_gg_{grid-gap:var(--intergalactic-spacing-2x, 8px);gap:var(--intergalactic-spacing-2x, 8px)}.___SBubble_1x4uc_gg_,.___SView_1x4uc_gg_{position:relative;margin-bottom:var(--intergalactic-spacing-3x, 12px);padding:var(--intergalactic-spacing-3x, 12px) calc(var(--intergalactic-spacing-6x, 24px) + var(--intergalactic-spacing-1x, 4px)) var(--intergalactic-spacing-3x, 12px) var(--intergalactic-spacing-3x, 12px);width:100%;border-radius:var(--intergalactic-popper-rounded, 6px);overflow:hidden;box-sizing:border-box;color:var(--intergalactic-text-primary-invert, #ffffff)}.___SBubble_1x4uc_gg_._type_info_1x4uc_gg_,.___SView_1x4uc_gg_._type_info_1x4uc_gg_{background:var(--intergalactic-bg-primary-invert, #191b23)}.___SBubble_1x4uc_gg_._type_warning_1x4uc_gg_,.___SView_1x4uc_gg_._type_warning_1x4uc_gg_{background:var(--intergalactic-bg-primary-critical, #ff4953)}.___SContent_1x4uc_gg_{flex-direction:column;flex:1}.___SMessage_1x4uc_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-100, 133%)}.___SDismiss_1x4uc_gg_{cursor:pointer;position:absolute;right:0;top:0;padding:var(--intergalactic-spacing-2x, 8px);color:var(--intergalactic-text-primary-invert, #ffffff)}@media (hover:hover){.___SDismiss_1x4uc_gg_:hover{color:var(--intergalactic-control-primary-invert-active, #e0e1e9)}}.___SNoticeBubble_1x4uc_gg_{width:300px;position:fixed;z-index:var(--intergalactic-z-index-notice-bubble, 999);right:var(--intergalactic-spacing-3x, 12px);top:var(--intergalactic-spacing-3x, 12px)}@media (max-width:767px){.___SNoticeBubble_1x4uc_gg_{width:calc(100% - var(--intergalactic-spacing-6x, 24px))}}.___SMessage_1x4uc_gg_ a{color:var(--intergalactic-text-link-invert, #8ecdff)}"
32
+ "@keyframes enter_1fb7y{0%{transform:translate(100%,0);max-height:0;overflow:hidden}to{transform:translate(0,0);max-height:100vh;overflow:hidden}}@keyframes exit_1fb7y{0%{max-height:100vh;overflow:hidden;opacity:1}to{max-height:0;overflow:hidden;opacity:0}}.___SBubble_1fb7y_gg_,.___SContent_1fb7y_gg_,.___SView_1fb7y_gg_{grid-gap:var(--intergalactic-spacing-2x, 8px);gap:var(--intergalactic-spacing-2x, 8px)}.___SBubble_1fb7y_gg_,.___SView_1fb7y_gg_{position:relative;margin-bottom:var(--intergalactic-spacing-3x, 12px);padding:var(--intergalactic-spacing-3x, 12px) calc(var(--intergalactic-spacing-6x, 24px) + var(--intergalactic-spacing-1x, 4px)) var(--intergalactic-spacing-3x, 12px) var(--intergalactic-spacing-3x, 12px);width:100%;border-radius:var(--intergalactic-popper-rounded, 6px);overflow:hidden;box-sizing:border-box;color:var(--intergalactic-text-primary-invert, #ffffff)}.___SBubble_1fb7y_gg_._type_info_1fb7y_gg_,.___SView_1fb7y_gg_._type_info_1fb7y_gg_{background:var(--intergalactic-bg-primary-invert, #191b23)}.___SBubble_1fb7y_gg_._type_warning_1fb7y_gg_,.___SView_1fb7y_gg_._type_warning_1fb7y_gg_{background:var(--intergalactic-bg-primary-critical, #ff4953)}.___SContent_1fb7y_gg_{flex-direction:column;flex:1}.___SMessage_1fb7y_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-100, 133%)}.___SDismiss_1fb7y_gg_{cursor:pointer;position:absolute;right:0;top:0;padding:var(--intergalactic-spacing-2x, 8px);color:var(--intergalactic-text-primary-invert, #ffffff)}@media (hover:hover){.___SDismiss_1fb7y_gg_:hover{color:var(--intergalactic-control-primary-invert-active, #e0e1e9)}}.___SNoticeBubble_1fb7y_gg_{width:300px;position:fixed;z-index:var(--intergalactic-z-index-notice-bubble, 999);right:var(--intergalactic-spacing-3x, 12px);top:var(--intergalactic-spacing-3x, 12px)}@media (max-width:767px){.___SNoticeBubble_1fb7y_gg_{width:calc(100% - var(--intergalactic-spacing-6x, 24px))}}.___SMessage_1fb7y_gg_ a{color:var(--intergalactic-text-link-invert, #8ecdff)}"
33
33
  /*__inner_css_end__*/
34
- , "1x4uc_gg_")
34
+ , "1fb7y_gg_")
35
35
  /*__reshadow_css_end__*/
36
36
  , {
37
- "__SBubble": "___SBubble_1x4uc_gg_",
38
- "__SView": "___SView_1x4uc_gg_",
39
- "_type_info": "_type_info_1x4uc_gg_",
40
- "_type_warning": "_type_warning_1x4uc_gg_",
41
- "__SContent": "___SContent_1x4uc_gg_",
42
- "__SMessage": "___SMessage_1x4uc_gg_",
43
- "__SDismiss": "___SDismiss_1x4uc_gg_",
44
- "__SNoticeBubble": "___SNoticeBubble_1x4uc_gg_",
45
- "@enter": "enter_1x4uc",
46
- "@exit": "exit_1x4uc"
37
+ "__SBubble": "___SBubble_1fb7y_gg_",
38
+ "__SView": "___SView_1fb7y_gg_",
39
+ "_type_info": "_type_info_1fb7y_gg_",
40
+ "_type_warning": "_type_warning_1fb7y_gg_",
41
+ "__SContent": "___SContent_1fb7y_gg_",
42
+ "__SMessage": "___SMessage_1fb7y_gg_",
43
+ "__SDismiss": "___SDismiss_1fb7y_gg_",
44
+ "__SNoticeBubble": "___SNoticeBubble_1fb7y_gg_",
45
+ "@enter": "enter_1fb7y",
46
+ "@exit": "exit_1fb7y"
47
47
  });
48
48
 
49
49
  var Notices = function Notices(props) {
@@ -105,6 +105,7 @@ var NoticeBubbleManager = /*#__PURE__*/function () {
105
105
  return NoticeBubbleManager;
106
106
  }();
107
107
 
108
+ var noticeBubbleDefaultManager = new NoticeBubbleManager();
108
109
  export { NoticeBubbleManager };
109
- export default new NoticeBubbleManager();
110
+ export default noticeBubbleDefaultManager;
110
111
  //# sourceMappingURL=NoticeBubbleManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NoticeBubbleManager.js","names":["EventEmitter","callAllEventHandlers","EVENT_NAME","NoticeBubbleManager","emitter","fn","subscribe","props","manager","type","onClose","remove","uid","emit","items","counter","item","createItem","visible","initialAnimation","undefined","push","update","bind","index","findIndex","setTimeout","splice"],"sources":["../../src/NoticeBubbleManager.js"],"sourcesContent":["import EventEmitter from '@semcore/utils/lib/eventEmitter';\nimport { callAllEventHandlers } from '@semcore/utils/lib/assignProps';\n\nconst EVENT_NAME = 'CHANGE';\n\nclass NoticeBubbleManager {\n items = [];\n emitter = null;\n counter = 0;\n\n constructor() {\n this.emitter = new EventEmitter();\n }\n\n addListener(fn) {\n return this.emitter.subscribe(EVENT_NAME, fn);\n }\n\n createItem(props) {\n const manager = this;\n\n return {\n type: 'info',\n ...props,\n onClose: callAllEventHandlers(props.onClose, () => {\n manager.remove(props.uid);\n }),\n };\n }\n\n emit() {\n this.emitter.emit(EVENT_NAME, this.items);\n }\n\n add(props) {\n const uid = this.counter++;\n const item = this.createItem({\n uid,\n visible: props.initialAnimation ? true : undefined,\n ...props,\n });\n this.items.push(item);\n this.emit();\n return {\n uid,\n update: this.update.bind(this, uid),\n remove: this.remove.bind(this, uid),\n };\n }\n\n update(uid, props) {\n const index = this.items.findIndex((item) => item.uid === uid);\n if (index !== -1) {\n this.items[index] = this.createItem({\n ...this.items[index],\n ...props,\n });\n this.emit();\n return true;\n }\n return false;\n }\n\n remove(uid) {\n const index = this.items.findIndex((item) => item.uid === uid);\n if (index !== -1) {\n this.items[index].visible = false;\n setTimeout(() => {\n const index = this.items.findIndex((item) => item.uid === uid);\n if (index !== -1) {\n this.items.splice(index, 1);\n this.emit();\n }\n }, 1000);\n this.emit();\n return true;\n }\n return false;\n }\n}\n\nexport { NoticeBubbleManager };\nexport default new NoticeBubbleManager();\n"],"mappings":";;;;AAAA,OAAOA,YAAP,MAAyB,iCAAzB;AACA,SAASC,oBAAT,QAAqC,gCAArC;AAEA,IAAMC,UAAU,GAAG,QAAnB;;IAEMC,mB;EAKJ,+BAAc;IAAA;;IAAA,+BAJN,EAIM;;IAAA,iCAHJ,IAGI;;IAAA,iCAFJ,CAEI;;IACZ,KAAKC,OAAL,GAAe,IAAIJ,YAAJ,EAAf;EACD;;;;WAED,qBAAYK,EAAZ,EAAgB;MACd,OAAO,KAAKD,OAAL,CAAaE,SAAb,CAAuBJ,UAAvB,EAAmCG,EAAnC,CAAP;IACD;;;WAED,oBAAWE,KAAX,EAAkB;MAChB,IAAMC,OAAO,GAAG,IAAhB;MAEA;QACEC,IAAI,EAAE;MADR,GAEKF,KAFL;QAGEG,OAAO,EAAET,oBAAoB,CAACM,KAAK,CAACG,OAAP,EAAgB,YAAM;UACjDF,OAAO,CAACG,MAAR,CAAeJ,KAAK,CAACK,GAArB;QACD,CAF4B;MAH/B;IAOD;;;WAED,gBAAO;MACL,KAAKR,OAAL,CAAaS,IAAb,CAAkBX,UAAlB,EAA8B,KAAKY,KAAnC;IACD;;;WAED,aAAIP,KAAJ,EAAW;MACT,IAAMK,GAAG,GAAG,KAAKG,OAAL,EAAZ;MACA,IAAMC,IAAI,GAAG,KAAKC,UAAL;QACXL,GAAG,EAAHA,GADW;QAEXM,OAAO,EAAEX,KAAK,CAACY,gBAAN,GAAyB,IAAzB,GAAgCC;MAF9B,GAG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,EAAyB,CAAzB;;YACA,KAAI,CAACX,IAAL;UACD;QACF,CANS,EAMP,IANO,CAAV;QAOA,KAAKA,IAAL;QACA,OAAO,IAAP;MACD;;MACD,OAAO,KAAP;IACD;;;;;;AAGH,SAASV,mBAAT;AACA,eAAe,IAAIA,mBAAJ,EAAf"}
1
+ {"version":3,"file":"NoticeBubbleManager.js","names":["EventEmitter","callAllEventHandlers","EVENT_NAME","NoticeBubbleManager","emitter","fn","subscribe","props","manager","type","onClose","remove","uid","emit","items","counter","item","createItem","visible","initialAnimation","undefined","push","update","bind","index","findIndex","setTimeout","splice","noticeBubbleDefaultManager"],"sources":["../../src/NoticeBubbleManager.js"],"sourcesContent":["import EventEmitter from '@semcore/utils/lib/eventEmitter';\nimport { callAllEventHandlers } from '@semcore/utils/lib/assignProps';\n\nconst EVENT_NAME = 'CHANGE';\n\nclass NoticeBubbleManager {\n items = [];\n emitter = null;\n counter = 0;\n\n constructor() {\n this.emitter = new EventEmitter();\n }\n\n addListener(fn) {\n return this.emitter.subscribe(EVENT_NAME, fn);\n }\n\n createItem(props) {\n const manager = this;\n\n return {\n type: 'info',\n ...props,\n onClose: callAllEventHandlers(props.onClose, () => {\n manager.remove(props.uid);\n }),\n };\n }\n\n emit() {\n this.emitter.emit(EVENT_NAME, this.items);\n }\n\n add(props) {\n const uid = this.counter++;\n const item = this.createItem({\n uid,\n visible: props.initialAnimation ? true : undefined,\n ...props,\n });\n this.items.push(item);\n this.emit();\n return {\n uid,\n update: this.update.bind(this, uid),\n remove: this.remove.bind(this, uid),\n };\n }\n\n update(uid, props) {\n const index = this.items.findIndex((item) => item.uid === uid);\n if (index !== -1) {\n this.items[index] = this.createItem({\n ...this.items[index],\n ...props,\n });\n this.emit();\n return true;\n }\n return false;\n }\n\n remove(uid) {\n const index = this.items.findIndex((item) => item.uid === uid);\n if (index !== -1) {\n this.items[index].visible = false;\n setTimeout(() => {\n const index = this.items.findIndex((item) => item.uid === uid);\n if (index !== -1) {\n this.items.splice(index, 1);\n this.emit();\n }\n }, 1000);\n this.emit();\n return true;\n }\n return false;\n }\n}\n\nconst noticeBubbleDefaultManager = new NoticeBubbleManager();\n\nexport { NoticeBubbleManager };\nexport default noticeBubbleDefaultManager;\n"],"mappings":";;;;AAAA,OAAOA,YAAP,MAAyB,iCAAzB;AACA,SAASC,oBAAT,QAAqC,gCAArC;AAEA,IAAMC,UAAU,GAAG,QAAnB;;IAEMC,mB;EAKJ,+BAAc;IAAA;;IAAA,+BAJN,EAIM;;IAAA,iCAHJ,IAGI;;IAAA,iCAFJ,CAEI;;IACZ,KAAKC,OAAL,GAAe,IAAIJ,YAAJ,EAAf;EACD;;;;WAED,qBAAYK,EAAZ,EAAgB;MACd,OAAO,KAAKD,OAAL,CAAaE,SAAb,CAAuBJ,UAAvB,EAAmCG,EAAnC,CAAP;IACD;;;WAED,oBAAWE,KAAX,EAAkB;MAChB,IAAMC,OAAO,GAAG,IAAhB;MAEA;QACEC,IAAI,EAAE;MADR,GAEKF,KAFL;QAGEG,OAAO,EAAET,oBAAoB,CAACM,KAAK,CAACG,OAAP,EAAgB,YAAM;UACjDF,OAAO,CAACG,MAAR,CAAeJ,KAAK,CAACK,GAArB;QACD,CAF4B;MAH/B;IAOD;;;WAED,gBAAO;MACL,KAAKR,OAAL,CAAaS,IAAb,CAAkBX,UAAlB,EAA8B,KAAKY,KAAnC;IACD;;;WAED,aAAIP,KAAJ,EAAW;MACT,IAAMK,GAAG,GAAG,KAAKG,OAAL,EAAZ;MACA,IAAMC,IAAI,GAAG,KAAKC,UAAL;QACXL,GAAG,EAAHA,GADW;QAEXM,OAAO,EAAEX,KAAK,CAACY,gBAAN,GAAyB,IAAzB,GAAgCC;MAF9B,GAGRb,KAHQ,EAAb;MAKA,KAAKO,KAAL,CAAWO,IAAX,CAAgBL,IAAhB;MACA,KAAKH,IAAL;MACA,OAAO;QACLD,GAAG,EAAHA,GADK;QAELU,MAAM,EAAE,KAAKA,MAAL,CAAYC,IAAZ,CAAiB,IAA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B,mBAAJ,EAAnC;AAEA,SAASA,mBAAT;AACA,eAAeyB,0BAAf"}
@@ -12,5 +12,11 @@ var NoticeBubbleManager = /*#__PURE__*/_createClass(function NoticeBubbleManager
12
12
  _classCallCheck(this, NoticeBubbleManager);
13
13
  });
14
14
 
15
- export {};
15
+ var noticeBubbleDefaultManager = new NoticeBubbleManager();
16
+ export { noticeBubbleDefaultManager };
17
+ /**
18
+ * @deprecated Use `import { noticeBubbleDefaultManager } from ...` instead
19
+ */
20
+
21
+ export default new NoticeBubbleManager();
16
22
  //# sourceMappingURL=index.d.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.js","names":["NoticeBubbleManager"],"sources":["../../src/index.d.ts"],"sourcesContent":["import { IPortalProps } from '@semcore/portal';\nimport { CProps, ReturnEl } from '@semcore/core';\nimport { IBoxProps } from '@semcore/flex-box';\n\nexport interface INoticeBubbleContainerProps extends IBoxProps, IPortalProps {\n /** Manager copy */\n manager?: INoticeBubbleManager;\n locale?: string;\n}\n\nexport interface INoticeBubbleProps extends IBoxProps {\n /**\n * Notice visibility.\n */\n visible?: boolean;\n /**\n * Control under the notice children.\n * */\n action?: React.ReactNode;\n /**\n * Callback triggered by \"Close\" icon click.\n * */\n onClose?: (e?: React.SyntheticEvent) => void;\n /**\n * Notice content.\n * */\n children: React.ReactNode;\n}\nexport interface INoticeBubbleInfoProps extends INoticeBubbleProps {\n readonly type?: 'info';\n /**\n * Notice display duration.\n */\n duration?: number;\n /**\n * Enables animation on first rendering.\n * @default false\n */\n initialAnimation?: boolean;\n}\n\nexport interface INoticeBubbleWarningProps extends INoticeBubbleProps {\n readonly type?: 'warning';\n /**\n * Notice display duration.\n */\n duration?: number;\n /**\n * Enables animation on first rendering.\n * @default false\n */\n initialAnimation?: boolean;\n}\n\nexport interface INoticeBubbleManager {\n /**\n * Creates and shows a notice.\n * */\n add: (props: INoticeBubbleInfoProps | INoticeBubbleWarningProps) => {\n uid: string;\n update: (\n props: Partial<INoticeBubbleInfoProps> | Partial<INoticeBubbleWarningProps>,\n ) => boolean;\n remove: () => boolean;\n };\n /**\n * Updates notice by uid.\n * */\n update: (\n uid: string,\n props: Partial<INoticeBubbleInfoProps> | Partial<INoticeBubbleWarningProps>,\n ) => boolean;\n /**\n * Removes notice by uid.\n * */\n remove: (uid: string) => boolean;\n}\n\n/**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\ndeclare const NoticeBubble: <T>(props: INoticeBubbleInfoProps & T) => ReturnEl;\n/**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\ndeclare const NoticeBubbleWarning: <T>(props: INoticeBubbleWarningProps & T) => ReturnEl;\ndeclare const NoticeBubbleContainer: (<T>(\n props: CProps<INoticeBubbleContainerProps & T>,\n) => ReturnEl) & {\n /**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\n Info: typeof NoticeBubble;\n\n /**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\n Warning: typeof NoticeBubbleWarning;\n};\ndeclare class NoticeBubbleManager implements INoticeBubbleManager {\n /**\n * Creates and shows a notice.\n * */\n add(props: INoticeBubbleInfoProps | INoticeBubbleWarningProps): {\n uid: string;\n update: (\n props: Partial<INoticeBubbleInfoProps> | Partial<INoticeBubbleWarningProps>,\n ) => boolean;\n remove: () => boolean;\n };\n /**\n * Updates notice by uid.\n * */\n update(\n uid: string,\n props: Partial<INoticeBubbleInfoProps> | Partial<INoticeBubbleWarningProps>,\n ): boolean;\n /**\n * Removes notice by uid.\n * */\n remove(uid: string): boolean;\n}\n\nexport { NoticeBubbleContainer, NoticeBubble, NoticeBubbleWarning, NoticeBubbleManager };\nexport default NoticeBubbleManager;\n"],"mappings":";;;AA8EA;AACA;AACA;;AAEA;AACA;AACA;IAecA,mB"}
1
+ {"version":3,"file":"index.d.js","names":["NoticeBubbleManager","noticeBubbleDefaultManager"],"sources":["../../src/index.d.ts"],"sourcesContent":["import { IPortalProps } from '@semcore/portal';\nimport { CProps, ReturnEl } from '@semcore/core';\nimport { IBoxProps } from '@semcore/flex-box';\n\nexport interface INoticeBubbleContainerProps extends IBoxProps, IPortalProps {\n /** Manager copy */\n manager?: INoticeBubbleManager;\n locale?: string;\n}\n\nexport interface INoticeBubbleProps extends IBoxProps {\n /**\n * Notice visibility.\n */\n visible?: boolean;\n /**\n * Control under the notice children.\n * */\n action?: React.ReactNode;\n /**\n * Callback triggered by \"Close\" icon click.\n * */\n onClose?: (e?: React.SyntheticEvent) => void;\n /**\n * Notice content.\n * */\n children: React.ReactNode;\n}\nexport interface INoticeBubbleInfoProps extends INoticeBubbleProps {\n readonly type?: 'info';\n /**\n * Notice display duration.\n */\n duration?: number;\n /**\n * Enables animation on first rendering.\n * @default false\n */\n initialAnimation?: boolean;\n}\n\nexport interface INoticeBubbleWarningProps extends INoticeBubbleProps {\n readonly type?: 'warning';\n /**\n * Notice display duration.\n */\n duration?: number;\n /**\n * Enables animation on first rendering.\n * @default false\n */\n initialAnimation?: boolean;\n}\n\nexport interface INoticeBubbleManager {\n /**\n * Creates and shows a notice.\n * */\n add: (props: INoticeBubbleInfoProps | INoticeBubbleWarningProps) => {\n uid: string;\n update: (\n props: Partial<INoticeBubbleInfoProps> | Partial<INoticeBubbleWarningProps>,\n ) => boolean;\n remove: () => boolean;\n };\n /**\n * Updates notice by uid.\n * */\n update: (\n uid: string,\n props: Partial<INoticeBubbleInfoProps> | Partial<INoticeBubbleWarningProps>,\n ) => boolean;\n /**\n * Removes notice by uid.\n * */\n remove: (uid: string) => boolean;\n}\n\n/**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\ndeclare const NoticeBubble: <T>(props: INoticeBubbleInfoProps & T) => ReturnEl;\n/**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\ndeclare const NoticeBubbleWarning: <T>(props: INoticeBubbleWarningProps & T) => ReturnEl;\ndeclare const NoticeBubbleContainer: (<T>(\n props: CProps<INoticeBubbleContainerProps & T>,\n) => ReturnEl) & {\n /**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\n Info: typeof NoticeBubble;\n\n /**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\n Warning: typeof NoticeBubbleWarning;\n};\ndeclare class NoticeBubbleManager implements INoticeBubbleManager {\n /**\n * Creates and shows a notice.\n * */\n add(props: INoticeBubbleInfoProps | INoticeBubbleWarningProps): {\n uid: string;\n update: (\n props: Partial<INoticeBubbleInfoProps> | Partial<INoticeBubbleWarningProps>,\n ) => boolean;\n remove: () => boolean;\n };\n /**\n * Updates notice by uid.\n * */\n update(\n uid: string,\n props: Partial<INoticeBubbleInfoProps> | Partial<INoticeBubbleWarningProps>,\n ): boolean;\n /**\n * Removes notice by uid.\n * */\n remove(uid: string): boolean;\n}\n\nconst noticeBubbleDefaultManager = new NoticeBubbleManager();\n\nexport {\n NoticeBubbleContainer,\n NoticeBubble,\n NoticeBubbleWarning,\n NoticeBubbleManager,\n noticeBubbleDefaultManager,\n};\n/**\n * @deprecated Use `import { noticeBubbleDefaultManager } from ...` instead\n */\nexport default new NoticeBubbleManager();\n"],"mappings":";;;AA8EA;AACA;AACA;;AAEA;AACA;AACA;IAecA,mB;;;;AAwBd,IAAMC,0BAA0B,GAAG,IAAID,mBAAJ,EAAnC;AAEA,SAKEC,0BALF;AAOA;AACA;AACA;;AACA,eAAe,IAAID,mBAAJ,EAAf"}
package/lib/es6/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { default as NoticeBubbleContainer } from './NoticeBubble';
2
2
  export * from './NoticeBubble';
3
- import { default as NoticeBubbleManager } from './NoticeBubbleManager';
3
+ import { default as noticeBubbleDefaultManager } from './NoticeBubbleManager';
4
4
  export * from './NoticeBubbleManager';
5
- export default NoticeBubbleManager;
6
- export { NoticeBubbleContainer };
5
+ export default noticeBubbleDefaultManager;
6
+ export { NoticeBubbleContainer, noticeBubbleDefaultManager };
7
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["default","NoticeBubbleContainer","NoticeBubbleManager"],"sources":["../../src/index.js"],"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"],"mappings":"AAAA,SAASA,OAAO,IAAIC,qBAApB,QAAiD,gBAAjD;AACA,cAAc,gBAAd;AAEA,SAASD,OAAO,IAAIE,mBAApB,QAA+C,uBAA/C;AAEA,cAAc,uBAAd;AAEA,eAAeA,mBAAf;AACA,SAASD,qBAAT"}
1
+ {"version":3,"file":"index.js","names":["default","NoticeBubbleContainer","noticeBubbleDefaultManager"],"sources":["../../src/index.js"],"sourcesContent":["import { default as NoticeBubbleContainer } from './NoticeBubble';\nexport * from './NoticeBubble';\n\nimport { default as noticeBubbleDefaultManager } from './NoticeBubbleManager';\n\nexport * from './NoticeBubbleManager';\n\nexport default noticeBubbleDefaultManager;\nexport { NoticeBubbleContainer, noticeBubbleDefaultManager };\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,qBAApB,QAAiD,gBAAjD;AACA,cAAc,gBAAd;AAEA,SAASD,OAAO,IAAIE,0BAApB,QAAsD,uBAAtD;AAEA,cAAc,uBAAd;AAEA,eAAeA,0BAAf;AACA,SAASD,qBAAT,EAAgCC,0BAAhC"}
@@ -121,5 +121,16 @@ declare class NoticeBubbleManager implements INoticeBubbleManager {
121
121
  remove(uid: string): boolean;
122
122
  }
123
123
 
124
- export { NoticeBubbleContainer, NoticeBubble, NoticeBubbleWarning, NoticeBubbleManager };
125
- export default NoticeBubbleManager;
124
+ const noticeBubbleDefaultManager = new NoticeBubbleManager();
125
+
126
+ export {
127
+ NoticeBubbleContainer,
128
+ NoticeBubble,
129
+ NoticeBubbleWarning,
130
+ NoticeBubbleManager,
131
+ noticeBubbleDefaultManager,
132
+ };
133
+ /**
134
+ * @deprecated Use `import { noticeBubbleDefaultManager } from ...` instead
135
+ */
136
+ export default new NoticeBubbleManager();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/notice-bubble",
3
3
  "description": "Semrush NoticeBubble Component",
4
- "version": "4.7.2",
4
+ "version": "4.7.4",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",