@semcore/notice-bubble 16.1.12 → 16.2.0-prerelease.1

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.
@@ -18,28 +18,15 @@ var NoticeBubbleManager = exports.NoticeBubbleManager = /*#__PURE__*/function ()
18
18
  function NoticeBubbleManager() {
19
19
  (0, _classCallCheck2["default"])(this, NoticeBubbleManager);
20
20
  (0, _defineProperty2["default"])(this, "items", []);
21
- (0, _defineProperty2["default"])(this, "emitter", null);
21
+ (0, _defineProperty2["default"])(this, "emitter", new _eventEmitter["default"]());
22
22
  (0, _defineProperty2["default"])(this, "counter", 0);
23
- (0, _defineProperty2["default"])(this, "replaceTimer", 0);
24
- this.emitter = new _eventEmitter["default"]();
23
+ (0, _defineProperty2["default"])(this, "replaceTimer", null);
25
24
  }
26
25
  return (0, _createClass2["default"])(NoticeBubbleManager, [{
27
26
  key: "addListener",
28
27
  value: function addListener(fn) {
29
28
  return this.emitter.subscribe(EVENT_NAME, fn);
30
29
  }
31
- }, {
32
- key: "createItem",
33
- value: function createItem(props) {
34
- var manager = this;
35
- return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
36
- type: 'info'
37
- }, props), {}, {
38
- onClose: (0, _assignProps.callAllEventHandlers)(props.onClose, function () {
39
- manager.remove(props.uid);
40
- })
41
- });
42
- }
43
30
  }, {
44
31
  key: "emit",
45
32
  value: function emit() {
@@ -48,18 +35,26 @@ var NoticeBubbleManager = exports.NoticeBubbleManager = /*#__PURE__*/function ()
48
35
  }, {
49
36
  key: "add",
50
37
  value: function add(props) {
38
+ var _this = this;
51
39
  var uid = this.counter++;
52
40
  var ref = /*#__PURE__*/_react["default"].createRef();
53
41
  var focus = function focus() {
54
- return setTimeout(function () {
55
- return (0, _useFocusLock.setFocus)(ref.current);
42
+ setTimeout(function () {
43
+ if (ref.current) {
44
+ (0, _useFocusLock.setFocus)(ref.current);
45
+ }
56
46
  }, 0);
57
47
  };
58
- var item = this.createItem((0, _objectSpread2["default"])({
48
+ var item = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({
49
+ type: 'info',
59
50
  uid: uid,
60
51
  visible: props.initialAnimation ? true : undefined,
61
52
  forwardRef: ref
62
- }, props));
53
+ }, props), {}, {
54
+ onClose: (0, _assignProps.callAllEventHandlers)(props.onClose, function () {
55
+ _this.remove(uid);
56
+ })
57
+ });
63
58
  this.items.push(item);
64
59
  this.emit();
65
60
  return {
@@ -78,16 +73,28 @@ var NoticeBubbleManager = exports.NoticeBubbleManager = /*#__PURE__*/function ()
78
73
  return item.uid === uid;
79
74
  });
80
75
  if (index !== -1) {
81
- this.items[index] = this.createItem((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, this.items[index]), props));
76
+ this.items[index] = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, this.items[index]), props);
82
77
  this.emit();
83
78
  return true;
84
79
  }
85
80
  return false;
86
81
  }
82
+ }, {
83
+ key: "replace",
84
+ value: function replace(uid, props) {
85
+ var _this2 = this;
86
+ if (this.replaceTimer) {
87
+ clearTimeout(this.replaceTimer);
88
+ }
89
+ this.remove(uid);
90
+ this.replaceTimer = setTimeout(function () {
91
+ _this2.add(props);
92
+ }, 300);
93
+ }
87
94
  }, {
88
95
  key: "replaceLast",
89
96
  value: function replaceLast(props) {
90
- var _this = this;
97
+ var _this3 = this;
91
98
  if (this.replaceTimer) {
92
99
  clearTimeout(this.replaceTimer);
93
100
  }
@@ -96,23 +103,23 @@ var NoticeBubbleManager = exports.NoticeBubbleManager = /*#__PURE__*/function ()
96
103
  this.remove(this.counter - 1);
97
104
  }
98
105
  this.replaceTimer = setTimeout(function () {
99
- _this.add(props);
106
+ _this3.add(props);
100
107
  }, 300);
101
108
  }
