@semcore/notice-bubble 5.54.0 → 5.54.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.
@@ -1,91 +1,122 @@
1
- import s from "@babel/runtime/helpers/esm/objectSpread2";
2
- import f from "@babel/runtime/helpers/esm/classCallCheck";
3
- import c from "@babel/runtime/helpers/esm/createClass";
4
- import u from "@babel/runtime/helpers/esm/defineProperty";
5
- import l from "@semcore/utils/lib/eventEmitter";
6
- import { callAllEventHandlers as h } from "@semcore/utils/lib/assignProps";
7
- import { setFocus as d } from "@semcore/utils/lib/use/useFocusLock";
8
- import v from "react";
9
- var m = "CHANGE", p = /* @__PURE__ */ function() {
10
- function a() {
11
- f(this, a), u(this, "items", []), u(this, "emitter", null), u(this, "counter", 0), u(this, "replaceTimer", 0), this.emitter = new l();
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
4
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
5
+ import EventEmitter from "@semcore/utils/lib/eventEmitter";
6
+ import { callAllEventHandlers } from "@semcore/utils/lib/assignProps";
7
+ import { setFocus } from "@semcore/utils/lib/use/useFocusLock";
8
+ import React from "react";
9
+ var EVENT_NAME = "CHANGE";
10
+ var NoticeBubbleManager = /* @__PURE__ */ function() {
11
+ function NoticeBubbleManager2() {
12
+ _classCallCheck(this, NoticeBubbleManager2);
13
+ _defineProperty(this, "items", []);
14
+ _defineProperty(this, "emitter", null);
15
+ _defineProperty(this, "counter", 0);
16
+ _defineProperty(this, "replaceTimer", 0);
17
+ this.emitter = new EventEmitter();
12
18
  }
13
- return c(a, [{
19
+ _createClass(NoticeBubbleManager2, [{
14
20
  key: "addListener",
15
- value: function(e) {
16
- return this.emitter.subscribe(m, e);
21
+ value: function addListener(fn) {
22
+ return this.emitter.subscribe(EVENT_NAME, fn);
17
23
  }
18
24
  }, {
19
25
  key: "createItem",
20
- value: function(e) {
21
- var t = this;
22
- return s(s({
26
+ value: function createItem(props) {
27
+ var manager = this;
28
+ return _objectSpread(_objectSpread({
23
29
  type: "info"
24
- }, e), {}, {
25
- onClose: h(e.onClose, function() {
26
- t.remove(e.uid);
30
+ }, props), {}, {
31
+ onClose: callAllEventHandlers(props.onClose, function() {
32
+ manager.remove(props.uid);
27
33
  })
28
34
  });
29
35
  }
30
36
  }, {
31
37
  key: "emit",
32
- value: function() {
33
- this.emitter.emit(m, this.items);
38
+ value: function emit() {
39
+ this.emitter.emit(EVENT_NAME, this.items);
34
40
  }
35
41
  }, {
36
42
  key: "add",
37
- value: function(e) {
38
- var t = this.counter++, i = /* @__PURE__ */ v.createRef(), r = function() {
43
+ value: function add(props) {
44
+ var uid = this.counter++;
45
+ var ref = /* @__PURE__ */ React.createRef();
46
+ var focus = function focus2() {
39
47
  return setTimeout(function() {
40
- return d(i.current);
48
+ return setFocus(ref.current);
41
49
  }, 0);
42
- }, o = this.createItem(s({
43
- uid: t,
44
- visible: e.initialAnimation ? !0 : void 0,
45
- forwardRef: i
46
- }, e));
47
- return this.items.push(o), this.emit(), {
48
- uid: t,
49
- update: this.update.bind(this, t),
50
- remove: this.remove.bind(this, t),
51
- ref: i,
50
+ };
51
+ var item = this.createItem(_objectSpread({
52
+ uid,
53
+ visible: props.initialAnimation ? true : void 0,
54
+ forwardRef: ref
55
+ }, props));
56
+ this.items.push(item);
57
+ this.emit();
58
+ return {
59
+ uid,
60
+ update: this.update.bind(this, uid),
61
+ remove: this.remove.bind(this, uid),
62
+ ref,
52
63
  // todo Brauer Ilia: remove this property, because we added logic about autofocus in Notice
53
- focus: r
64
+ focus
54
65
  };
55
66
  }
56
67
  }, {
57
68
  key: "update",
58
- value: function(e, t) {
59
- var i = this.items.findIndex(function(r) {
60
- return r.uid === e;
69
+ value: function update(uid, props) {
70
+ var index = this.items.findIndex(function(item) {
71
+ return item.uid === uid;
61
72
  });
62
- return i !== -1 ? (this.items[i] = this.createItem(s(s({}, this.items[i]), t)), this.emit(), !0) : !1;
73
+ if (index !== -1) {
74
+ this.items[index] = this.createItem(_objectSpread(_objectSpread({}, this.items[index]), props));
75
+ this.emit();
76
+ return true;
77
+ }
78
+ return false;
63
79
  }
64
80
  }, {
65
81
  key: "replaceLast",
66
- value: function(e) {
67
- var t = this;
68
- this.replaceTimer && clearTimeout(this.replaceTimer);
69
- var i = this.items[this.items.length - 1];
70
- i != null && i.visible && this.remove(this.counter - 1), this.replaceTimer = setTimeout(function() {
71
- t.add(e);
82
+ value: function replaceLast(props) {
83
+ var _this = this;
84
+ if (this.replaceTimer) {
85
+ clearTimeout(this.replaceTimer);
86
+ }
87
+ var item = this.items[this.items.length - 1];
88
+ if (item !== null && item !== void 0 && item.visible) {
89
+ this.remove(this.counter - 1);
90
+ }
91
+ this.replaceTimer = setTimeout(function() {
92
+ _this.add(props);
72
93
  }, 300);
73
94
  }
74
95
  }, {
75
96
  key: "remove",
76
- value: function(e) {
77
- var t = this, i = this.items.find(function(r) {
78
- return r.uid === e;
97
+ value: function remove(uid) {
98
+ var _this2 = this;
99
+ var item = this.items.find(function(item2) {
100
+ return item2.uid === uid;
79
101
  });
80
- return i ? (i.visible = !1, setTimeout(function() {
81
- t.items = t.items.filter(function(r) {
82
- return r.uid !== e;
83
- }), t.emit();
84
- }, 1e3), this.emit(), !0) : !1;
102
+ if (item) {
103
+ item.visible = false;
104
+ setTimeout(function() {
105
+ _this2.items = _this2.items.filter(function(item2) {
106
+ return item2.uid !== uid;
107
+ });
108
+ _this2.emit();
109
+ }, 1e3);
110
+ this.emit();
111
+ return true;
112
+ }
113
+ return false;
85
114
  }
86
- }]), a;
87
- }(), N = new p();
115
+ }]);
116
+ return NoticeBubbleManager2;
117
+ }();
118
+ var noticeBubbleDefaultManager = new NoticeBubbleManager();
88
119
  export {
89
- p as NoticeBubbleManager,
90
- N as default
120
+ NoticeBubbleManager,
121
+ noticeBubbleDefaultManager as default
91
122
  };
package/lib/esm/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
- import { NoticeBubble as r, default as b, NoticeBubbleWarning as i } from "./NoticeBubble.mjs";
2
- import o from "./NoticeBubbleManager.mjs";
3
- import { NoticeBubbleManager as u } from "./NoticeBubbleManager.mjs";
1
+ import { NoticeBubble, default as default2, NoticeBubbleWarning } from "./NoticeBubble.mjs";
2
+ import noticeBubbleDefaultManager from "./NoticeBubbleManager.mjs";
3
+ import { NoticeBubbleManager } from "./NoticeBubbleManager.mjs";
4
4
  export {
5
- r as NoticeBubble,
6
- b as NoticeBubbleContainer,
7
- u as NoticeBubbleManager,
8
- i as NoticeBubbleWarning,
9
- o as default,
10
- o as noticeBubbleDefaultManager
5
+ NoticeBubble,
6
+ default2 as NoticeBubbleContainer,
7
+ NoticeBubbleManager,
8
+ NoticeBubbleWarning,
9
+ noticeBubbleDefaultManager as default,
10
+ noticeBubbleDefaultManager
11
11
  };
@@ -0,0 +1,107 @@
1
+ SBubble,
2
+ SView {
3
+ position: relative;
4
+ margin-bottom: var(--intergalactic-spacing-3x, 12px);
5
+ padding: var(--intergalactic-spacing-3x, 12px);
6
+ padding-right: calc(var(--intergalactic-spacing-8x, 32px) + var(--intergalactic-spacing-1x, 4px));
7
+ width: 100%;
8
+ border-radius: var(--intergalactic-popper-rounded, 6px);
9
+ overflow: hidden;
10
+ box-sizing: border-box;
11
+ color: var(--intergalactic-text-primary-invert, #ffffff);
12
+ gap: var(--intergalactic-spacing-2x, 8px);
13
+
14
+ &[type='info'] {
15
+ background: var(--intergalactic-bg-primary-invert, #191b23);
16
+ }
17
+
18
+ &[type='warning'] {
19
+ background: var(--intergalactic-bg-primary-critical, #ff4953);
20
+ }
21
+ }
22
+
23
+ SContent {
24
+ flex-direction: column;
25
+ gap: var(--intergalactic-spacing-2x, 8px);
26
+ flex: 1;
27
+ }
28
+
29
+ SMessage {
30
+ font-size: var(--intergalactic-fs-200, 14px);
31
+ line-height: var(--intergalactic-lh-200, 142%);
32
+ }
33
+
34
+ SDismiss {
35
+ cursor: pointer;
36
+ position: absolute;
37
+ right: 0;
38
+ top: 0;
39
+ margin-top: var(--intergalactic-spacing-2x, 8px);
40
+ margin-right: var(--intergalactic-spacing-2x, 8px);
41
+ margin-bottom: var(--intergalactic-spacing-2x, 8px);
42
+ flex-shrink: 0;
43
+ border: 0;
44
+ background: transparent;
45
+ }
46
+ SDismiss[use] {
47
+ /* height: auto; */
48
+ padding: 0 1px;
49
+ }
50
+ SIcon {
51
+ justify-content: center;
52
+ align-items: center;
53
+ height: var(--intergalactic-spacing-5x, 20px);
54
+ }
55
+
56
+ SNoticeBubble {
57
+ width: 300px;
58
+ position: fixed;
59
+ right: var(--intergalactic-spacing-3x, 12px);
60
+ top: var(--intergalactic-spacing-3x, 12px);
61
+
62
+ @media (max-width: 767px) {
63
+ width: calc(100% - var(--intergalactic-spacing-6x, 24px));
64
+ }
65
+ }
66
+
67
+ SNoticeBubble[disablePortal] {
68
+ position: sticky;
69
+ margin-left: auto;
70
+ height: 0;
71
+ }
72
+
73
+ SMessage a {
74
+ color: var(--intergalactic-text-link-invert, #8ecdff);
75
+ }
76
+
77
+ SNoticeAriaLiveWrapper {
78
+ display: contents;
79
+ }
80
+
81
+ @keyframes enter {
82
+ from {
83
+ transform: translate(100%, 0);
84
+ max-height: 0;
85
+ overflow: hidden;
86
+ }
87
+
88
+ to {
89
+ transform: translate(0, 0);
90
+ max-height: 100vh;
91
+ overflow: hidden;
92
+ }
93
+ }
94
+
95
+ @keyframes exit {
96
+ from {
97
+ max-height: 100vh;
98
+ overflow: hidden;
99
+ opacity: 1;
100
+ }
101
+
102
+ to {
103
+ max-height: 0;
104
+ overflow: hidden;
105
+ opacity: 0;
106
+ }
107
+ }
@@ -1,33 +1,33 @@
1
- import r from "./de.json.mjs";
2
- import o from "./en.json.mjs";
3
- import m from "./es.json.mjs";
4
- import t from "./fr.json.mjs";
5
- import i from "./it.json.mjs";
6
- import p from "./ja.json.mjs";
7
- import f from "./ko.json.mjs";
8
- import e from "./nl.json.mjs";
9
- import s from "./pt.json.mjs";
10
- import a from "./tr.json.mjs";
11
- import l from "./vi.json.mjs";
12
- import v from "./zh.json.mjs";
13
- import d from "./pl.json.mjs";
14
- import n from "./sv.json.mjs";
15
- var B = {
16
- de: r,
17
- en: o,
18
- es: m,
19
- fr: t,
20
- it: i,
21
- ja: p,
22
- ko: f,
23
- nl: e,
24
- pt: s,
25
- tr: a,
26
- vi: l,
27
- zh: v,
28
- pl: d,
29
- sv: n
1
+ import de from "./de.json.mjs";
2
+ import en from "./en.json.mjs";
3
+ import es from "./es.json.mjs";
4
+ import fr from "./fr.json.mjs";
5
+ import it from "./it.json.mjs";
6
+ import ja from "./ja.json.mjs";
7
+ import ko from "./ko.json.mjs";
8
+ import nl from "./nl.json.mjs";
9
+ import pt from "./pt.json.mjs";
10
+ import tr from "./tr.json.mjs";
11
+ import vi from "./vi.json.mjs";
12
+ import zh from "./zh.json.mjs";
13
+ import pl from "./pl.json.mjs";
14
+ import sv from "./sv.json.mjs";
15
+ var localizedMessages = {
16
+ de,
17
+ en,
18
+ es,
19
+ fr,
20
+ it,
21
+ ja,
22
+ ko,
23
+ nl,
24
+ pt,
25
+ tr,
26
+ vi,
27
+ zh,
28
+ pl,
29
+ sv
30
30
  };
31
31
  export {
32
- B as localizedMessages
32
+ localizedMessages
33
33
  };
@@ -1,9 +1,11 @@
1
- const n = "Schließen", c = "Benachrichtigungen", o = {
2
- close: n,
3
- notification: c
1
+ const close = "Schließen";
2
+ const notification = "Benachrichtigungen";
3
+ const de = {
4
+ close,
5
+ notification
4
6
  };
5
7
  export {
6
- n as close,
7
- o as default,
8
- c as notification
8
+ close,
9
+ de as default,
10
+ notification
9
11
  };
@@ -1,9 +1,11 @@
1
- const o = "Close", t = "Notifications", i = {
2
- close: o,
3
- notification: t
1
+ const close = "Close";
2
+ const notification = "Notifications";
3
+ const en = {
4
+ close,
5
+ notification
4
6
  };
5
7
  export {
6
- o as close,
7
- i as default,
8
- t as notification
8
+ close,
9
+ en as default,
10
+ notification
9
11
  };
@@ -1,9 +1,11 @@
1
- const o = "Cerrar", t = "Notificaciones", c = {
2
- close: o,
3
- notification: t
1
+ const close = "Cerrar";
2
+ const notification = "Notificaciones";
3
+ const es = {
4
+ close,
5
+ notification
4
6
  };
5
7
  export {
6
- o as close,
7
- c as default,
8
- t as notification
8
+ close,
9
+ es as default,
10
+ notification
9
11
  };
@@ -1,9 +1,11 @@
1
- const o = "Fermer", t = "Notifications", i = {
2
- close: o,
3
- notification: t
1
+ const close = "Fermer";
2
+ const notification = "Notifications";
3
+ const fr = {
4
+ close,
5
+ notification
4
6
  };
5
7
  export {
6
- o as close,
7
- i as default,
8
- t as notification
8
+ close,
9
+ fr as default,
10
+ notification
9
11
  };
@@ -1,9 +1,11 @@
1
- const i = "Chiudi", o = "Notifiche", t = {
2
- close: i,
3
- notification: o
1
+ const close = "Chiudi";
2
+ const notification = "Notifiche";
3
+ const it = {
4
+ close,
5
+ notification
4
6
  };
5
7
  export {
6
- i as close,
7
- t as default,
8
- o as notification
8
+ close,
9
+ it as default,
10
+ notification
9
11
  };
@@ -1,9 +1,11 @@
1
- const o = "閉じる", t = "通知", c = {
2
- close: o,
3
- notification: t
1
+ const close = "閉じる";
2
+ const notification = "通知";
3
+ const ja = {
4
+ close,
5
+ notification
4
6
  };
5
7
  export {
6
- o as close,
7
- c as default,
8
- t as notification
8
+ close,
9
+ ja as default,
10
+ notification
9
11
  };
@@ -1,9 +1,11 @@
1
- const o = "닫기", t = "알림", c = {
2
- close: o,
3
- notification: t
1
+ const close = "닫기";
2
+ const notification = "알림";
3
+ const ko = {
4
+ close,
5
+ notification
4
6
  };
5
7
  export {
6
- o as close,
7
- c as default,
8
- t as notification
8
+ close,
9
+ ko as default,
10
+ notification
9
11
  };
@@ -1,9 +1,11 @@
1
- const n = "Sluiten", o = "Meldingen", t = {
2
- close: n,
3
- notification: o
1
+ const close = "Sluiten";
2
+ const notification = "Meldingen";
3
+ const nl = {
4
+ close,
5
+ notification
4
6
  };
5
7
  export {
6
- n as close,
7
- t as default,
8
- o as notification
8
+ close,
9
+ nl as default,
10
+ notification
9
11
  };
@@ -1,9 +1,11 @@
1
- const o = "Zamknij", i = "Powiadomienia", n = {
2
- close: o,
3
- notification: i
1
+ const close = "Zamknij";
2
+ const notification = "Powiadomienia";
3
+ const pl = {
4
+ close,
5
+ notification
4
6
  };
5
7
  export {
6
- o as close,
7
- n as default,
8
- i as notification
8
+ close,
9
+ pl as default,
10
+ notification
9
11
  };
@@ -1,9 +1,11 @@
1
- const o = "Fechar", t = "Notificações", c = {
2
- close: o,
3
- notification: t
1
+ const close = "Fechar";
2
+ const notification = "Notificações";
3
+ const pt = {
4
+ close,
5
+ notification
4
6
  };
5
7
  export {
6
- o as close,
7
- c as default,
8
- t as notification
8
+ close,
9
+ pt as default,
10
+ notification
9
11
  };
@@ -1,9 +1,11 @@
1
- const o = "Stäng", t = "Aviseringar", n = {
2
- close: o,
3
- notification: t
1
+ const close = "Stäng";
2
+ const notification = "Aviseringar";
3
+ const sv = {
4
+ close,
5
+ notification
4
6
  };
5
7
  export {
6
- o as close,
7
- n as default,
8
- t as notification
8
+ close,
9
+ sv as default,
10
+ notification
9
11
  };
@@ -1,9 +1,11 @@
1
- const t = "Kapat", o = "Bildirimler", i = {
2
- close: t,
3
- notification: o
1
+ const close = "Kapat";
2
+ const notification = "Bildirimler";
3
+ const tr = {
4
+ close,
5
+ notification
4
6
  };
5
7
  export {
6
- t as close,
7
- i as default,
8
- o as notification
8
+ close,
9
+ tr as default,
10
+ notification
9
11
  };
@@ -1,9 +1,11 @@
1
- const o = "Đóng", n = "Thông báo", t = {
2
- close: o,
3
- notification: n
1
+ const close = "Đóng";
2
+ const notification = "Thông báo";
3
+ const vi = {
4
+ close,
5
+ notification
4
6
  };
5
7
  export {
6
- o as close,
7
- t as default,
8
- n as notification
8
+ close,
9
+ vi as default,
10
+ notification
9
11
  };
@@ -1,9 +1,11 @@
1
- const o = "关闭", t = "通知", c = {
2
- close: o,
3
- notification: t
1
+ const close = "关闭";
2
+ const notification = "通知";
3
+ const zh = {
4
+ close,
5
+ notification
4
6
  };
5
7
  export {
6
- o as close,
7
- c as default,
8
- t as notification
8
+ close,
9
+ zh as default,
10
+ notification
9
11
  };