102
109
  }, {
103
110
  key: "remove",
104
111
  value: function remove(uid) {
105
- var _this2 = this;
112
+ var _this4 = this;
106
113
  var item = this.items.find(function (item) {
107
114
  return item.uid === uid;
108
115
  });
109
116
  if (item) {
110
117
  item.visible = false;
111
118
  setTimeout(function () {
112
- _this2.items = _this2.items.filter(function (item) {
119
+ _this4.items = _this4.items.filter(function (item) {
113
120
  return item.uid !== uid;
114
121
  });
115
- _this2.emit();
122
+ _this4.emit();
116
123
  }, 1000);
117
124
  this.emit();
118
125
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"NoticeBubbleManager.js","names":["_assignProps","require","_eventEmitter","_interopRequireDefault","_useFocusLock","_react","EVENT_NAME","NoticeBubbleManager","exports","_classCallCheck2","_defineProperty2","emitter","EventEmitter","_createClass2","key","value","addListener","fn","subscribe","createItem","props","manager","_objectSpread2","type","onClose","callAllEventHandlers","remove","uid","emit","items","add","counter","ref","React","createRef","focus","setTimeout","setFocus","current","item","visible","initialAnimation","undefined","forwardRef","push","update","bind","index","findIndex","replaceLast","_this","replaceTimer","clearTimeout","length","_this2","find","filter","noticeBubbleDefaultManager","_default"],"sources":["../../src/NoticeBubbleManager.js"],"sourcesContent":["import { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';\nimport EventEmitter from '@semcore/core/lib/utils/eventEmitter';\nimport { setFocus } from '@semcore/core/lib/utils/use/useFocusLock';\nimport React from 'react';\n\nconst EVENT_NAME = 'CHANGE';\n\nclass NoticeBubbleManager {\n items = [];\n emitter = null;\n counter = 0;\n\n replaceTimer = 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 ref = React.createRef();\n const focus = () => setTimeout(() => setFocus(ref.current), 0);\n const item = this.createItem({\n uid,\n visible: props.initialAnimation ? true : undefined,\n forwardRef: ref,\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 ref,\n // todo Brauer Ilia: remove this property, because we added logic about autofocus in Notice\n focus,\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 replaceLast(props) {\n if (this.replaceTimer) {\n clearTimeout(this.replaceTimer);\n }\n\n const item = this.items[this.items.length - 1];\n\n if (item?.visible) {\n this.remove(this.counter - 1);\n }\n\n this.replaceTimer = setTimeout(() => {\n this.add(props);\n }, 300);\n }\n\n remove(uid) {\n const item = this.items.find((item) => item.uid === uid);\n if (item) {\n item.visible = false;\n setTimeout(() => {\n this.items = this.items.filter((item) => item.uid !== uid);\n this.emit();\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,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAF,sBAAA,CAAAF,OAAA;AAEA,IAAMK,UAAU,GAAG,QAAQ;AAAC,IAEtBC,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA;EAOvB,SAAAA,oBAAA,EAAc;IAAA,IAAAE,gBAAA,mBAAAF,mBAAA;IAAA,IAAAG,gBAAA,4BANN,EAAE;IAAA,IAAAA,gBAAA,8BACA,IAAI;IAAA,IAAAA,gBAAA,8BACJ,CAAC;IAAA,IAAAA,gBAAA,mCAEI,CAAC;IAGd,IAAI,CAACC,OAAO,GAAG,IAAIC,wBAAY,CAAC,CAAC;EACnC;EAAC,WAAAC,aAAA,aAAAN,mBAAA;IAAAO,GAAA;IAAAC,KAAA,EAED,SAAAC,WAAWA,CAACC,EAAE,EAAE;MACd,OAA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CAAC;MACjB,CAAC,EAAE,GAAG,CAAC;IACT;EAAC;IAAAN,GAAA;IAAAC,KAAA,EAED,SAAAW,MAAMA,CAACC,GAAG,EAAE;MAAA,IAAA2B,MAAA;MACV,IAAMf,IAAI,GAAG,IAAI,CAACV,KAAK,CAAC0B,IAAI,CAAC,UAAChB,IAAI;QAAA,OAAKA,IAAI,CAACZ,GAAG,KAAKA,GAAG;MAAA,EAAC;MACxD,IAAIY,IAAI,EAAE;QACRA,IAAI,CAACC,OAAO,GAAG,KAAK;QACpBJ,UAAU,CAAC,YAAM;UACfkB,MAAI,CAACzB,KAAK,GAAGyB,MAAI,CAACzB,KAAK,CAAC2B,MAAM,CAAC,UAACjB,IAAI;YAAA,OAAKA,IAAI,CAACZ,GAAG,KAAKA,GAAG;UAAA,EAAC;UAC1D2B,MAAI,CAAC1B,IAAI,CAAC,CAAC;QACb,CAAC,EAAE,IAAI,CAAC;QACR,IAAI,CAACA,IAAI,CAAC,CAAC;QACX,OAAO,IAAI;MACb;MACA,OAAO,KAAK;IACd;EAAC;AAAA;AAGH,IAAM6B,0BAA0B,GAAG,IAAIlD,mBAAmB,CAAC,CAAC;AAAC,IAAAmD,QAAA,GAAAlD,OAAA,cAG9CiD,0BAA0B","ignoreList":[]}
1
+ {"version":3,"file":"NoticeBubbleManager.js","names":["_assignProps","require","_eventEmitter","_interopRequireDefault","_useFocusLock","_react","EVENT_NAME","NoticeBubbleManager","exports","_classCallCheck2","_defineProperty2","EventEmitter","_createClass2","key","value","addListener","fn","emitter","subscribe","emit","items","add","props","_this","uid","counter","ref","React","createRef","focus","setTimeout","current","setFocus","item","_objectSpread2","type","visible","initialAnimation","undefined","forwardRef","onClose","callAllEventHandlers","remove","push","update","bind","index","findIndex","replace","_this2","replaceTimer","clearTimeout","replaceLast","_this3","length","_this4","find","filter","noticeBubbleDefaultManager","_default"],"sources":["../../src/NoticeBubbleManager.ts"],"sourcesContent":["import { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';\nimport EventEmitter from '@semcore/core/lib/utils/eventEmitter';\nimport { setFocus } from '@semcore/core/lib/utils/use/useFocusLock';\nimport type { RefObject } from 'react';\nimport React from 'react';\n\nimport type {\n NoticeBubbleManagerClass,\n NoticeBubbleInfoProps,\n NoticeBubbleWarningProps,\n AddedNoticeMeta,\n} from './NoticeBubble.type';\n\nconst EVENT_NAME = 'CHANGE';\n\nexport type NoticeItem = (NoticeBubbleInfoProps | NoticeBubbleWarningProps) & {\n uid: number;\n visible?: boolean;\n forwardRef: RefObject<HTMLElement>;\n onClose: () => void;\n};\n\nclass NoticeBubbleManager implements NoticeBubbleManagerClass {\n private items: NoticeItem[] = [];\n private emitter = new EventEmitter();\n private counter = 0;\n\n private replaceTimer: ReturnType<typeof setTimeout> | null = null;\n\n public addListener(fn: (items: NoticeItem[]) => void): () => void {\n return this.emitter.subscribe(EVENT_NAME, fn);\n }\n\n private emit() {\n this.emitter.emit(EVENT_NAME, this.items);\n }\n\n public add(props: NoticeBubbleInfoProps | NoticeBubbleWarningProps): AddedNoticeMeta {\n const uid = this.counter++;\n const ref = React.createRef<HTMLElement>();\n const focus = () => {\n setTimeout(() => {\n if (ref.current) {\n setFocus(ref.current);\n }\n }, 0);\n };\n const item = {\n type: 'info',\n uid,\n visible: props.initialAnimation ? true : undefined,\n forwardRef: ref,\n ...props,\n onClose: callAllEventHandlers(props.onClose, () => {\n this.remove(uid);\n }),\n } as const;\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 ref,\n // todo Brauer Ilia: remove this property, because we added logic about autofocus in Notice\n focus,\n };\n }\n\n public update(uid: number, props: NoticeBubbleInfoProps | NoticeBubbleWarningProps): boolean {\n const index = this.items.findIndex((item) => item.uid === uid);\n if (index !== -1) {\n this.items[index] = {\n ...this.items[index],\n ...props,\n };\n this.emit();\n return true;\n }\n return false;\n }\n\n public replace(uid: number, props: NoticeBubbleInfoProps | NoticeBubbleWarningProps): void {\n if (this.replaceTimer) {\n clearTimeout(this.replaceTimer);\n }\n\n this.remove(uid);\n\n this.replaceTimer = setTimeout(() => {\n this.add(props);\n }, 300);\n }\n\n public replaceLast(props: NoticeBubbleInfoProps | NoticeBubbleWarningProps): void {\n if (this.replaceTimer) {\n clearTimeout(this.replaceTimer);\n }\n\n const item = this.items[this.items.length - 1];\n\n if (item?.visible) {\n this.remove(this.counter - 1);\n }\n\n this.replaceTimer = setTimeout(() => {\n this.add(props);\n }, 300);\n }\n\n public remove(uid: number): boolean {\n const item = this.items.find((item) => item.uid === uid);\n if (item) {\n item.visible = false;\n setTimeout(() => {\n this.items = this.items.filter((item) => item.uid !== uid);\n this.emit();\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,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAF,sBAAA,CAAAF,OAAA;AASA,IAAMK,UAAU,GAAG,QAAQ;AAAC,IAStBC,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA;EAAA,SAAAA,oBAAA;IAAA,IAAAE,gBAAA,mBAAAF,mBAAA;IAAA,IAAAG,gBAAA,4BACO,EAAE;IAAA,IAAAA,gBAAA,8BACd,IAAIC,wBAAY,CAAC,CAAC;IAAA,IAAAD,gBAAA,8BAClB,CAAC;IAAA,IAAAA,gBAAA,mCAE0C,IAAI;EAAA;EAAA,WAAAE,aAAA,aAAAL,mBAAA;IAAAM,GAAA;IAAAC,KAAA,EAEjE,SAAOC,WAAWA,CAACC,EAAiC,EAAc;MAChE,OAAO,IAAI,CAACC,OAAO,CAACC,SAAS,CAACZ,UAAU,EAAEU,EAAE,CAAC;IAC/C;EAAC;IAAAH,GAAA;IAAAC,KAA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AC,IAAI,CAACjB,OAAO,GAAG,CAAC,CAAC;MAC/B;MAEA,IAAI,CAACyB,YAAY,GAAGpB,UAAU,CAAC,YAAM;QACnCuB,MAAI,CAAChC,GAAG,CAACC,KAAK,CAAC;MACjB,CAAC,EAAE,GAAG,CAAC;IACT;EAAC;IAAAT,GAAA;IAAAC,KAAA,EAED,SAAO4B,MAAMA,CAAClB,GAAW,EAAW;MAAA,IAAA+B,MAAA;MAClC,IAAMtB,IAAI,GAAG,IAAI,CAACb,KAAK,CAACoC,IAAI,CAAC,UAACvB,IAAI;QAAA,OAAKA,IAAI,CAACT,GAAG,KAAKA,GAAG;MAAA,EAAC;MACxD,IAAIS,IAAI,EAAE;QACRA,IAAI,CAACG,OAAO,GAAG,KAAK;QACpBN,UAAU,CAAC,YAAM;UACfyB,MAAI,CAACnC,KAAK,GAAGmC,MAAI,CAACnC,KAAK,CAACqC,MAAM,CAAC,UAACxB,IAAI;YAAA,OAAKA,IAAI,CAACT,GAAG,KAAKA,GAAG;UAAA,EAAC;UAC1D+B,MAAI,CAACpC,IAAI,CAAC,CAAC;QACb,CAAC,EAAE,IAAI,CAAC;QACR,IAAI,CAACA,IAAI,CAAC,CAAC;QACX,OAAO,IAAI;MACb;MACA,OAAO,KAAK;IACd;EAAC;AAAA;AAGH,IAAMuC,0BAA0B,GAAG,IAAInD,mBAAmB,CAAC,CAAC;AAAC,IAAAoD,QAAA,GAAAnD,OAAA,cAG9CkD,0BAA0B","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_NoticeBubble","_interopRequireWildcard","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_NoticeBubbleManager","_default","noticeBubbleDefaultManager"],"sources":["../../src/index.js"],"sourcesContent":["import { default as NoticeBubbleContainer } from './NoticeBubble';\nimport { default as noticeBubbleDefaultManager } from './NoticeBubbleManager';\n\nexport * from './NoticeBubble';\n\nexport * from './NoticeBubbleManager';\n\nexport default noticeBubbleDefaultManager;\nexport { NoticeBubbleContainer, noticeBubbleDefaultManager };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,aAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGAC,MAAA,CAAAC,IAAA,CAAAJ,aAAA,EAAAK,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAN,aAAA,CAAAM,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAd,aAAA,CAAAM,GAAA;IAAA;EAAA;AAAA;AAFA,IAAAS,oBAAA,GAAAd,uBAAA,CAAAC,OAAA;AAIAC,MAAA,CAAAC,IAAA,CAAAW,oBAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,oBAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAC,oBAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AAAsC,IAAAU,QAAA,GAAAL,OAAA,cAEvBM,+BAA0B","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_NoticeBubble","_interopRequireWildcard","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_NoticeBubbleManager","_default","noticeBubbleDefaultManager"],"sources":["../../src/index.ts"],"sourcesContent":["import { default as NoticeBubbleContainer } from './NoticeBubble';\nimport type {\n NoticeBubbleContainerProps,\n NoticeBubbleInfoProps,\n NoticeBubbleWarningProps,\n AddedNoticeMeta,\n} from './NoticeBubble.type';\nimport { default as noticeBubbleDefaultManager } from './NoticeBubbleManager';\n\nexport * from './NoticeBubble';\n\nexport * from './NoticeBubbleManager';\n\nexport default noticeBubbleDefaultManager;\nexport { NoticeBubbleContainer, noticeBubbleDefaultManager };\n\nexport type {\n NoticeBubbleContainerProps,\n NoticeBubbleInfoProps,\n NoticeBubbleWarningProps,\n AddedNoticeMeta,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,aAAA,GAAAC,uBAAA,CAAAC,OAAA;AASAC,MAAA,CAAAC,IAAA,CAAAJ,aAAA,EAAAK,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAN,aAAA,CAAAM,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAd,aAAA,CAAAM,GAAA;IAAA;EAAA;AAAA;AAFA,IAAAS,oBAAA,GAAAd,uBAAA,CAAAC,OAAA;AAIAC,MAAA,CAAAC,IAAA,CAAAW,oBAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,oBAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAC,oBAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AAAsC,IAAAU,QAAA,GAAAL,OAAA,cAEvBM,+BAA0B","ignoreList":[]}
package/lib/cjs/utils.js CHANGED
@@ -7,9 +7,16 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.Timer = void 0;
8
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
11
  var Timer = exports.Timer = /*#__PURE__*/function () {
11
12
  function Timer(callback, delay) {
12
13
  (0, _classCallCheck2["default"])(this, Timer);
14
+ (0, _defineProperty2["default"])(this, "delay", void 0);
15
+ (0, _defineProperty2["default"])(this, "callback", void 0);
16
+ (0, _defineProperty2["default"])(this, "remaining", void 0);
17
+ (0, _defineProperty2["default"])(this, "timerId", null);
18
+ (0, _defineProperty2["default"])(this, "start", 0);
19
+ (0, _defineProperty2["default"])(this, "paused", void 0);
13
20
  this.callback = callback;
14
21
  this.delay = delay;
15
22
  this.remaining = delay;
@@ -19,7 +26,9 @@ var Timer = exports.Timer = /*#__PURE__*/function () {
19
26
  return (0, _createClass2["default"])(Timer, [{
20
27
  key: "pause",
21
28
  value: function pause() {
22
- clearTimeout(this.timerId);
29
+ if (this.timerId) {
30
+ clearTimeout(this.timerId);
31
+ }
23
32
  this.remaining -= Date.now() - this.start;
24
33
  this.paused = true;
25
34
  }
@@ -28,8 +37,10 @@ var Timer = exports.Timer = /*#__PURE__*/function () {
28
37
  value: function resume() {
29
38
  this.start = Date.now();
30
39
  this.paused = false;
31
- clearTimeout(this.timerId);
32
- this.timerId = setTimeout(this.callback, this.remaining);
40
+ if (this.timerId) {
41
+ clearTimeout(this.timerId);
42
+ }
43
+ this.timerId = window.setTimeout(this.callback, this.remaining);
33
44
  }
34
45
  }, {
35
46
  key: "reset",
@@ -40,7 +51,9 @@ var Timer = exports.Timer = /*#__PURE__*/function () {
40
51
  }, {
41
52
  key: "clear",
42
53
  value: function clear() {
43
- clearTimeout(this.timerId);
54
+ if (this.timerId) {
55
+ clearTimeout(this.timerId);
56
+ }
44
57
  }
45
58
  }]);
46
59
  }();
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["Timer","exports","callback","delay","_classCallCheck2","remaining","paused","resume","_createClass2","key","value","pause","clearTimeout","timerId","Date","now","start","setTimeout","reset","clear"],"sources":["../../src/utils.js"],"sourcesContent":["class Timer {\n constructor(callback, delay) {\n this.callback = callback;\n this.delay = delay;\n this.remaining = delay;\n this.paused = false;\n this.resume();\n }\n\n pause() {\n clearTimeout(this.timerId);\n this.remaining -= Date.now() - this.start;\n this.paused = true;\n }\n\n resume() {\n this.start = Date.now();\n this.paused = false;\n clearTimeout(this.timerId);\n this.timerId = setTimeout(this.callback, this.remaining);\n }\n\n reset() {\n this.remaining = this.delay;\n this.resume();\n }\n\n clear() {\n clearTimeout(this.timerId);\n }\n}\n\nexport { Timer };\n"],"mappings":";;;;;;;;;IAAMA,KAAK,GAAAC,OAAA,CAAAD,KAAA;EACT,SAAAA,MAAYE,QAAQ,EAAEC,KAAK,EAAE;IAAA,IAAAC,gBAAA,mBAAAJ,KAAA;IAC3B,IAAI,CAACE,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACC,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACE,SAAS,GAAGF,KAAK;IACtB,IAAI,CAACG,MAAM,GAAG,KAAK;IACnB,IAAI,CAACC,MAAM,CAAC,CAAC;EACf;EAAC,WAAAC,aAAA,aAAAR,KAAA;IAAAS,GAAA;IAAAC,KAAA,EAED,SAAAC,KAAKA,CAAA,EAAG;MACNC,YAAY,CAAC,IAAI,CAACC,OAAO,CAAC;MAC1B,IAAI,CAACR,SAAS,IAAIS,IAAI,CAACC,GAAG,CAAC,CAAC,GAAG,IAAI,CAACC,KAAK;MACzC,IAAI,CAACV,MAAM,GAAG,IAAI;IACpB;EAAC;IAAAG,GAAA;IAAAC,KAAA,EAED,SAAAH,MAAMA,CAAA,EAAG;MACP,IAAI,CAACS,KAAK,GAAGF,IAAI,CAACC,GAAG,CAAC,CAAC;MACvB,IAAI,CAACT,MAAM,GAAG,KAAK;MACnBM,YAAY,CAAC,IAAI,CAACC,OAAO,CAAC;MAC1B,IAAI,CAACA,OAAO,GAAGI,UAAU,CAAC,IAAI,CAACf,QAAQ,EAAE,IAAI,CAACG,SAAS,CAAC;IAC1D;EAAC;IAAAI,GAAA;IAAAC,KAAA,EAED,SAAAQ,KAAKA,CAAA,EAAG;MACN,IAAI,CAACb,SAAS,GAAG,IAAI,CAACF,KAAK;MAC3B,IAAI,CAACI,MAAM,CAAC,CAAC;IACf;EAAC;IAAAE,GAAA;IAAAC,KAAA,EAED,SAAAS,KAAKA,CAAA,EAAG;MACNP,YAAY,CAAC,IAAI,CAACC,OAAO,CAAC;IAC5B;EAAC;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"utils.js","names":["Timer","exports","callback","delay","_classCallCheck2","_defineProperty2","remaining","paused","resume","_createClass2","key","value","pause","timerId","clearTimeout","Date","now","start","window","setTimeout","reset","clear"],"sources":["../../src/utils.ts"],"sourcesContent":["class Timer {\n private readonly delay: number;\n private readonly callback: Function;\n\n private remaining: number;\n private timerId: number | null = null;\n private start: number = 0;\n\n public paused: boolean;\n\n constructor(callback: Function, delay: number) {\n this.callback = callback;\n this.delay = delay;\n\n this.remaining = delay;\n this.paused = false;\n this.resume();\n }\n\n pause() {\n if (this.timerId) {\n clearTimeout(this.timerId);\n }\n this.remaining -= Date.now() - this.start;\n this.paused = true;\n }\n\n resume() {\n this.start = Date.now();\n this.paused = false;\n if (this.timerId) {\n clearTimeout(this.timerId);\n }\n this.timerId = window.setTimeout(this.callback, this.remaining);\n }\n\n reset() {\n this.remaining = this.delay;\n this.resume();\n }\n\n clear() {\n if (this.timerId) {\n clearTimeout(this.timerId);\n }\n }\n}\n\nexport { Timer };\n"],"mappings":";;;;;;;;;;IAAMA,KAAK,GAAAC,OAAA,CAAAD,KAAA;EAUT,SAAAA,MAAYE,QAAkB,EAAEC,KAAa,EAAE;IAAA,IAAAC,gBAAA,mBAAAJ,KAAA;IAAA,IAAAK,gBAAA;IAAA,IAAAA,gBAAA;IAAA,IAAAA,gBAAA;IAAA,IAAAA,gBAAA,8BALd,IAAI;IAAA,IAAAA,gBAAA,4BACb,CAAC;IAAA,IAAAA,gBAAA;IAKvB,IAAI,CAACH,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACC,KAAK,GAAGA,KAAK;IAElB,IAAI,CAACG,SAAS,GAAGH,KAAK;IACtB,IAAI,CAACI,MAAM,GAAG,KAAK;IACnB,IAAI,CAACC,MAAM,CAAC,CAAC;EACf;EAAC,WAAAC,aAAA,aAAAT,KAAA;IAAAU,GAAA;IAAAC,KAAA,EAED,SAAAC,KAAKA,CAAA,EAAG;MACN,IAAI,IAAI,CAACC,OAAO,EAAE;QAChBC,YAAY,CAAC,IAAI,CAACD,OAAO,CAAC;MAC5B;MACA,IAAI,CAACP,SAAS,IAAIS,IAAI,CAACC,GAAG,CAAC,CAAC,GAAG,IAAI,CAACC,KAAK;MACzC,IAAI,CAACV,MAAM,GAAG,IAAI;IACpB;EAAC;IAAAG,GAAA;IAAAC,KAAA,EAED,SAAAH,MAAMA,CAAA,EAAG;MACP,IAAI,CAACS,KAAK,GAAGF,IAAI,CAACC,GAAG,CAAC,CAAC;MACvB,IAAI,CAACT,MAAM,GAAG,KAAK;MACnB,IAAI,IAAI,CAACM,OAAO,EAAE;QAChBC,YAAY,CAAC,IAAI,CAACD,OAAO,CAAC;MAC5B;MACA,IAAI,CAACA,OAAO,GAAGK,MAAM,CAACC,UAAU,CAAC,IAAI,CAACjB,QAAQ,EAAE,IAAI,CAACI,SAAS,CAAC;IACjE;EAAC;IAAAI,GAAA;IAAAC,KAAA,EAED,SAAAS,KAAKA,CAAA,EAAG;MACN,IAAI,CAACd,SAAS,GAAG,IAAI,CAACH,KAAK;MAC3B,IAAI,CAACK,MAAM,CAAC,CAAC;IACf;EAAC;IAAAE,GAAA;IAAAC,KAAA,EAED,SAAAU,KAAKA,CAAA,EAAG;MACN,IAAI,IAAI,CAACR,OAAO,EAAE;QAChBC,YAAY,CAAC,IAAI,CAACD,OAAO,CAAC;MAC5B;IACF;EAAC;AAAA","ignoreList":[]}
@@ -1,80 +1,53 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
1
2
  import _extends from "@babel/runtime/helpers/extends";
2
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
3
5
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
6
  import _createClass from "@babel/runtime/helpers/createClass";
5
7
  import _callSuper from "@babel/runtime/helpers/callSuper";
6
8
  import _inherits from "@babel/runtime/helpers/inherits";
7
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
- import _objectSpread from "@babel/runtime/helpers/objectSpread2";
9
10
  import { sstyled as _sstyled } from "@semcore/core";
10
11
  import { assignProps as _assignProps } from "@semcore/core";
11
- var _excluded = ["focusLock"],
12
- _excluded2 = ["forwardRef", "styles", "onMouseEnter", "onMouseLeave", "getI18nText", "icon", "children", "action", "type"];
13
- import { Animation } from '@semcore/animation';
12
+ var _excluded = ["focusLock"];
13
+ import { Animation, Box } from '@semcore/base-components';
14
14
  import Button from '@semcore/button';
15
15
  import { createComponent, Component, sstyled, Root } from '@semcore/core';
16
- import { callAllEventHandlers } from '@semcore/core/lib/utils/assignProps';
17
16
  import i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';
18
17
  import fire from '@semcore/core/lib/utils/fire';
19
18
  import { getFocusableIn } from '@semcore/core/lib/utils/focus-lock/getFocusableIn';
20
19
  import isNode from '@semcore/core/lib/utils/isNode';
21
- import { forkRef, useForkRef } from '@semcore/core/lib/utils/ref';
20
+ import { useForkRef } from '@semcore/core/lib/utils/ref';
22
21
  import { contextThemeEnhance } from '@semcore/core/lib/utils/ThemeProvider';
23
22
  import { useFocusLock, setFocus } from '@semcore/core/lib/utils/use/useFocusLock';
24
- import { useCssVariable } from '@semcore/core/lib/utils/useCssVariable';
23
+ import { cssVariableEnhance } from '@semcore/core/lib/utils/useCssVariable';
25
24
  import { ZIndexStackingContextProvider, zIndexStackingEnhance } from '@semcore/core/lib/utils/zIndexStacking';
26
- import { Flex, Box } from '@semcore/flex-box';
25
+ import { Flex } from '@semcore/flex-box';
27
26
  import CloseIcon from '@semcore/icon/Close/m';
28
27
  import Portal from '@semcore/portal';
29
28
  import React from 'react';
30
29
  import manager from './NoticeBubbleManager';
31
30
  /*!__reshadow-styles__:"./style/notice-bubble.shadow.css"*/
32
- var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/"@keyframes enter_och9o{0%{transform:translate(100%,0);max-height:0;overflow:hidden}to{transform:translate(0,0);max-height:100vh;overflow:hidden}}@keyframes exit_och9o{0%{max-height:100vh;overflow:hidden;opacity:1}to{max-height:0;overflow:hidden;opacity:0}}.___SBubble_och9o_gg_,.___SView_och9o_gg_{position:relative;margin-bottom:var(--intergalactic-spacing-3x, 12px);padding:var(--intergalactic-spacing-3x, 12px);padding-right:calc(var(--intergalactic-spacing-8x, 32px) + var(--intergalactic-spacing-1x, 4px));width:100%;border-radius:var(--intergalactic-popper-rounded, 6px);overflow:hidden;box-sizing:border-box;color:var(--intergalactic-text-primary-invert, #ffffff);gap:var(--intergalactic-spacing-2x, 8px)}.___SBubble_och9o_gg_._type_info_och9o_gg_,.___SView_och9o_gg_._type_info_och9o_gg_{background:var(--intergalactic-bg-primary-invert, #191b23)}.___SBubble_och9o_gg_._type_warning_och9o_gg_,.___SView_och9o_gg_._type_warning_och9o_gg_{background:var(--intergalactic-bg-primary-critical, #ff4953)}.___SContent_och9o_gg_{flex-direction:column;gap:var(--intergalactic-spacing-2x, 8px);flex:1}.___SMessage_och9o_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SDismiss_och9o_gg_{cursor:pointer;position:absolute;right:0;top:0;margin-top:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-2x, 8px);margin-bottom:var(--intergalactic-spacing-2x, 8px);flex-shrink:0;border:0;background:0 0}.___SDismiss_och9o_gg_.__use_och9o_gg_{padding:0 1px}.___SIcon_och9o_gg_{justify-content:center;align-items:center;height:var(--intergalactic-spacing-5x, 20px)}.___SNoticeBubble_och9o_gg_{width:300px;position:fixed;right:var(--intergalactic-spacing-3x, 12px);top:var(--intergalactic-spacing-3x, 12px)}@media (max-width:767px){.___SNoticeBubble_och9o_gg_{width:calc(100% - var(--intergalactic-spacing-6x, 24px))}}.___SNoticeBubble_och9o_gg_.__disablePortal_och9o_gg_{position:sticky;margin-left:auto;height:0}.___SMessage_och9o_gg_ a{color:var(--intergalactic-text-link-invert, #8ecdff)}.___SNoticeAriaLiveWrapper_och9o_gg_{display:contents}", /*__inner_css_end__*/"och9o_gg_"),
31
+ var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/"@keyframes enter_fiqqt{0%{transform:translate(100%,0);max-height:0;overflow:hidden}to{transform:translate(0,0);max-height:100vh;overflow:hidden}}@keyframes exit_fiqqt{0%{max-height:100vh;overflow:hidden;opacity:1}to{max-height:0;overflow:hidden;opacity:0}}.___SBubble_fiqqt_gg_,.___SView_fiqqt_gg_{position:relative;margin-bottom:var(--intergalactic-spacing-3x, 12px);padding:var(--intergalactic-spacing-3x, 12px);padding-right:calc(var(--intergalactic-spacing-8x, 32px) + var(--intergalactic-spacing-1x, 4px));width:100%;border-radius:var(--intergalactic-popper-rounded, 6px);overflow:hidden;box-sizing:border-box;color:var(--intergalactic-text-primary-invert, #ffffff);gap:var(--intergalactic-spacing-2x, 8px)}.___SBubble_fiqqt_gg_._type_info_fiqqt_gg_,.___SView_fiqqt_gg_._type_info_fiqqt_gg_{background:var(--intergalactic-bg-primary-invert, #191b23)}.___SBubble_fiqqt_gg_._type_warning_fiqqt_gg_,.___SView_fiqqt_gg_._type_warning_fiqqt_gg_{background:var(--intergalactic-bg-primary-critical, #ff4953)}.___SContent_fiqqt_gg_{flex-direction:column;gap:var(--intergalactic-spacing-2x, 8px);flex:1}.___SMessage_fiqqt_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SDismiss_fiqqt_gg_{cursor:pointer;position:absolute;right:0;top:0;margin-top:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-2x, 8px);margin-bottom:var(--intergalactic-spacing-2x, 8px);flex-shrink:0;border:0;background:0 0}.___SDismiss_fiqqt_gg_.__use_fiqqt_gg_{padding:0 1px}.___SIcon_fiqqt_gg_{justify-content:center;align-items:center;height:var(--intergalactic-spacing-5x, 20px)}.___SNoticeBubble_fiqqt_gg_{width:300px;position:fixed;right:var(--intergalactic-spacing-3x, 12px);top:var(--intergalactic-spacing-3x, 12px)}@media (max-width:767px){.___SNoticeBubble_fiqqt_gg_{width:calc(100% - var(--intergalactic-spacing-6x, 24px))}}.___SNoticeBubble_fiqqt_gg_.__disablePortal_fiqqt_gg_{position:sticky;margin-left:auto;height:0}.___SMessage_fiqqt_gg_ a{color:var(--intergalactic-text-link-invert, #8ecdff)}.___SNoticeAriaLiveWrapper_fiqqt_gg_{display:contents}", /*__inner_css_end__*/"fiqqt_gg_"),
33
32
  /*__reshadow_css_end__*/
34
33
  {
35
- "__SContent": "___SContent_och9o_gg_",
36
- "__SMessage": "___SMessage_och9o_gg_",
37
- "__SDismiss": "___SDismiss_och9o_gg_",
38
- "_use": "__use_och9o_gg_",
39
- "__SIcon": "___SIcon_och9o_gg_",
40
- "__SNoticeBubble": "___SNoticeBubble_och9o_gg_",
41
- "_disablePortal": "__disablePortal_och9o_gg_",
42
- "__SNoticeAriaLiveWrapper": "___SNoticeAriaLiveWrapper_och9o_gg_",
43
- "@enter": "enter_och9o",
44
- "@exit": "exit_och9o",
45
- "__SBubble": "___SBubble_och9o_gg_",
46
- "__SView": "___SView_och9o_gg_",
47
- "_type_info": "_type_info_och9o_gg_",
48
- "_type_warning": "_type_warning_och9o_gg_"
34
+ "__SContent": "___SContent_fiqqt_gg_",
35
+ "__SMessage": "___SMessage_fiqqt_gg_",
36
+ "__SDismiss": "___SDismiss_fiqqt_gg_",
37
+ "_use": "__use_fiqqt_gg_",
38
+ "__SIcon": "___SIcon_fiqqt_gg_",
39
+ "__SNoticeBubble": "___SNoticeBubble_fiqqt_gg_",
40
+ "_disablePortal": "__disablePortal_fiqqt_gg_",
41
+ "__SNoticeAriaLiveWrapper": "___SNoticeAriaLiveWrapper_fiqqt_gg_",
42
+ "@enter": "enter_fiqqt",
43
+ "@exit": "exit_fiqqt",
44
+ "__SBubble": "___SBubble_fiqqt_gg_",
45
+ "__SView": "___SView_fiqqt_gg_",
46
+ "_type_info": "_type_info_fiqqt_gg_",
47
+ "_type_warning": "_type_warning_fiqqt_gg_"
49
48
  });
50
49
  import { localizedMessages } from './translations/__intergalactic-dynamic-locales';
51
50
  import { Timer } from './utils';
52
- var Notices = function Notices(props) {
53
- var styles = props.styles,
54
- _props$data = props.data,
55
- data = _props$data === void 0 ? [] : _props$data,
56
- _props$tag = props.tag,
57
- SView = _props$tag === void 0 ? ViewInfo : _props$tag;
58
- var ref = React.useRef();
59
- var durationStr = useCssVariable('--intergalactic-duration-popper', '200', ref);
60
- var duration = React.useMemo(function () {
61
- return Number.parseInt(durationStr, 10);
62
- }, [durationStr]);
63
- return data.map(function (notice) {
64
- var _ref2, _notice$visible;
65
- return _ref2 = sstyled(styles), /*#__PURE__*/React.createElement(Animation, _ref2.cn("Animation", {
66
- "key": notice.uid,
67
- "initialAnimation": notice.initialAnimation,
68
- "visible": (_notice$visible = notice.visible) !== null && _notice$visible !== void 0 ? _notice$visible : true,
69
- "duration": duration,
70
- "keyframes": [styles['@enter'], styles['@exit']],
71
- "ref": ref
72
- }), /*#__PURE__*/React.createElement(SView, _ref2.cn("SView", _objectSpread(_objectSpread({}, notice), {}, {
73
- "styles": notice.styles || styles,
74
- "getI18nText": props.getI18nText
75
- }))));
76
- });
77
- };
78
51
  var NoticeBubbleContainerRoot = /*#__PURE__*/function (_Component) {
79
52
  function NoticeBubbleContainerRoot() {
80
53
  var _this;
@@ -86,6 +59,7 @@ var NoticeBubbleContainerRoot = /*#__PURE__*/function (_Component) {
86
59
  _defineProperty(_this, "_unsubscribe", null);
87
60
  _defineProperty(_this, "state", {
88
61
  notices: [],
62
+ infos: [],
89
63
  warnings: []
90
64
  });
91
65
  _defineProperty(_this, "componentWillUnmount", function () {
@@ -94,16 +68,10 @@ var NoticeBubbleContainerRoot = /*#__PURE__*/function (_Component) {
94
68
  }
95
69
  });
96
70
  _defineProperty(_this, "handleChange", function (notices) {
97
- var info = notices.filter(function (notice) {
98
- return notice.type === 'info';
99
- });
100
- var warning = notices.filter(function (notice) {
101
- return notice.type === 'warning';
102
- });
103
71
  _this.setState({
104
- notices: info,
105
- warnings: warning
72
+ notices: notices
106
73
  });
74
+ _this.forceUpdate(); // need this, because somehow this component doesn't rerender event if the notices are different
107
75
  });
108
76
  return _this;
109
77
  }
@@ -126,10 +94,30 @@ var NoticeBubbleContainerRoot = /*#__PURE__*/function (_Component) {
126
94
  disablePortal = _this$asProps.disablePortal,
127
95
  getI18nText = _this$asProps.getI18nText,
128
96
  ref = _this$asProps.ref,
129
- parentZIndexStacking = _this$asProps.parentZIndexStacking;
130
- var _this$state = this.state,
131
- notices = _this$state.notices,
132
- warnings = _this$state.warnings;
97
+ parentZIndexStacking = _this$asProps.parentZIndexStacking,
98
+ duration = _this$asProps.duration,
99
+ containerNode = _this$asProps.containerNode;
100
+ var notices = this.state.notices;
101
+ if (containerNode) {
102
+ return notices.map(function (notice) {
103
+ var _ref2;
104
+ var SView = notice.type === 'warning' ? ViewWarning : ViewInfo;
105
+ return _ref2 = sstyled(styles), /*#__PURE__*/React.createElement(PortalForNoticeItem, _ref2.cn("PortalForNoticeItem", _objectSpread({
106
+ "key": notice.uid,
107
+ "tag": SView,
108
+ "containerNode": containerNode,
109
+ "animationDuration": duration,
110
+ "styles": styles,
111
+ "getI18nText": getI18nText
112
+ }, notice)));
113
+ });
114
+ }
115
+ var infos = notices.filter(function (notice) {
116
+ return notice.type === 'info';
117
+ });
118
+ var warnings = notices.filter(function (notice) {
119
+ return notice.type === 'warning';
120
+ });
133
121
  return _ref3 = sstyled(styles), /*#__PURE__*/React.createElement(ZIndexStackingContextProvider, _ref3.cn("ZIndexStackingContextProvider", {
134
122
  "designToken": 'z-index-notice-bubble'
135
123
  }), /*#__PURE__*/React.createElement(Portal, _ref3.cn("Portal", {
@@ -140,25 +128,40 @@ var NoticeBubbleContainerRoot = /*#__PURE__*/function (_Component) {
140
128
  "role": 'region',
141
129
  "aria-label": getI18nText('notification'),
142
130
  "zIndex": parentZIndexStacking
143
- }, _ref))), /*#__PURE__*/React.createElement(Children, _ref3.cn("Children", {})), /*#__PURE__*/React.createElement(Notices, _ref3.cn("Notices", {
144
- "styles": styles,
145
- "data": warnings,
146
- "tag": ViewWarning,
147
- "getI18nText": getI18nText
148
- })), /*#__PURE__*/React.createElement(SNoticeAriaLiveWrapper, _ref3.cn("SNoticeAriaLiveWrapper", {
131
+ }, _ref))), /*#__PURE__*/React.createElement(Children, _ref3.cn("Children", {})), warnings.map(function (notice) {
132
+ var _ref4;
133
+ var SView = ViewWarning;
134
+ return _ref4 = sstyled(styles), /*#__PURE__*/React.createElement(SView, _ref4.cn("SView", _objectSpread({
135
+ "key": notice.uid,
136
+ "animationDuration": duration,
137
+ "styles": styles,
138
+ "getI18nText": getI18nText
139
+ }, notice)));
140
+ }), /*#__PURE__*/React.createElement(SNoticeAriaLiveWrapper, _ref3.cn("SNoticeAriaLiveWrapper", {
149
141
  "aria-live": 'polite'
150
- }), /*#__PURE__*/React.createElement(Notices, _ref3.cn("Notices", {
151
- "styles": styles,
152
- "data": notices,
153
- "tag": ViewInfo,
154
- "getI18nText": getI18nText
155
- }))))));
142
+ }), infos.map(function (notice) {
143
+ var _ref5;
144
+ var SView = ViewInfo;
145
+ return _ref5 = sstyled(styles), /*#__PURE__*/React.createElement(SView, _ref5.cn("SView", _objectSpread({
146
+ "key": notice.uid,
147
+ "animationDuration": duration,
148
+ "styles": styles,
149
+ "getI18nText": getI18nText
150
+ }, notice)));
151
+ })))));
156
152
  }
157
153
  }]);
158
154
  }(Component);
159
155
  _defineProperty(NoticeBubbleContainerRoot, "displayName", 'NoticeBubbleContainer');
160
156
  _defineProperty(NoticeBubbleContainerRoot, "style", style);
161
- _defineProperty(NoticeBubbleContainerRoot, "enhance", [i18nEnhance(localizedMessages), contextThemeEnhance(), zIndexStackingEnhance('z-index-notice-bubble')]);
157
+ _defineProperty(NoticeBubbleContainerRoot, "enhance", [i18nEnhance(localizedMessages), contextThemeEnhance(), zIndexStackingEnhance('z-index-notice-bubble'), cssVariableEnhance({
158
+ variable: '--intergalactic-duration-popper',
159
+ fallback: 200,
160
+ map: function map(v) {
161
+ return Number.parseInt(v, 10);
162
+ },
163
+ prop: 'duration'
164
+ })]);
162
165
  _defineProperty(NoticeBubbleContainerRoot, "defaultProps", {
163
166
  manager: manager,
164
167
  i18n: localizedMessages,
@@ -167,13 +170,42 @@ _defineProperty(NoticeBubbleContainerRoot, "defaultProps", {
167
170
  var FocusLock = /*#__PURE__*/React.forwardRef(function (props, outerRef) {
168
171
  var focusLock = props.focusLock,
169
172
  other = _objectWithoutProperties(props, _excluded);
170
- var innerRef = React.useRef();
173
+ var innerRef = React.useRef(null);
171
174
  useFocusLock(innerRef, false, 'auto', !focusLock, true);
172
175
  var ref = useForkRef(outerRef, innerRef);
173
176
  return /*#__PURE__*/React.createElement(Flex, _extends({
174
177
  ref: ref
175
178
  }, other));
176
179
  });
180
+ var PortalForNoticeItem = function PortalForNoticeItem(props) {
181
+ var _React$useState = React.useState(false),
182
+ _React$useState2 = _slicedToArray(_React$useState, 2),
183
+ showContent = _React$useState2[0],
184
+ setShowContent = _React$useState2[1];
185
+
186
+ // Show content for info notice in previously mounted node with aria-live polite
187
+ React.useEffect(function () {
188
+ setTimeout(function () {
189
+ setShowContent(true);
190
+ }, 200);
191
+ }, []);
192
+ var SNoticeAriaLiveWrapper = 'div';
193
+ var Tag = props.tag;
194
+ if (props.type === 'info') {
195
+ return /*#__PURE__*/React.createElement(ZIndexStackingContextProvider, {
196
+ designToken: "z-index-notice-bubble"
197
+ }, /*#__PURE__*/React.createElement(Portal, {
198
+ nodeToMount: props.containerNode
199
+ }, /*#__PURE__*/React.createElement(SNoticeAriaLiveWrapper, {
200
+ "aria-live": "polite"
201
+ }, showContent && /*#__PURE__*/React.createElement(Tag, props))));
202
+ }
203
+ return /*#__PURE__*/React.createElement(ZIndexStackingContextProvider, {
204
+ designToken: "z-index-notice-bubble"
205
+ }, /*#__PURE__*/React.createElement(Portal, {
206
+ nodeToMount: props.containerNode
207
+ }, /*#__PURE__*/React.createElement(Tag, props)));
208
+ };
177
209
  var ViewInfo = /*#__PURE__*/function (_Component2) {
178
210
  function ViewInfo() {
179
211
  var _this2;
@@ -204,9 +236,10 @@ var ViewInfo = /*#__PURE__*/function (_Component2) {
204
236
  _this2.timer.resume();
205
237
  });
206
238
  _defineProperty(_this2, "handleBodyMouseMove", function (event) {
207
- var _this2$timer;
239
+ var _this2$timer, _this2$ref$current;
208
240
  if (!((_this2$timer = _this2.timer) !== null && _this2$timer !== void 0 && _this2$timer.paused)) return;
209
- var rect = _this2.ref.current.getBoundingClientRect();
241
+ var rect = (_this2$ref$current = _this2.ref.current) === null || _this2$ref$current === void 0 ? void 0 : _this2$ref$current.getBoundingClientRect();
242
+ if (!rect) return;
210
243
  var mouseInRect = event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
211
244
  if (mouseInRect) return;
212
245
  _this2.timer.resume();
@@ -252,7 +285,7 @@ var ViewInfo = /*#__PURE__*/function (_Component2) {
252
285
  }, {
253
286
  key: "render",
254
287
  value: function render() {
255
- var _ref4;
288
+ var _ref6;
256
289
  var SBubble = FocusLock;
257
290
  var SDismiss = Button;
258
291
  var SContent = Flex;
@@ -260,23 +293,30 @@ var ViewInfo = /*#__PURE__*/function (_Component2) {
260
293
  var SAction = 'div';
261
294
  var SIcon = Flex;
262
295
  var _this$props = this.props,
263
- forwardRef = _this$props.forwardRef,
264
296
  styles = _this$props.styles,
265
- onMouseEnter = _this$props.onMouseEnter,
266
- onMouseLeave = _this$props.onMouseLeave,
267
297
  getI18nText = _this$props.getI18nText,
298
+ visible = _this$props.visible,
299
+ type = _this$props.type,
300
+ initialAnimation = _this$props.initialAnimation,
301
+ animationDuration = _this$props.animationDuration,
268
302
  icon = _this$props.icon,
269
303
  children = _this$props.children,
270
- actionNode = _this$props.action,
271
- type = _this$props.type,
272
- other = _objectWithoutProperties(_this$props, _excluded2);
273
- return _ref4 = sstyled(styles), /*#__PURE__*/React.createElement(SBubble, _ref4.cn("SBubble", _objectSpread(_objectSpread({}, other), {}, {
274
- "ref": forkRef(forwardRef, this.ref),
275
- "onMouseEnter": callAllEventHandlers(onMouseEnter, this.handleMouseEnter),
276
- "onMouseLeave": callAllEventHandlers(onMouseLeave, this.handleMouseLeave),
304
+ action = _this$props.action,
305
+ focusLock = _this$props.focusLock;
306
+ return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(Animation, _ref6.cn("Animation", {
307
+ "initialAnimation": initialAnimation,
308
+ "visible": visible !== null && visible !== void 0 ? visible : true,
309
+ "duration": animationDuration,
310
+ "keyframes": [styles['@enter'], styles['@exit']]
311
+ }), /*#__PURE__*/React.createElement(SBubble, _ref6.cn("SBubble", {
312
+ "type": type,
313
+ "ref": this.ref,
314
+ "onMouseEnter": this.handleMouseEnter,
315
+ "onMouseLeave": this.handleMouseLeave,
277
316
  "onKeyDown": this.handleKeydown,
278
- "role": type === 'warning' ? 'alert' : this.props.role
279
- })), /*#__PURE__*/React.createElement(SDismiss, _ref4.cn("SDismiss", {
317
+ "role": type === 'warning' ? 'alert' : undefined,
318
+ "focusLock": focusLock
319
+ }), /*#__PURE__*/React.createElement(SDismiss, _ref6.cn("SDismiss", {
280
320
  "aria-haspopup": undefined,
281
321
  "type": 'button',
282
322
  "use": 'tertiary',
@@ -291,7 +331,7 @@ var ViewInfo = /*#__PURE__*/function (_Component2) {
291
331
  }), /*#__PURE__*/React.createElement(Button.Addon, {
292
332
  tag: CloseIcon,
293
333
  color: "icon-primary-invert"
294
- })), isNode(icon) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SIcon, _ref4.cn("SIcon", {}), icon), /*#__PURE__*/React.createElement(SContent, _ref4.cn("SContent", {}), /*#__PURE__*/React.createElement(SMessage, _ref4.cn("SMessage", {}), children), isNode(actionNode) ? /*#__PURE__*/React.createElement(SAction, _ref4.cn("SAction", {}), actionNode) : null)) : /*#__PURE__*/React.createElement(SContent, _ref4.cn("SContent", {}), /*#__PURE__*/React.createElement(SMessage, _ref4.cn("SMessage", {}), children), isNode(actionNode) ? /*#__PURE__*/React.createElement(SAction, _ref4.cn("SAction", {}), actionNode) : null));
334
+ })), isNode(icon) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SIcon, _ref6.cn("SIcon", {}), icon), /*#__PURE__*/React.createElement(SContent, _ref6.cn("SContent", {}), /*#__PURE__*/React.createElement(SMessage, _ref6.cn("SMessage", {}), children), isNode(action) ? /*#__PURE__*/React.createElement(SAction, _ref6.cn("SAction", {}), action) : null)) : /*#__PURE__*/React.createElement(SContent, _ref6.cn("SContent", {}), /*#__PURE__*/React.createElement(SMessage, _ref6.cn("SMessage", {}), children), isNode(action) ? /*#__PURE__*/React.createElement(SAction, _ref6.cn("SAction", {}), action) : null)));
295
335
  }
296
336
  }]);
297
337
  }(Component);