@semcore/notice-bubble 5.55.0-prerelease.4 → 5.55.0-prerelease.5

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.
Files changed (40) hide show
  1. package/lib/cjs/NoticeBubble.js +177 -217
  2. package/lib/cjs/NoticeBubble.js.map +1 -1
  3. package/lib/cjs/NoticeBubble.type.js +2 -0
  4. package/lib/cjs/NoticeBubble.type.js.map +1 -0
  5. package/lib/cjs/NoticeBubbleManager.js +34 -56
  6. package/lib/cjs/NoticeBubbleManager.js.map +1 -1
  7. package/lib/cjs/index.js +1 -4
  8. package/lib/cjs/index.js.map +1 -1
  9. package/lib/cjs/translations/__intergalactic-dynamic-locales.js +4 -5
  10. package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
  11. package/lib/cjs/utils.js +20 -9
  12. package/lib/cjs/utils.js.map +1 -1
  13. package/lib/es6/NoticeBubble.js +170 -207
  14. package/lib/es6/NoticeBubble.js.map +1 -1
  15. package/lib/es6/NoticeBubble.type.js +2 -0
  16. package/lib/es6/NoticeBubble.type.js.map +1 -0
  17. package/lib/es6/NoticeBubbleManager.js +31 -51
  18. package/lib/es6/NoticeBubbleManager.js.map +1 -1
  19. package/lib/es6/index.js +1 -2
  20. package/lib/es6/index.js.map +1 -1
  21. package/lib/es6/translations/__intergalactic-dynamic-locales.js +2 -2
  22. package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
  23. package/lib/es6/utils.js +18 -6
  24. package/lib/es6/utils.js.map +1 -1
  25. package/lib/esm/NoticeBubble.mjs +175 -215
  26. package/lib/esm/NoticeBubbleManager.mjs +33 -53
  27. package/lib/esm/index.mjs +3 -7
  28. package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
  29. package/lib/esm/utils.mjs +20 -8
  30. package/lib/types/NoticeBubble.d.ts +4 -0
  31. package/lib/types/NoticeBubble.type.d.ts +91 -0
  32. package/lib/types/NoticeBubbleManager.d.ts +22 -0
  33. package/lib/types/index.d.ts +7 -167
  34. package/lib/types/translations/__intergalactic-dynamic-locales.d.ts +58 -0
  35. package/lib/types/utils.d.ts +14 -0
  36. package/package.json +9 -9
  37. package/lib/cjs/index.d.js +0 -2
  38. package/lib/cjs/index.d.js.map +0 -1
  39. package/lib/es6/index.d.js +0 -2
  40. package/lib/es6/index.d.js.map +0 -1
@@ -2,37 +2,22 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/esm/createClass";
4
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";
5
+ import { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
6
+ import EventEmitter from "@semcore/core/lib/utils/eventEmitter";
8
7
  import React from "react";
9
8
  var EVENT_NAME = "CHANGE";
10
- var NoticeBubbleManager = /* @__PURE__ */ function() {
9
+ var NoticeBubbleManager = /* @__PURE__ */ (function() {
11
10
  function NoticeBubbleManager2() {
12
11
  _classCallCheck(this, NoticeBubbleManager2);
13
12
  _defineProperty(this, "items", []);
14
- _defineProperty(this, "emitter", null);
13
+ _defineProperty(this, "emitter", new EventEmitter());
15
14
  _defineProperty(this, "counter", 0);
16
- _defineProperty(this, "replaceTimer", 0);
17
- this.emitter = new EventEmitter();
18
15
  }
19
- _createClass(NoticeBubbleManager2, [{
16
+ return _createClass(NoticeBubbleManager2, [{
20
17
  key: "addListener",
21
18
  value: function addListener(fn) {
22
19
  return this.emitter.subscribe(EVENT_NAME, fn);
23
20
  }
24
- }, {
25
- key: "createItem",
26
- value: function createItem(props) {
27
- var manager = this;
28
- return _objectSpread(_objectSpread({
29
- type: "info"
30
- }, props), {}, {
31
- onClose: callAllEventHandlers(props.onClose, function() {
32
- manager.remove(props.uid);
33
- })
34
- });
35
- }
36
21
  }, {
37
22
  key: "emit",
38
23
  value: function emit() {
@@ -41,71 +26,67 @@ var NoticeBubbleManager = /* @__PURE__ */ function() {
41
26
  }, {
42
27
  key: "add",
43
28
  value: function add(props) {
29
+ var _this = this;
44
30
  var uid = this.counter++;
45
31
  var ref = /* @__PURE__ */ React.createRef();
46
- var focus = function focus2() {
47
- return setTimeout(function() {
48
- return setFocus(ref.current);
49
- }, 0);
50
- };
51
- var item = this.createItem(_objectSpread({
32
+ var item = _objectSpread(_objectSpread({
33
+ type: "info",
52
34
  uid,
53
35
  visible: props.initialAnimation ? true : void 0,
54
36
  forwardRef: ref
55
- }, props));
37
+ }, props), {}, {
38
+ onClose: callAllEventHandlers(props.onClose, function() {
39
+ _this.remove(uid);
40
+ })
41
+ });
56
42
  this.items.push(item);
57
43
  this.emit();
58
44
  return {
59
45
  uid,
60
- update: this.update.bind(this, uid),
46
+ update: this.replace.bind(this, uid),
61
47
  remove: this.remove.bind(this, uid),
62
- ref,
63
- // todo Brauer Ilia: remove this property, because we added logic about autofocus in Notice
64
- focus
48
+ ref
65
49
  };
66
50
  }
67
51
  }, {
68
- key: "update",
69
- value: function update(uid, props) {
70
- var index = this.items.findIndex(function(item) {
71
- return item.uid === uid;
52
+ key: "replace",
53
+ value: function replace(uid, props) {
54
+ var _this2 = this;
55
+ this.remove(uid);
56
+ return new Promise(function(resolve) {
57
+ setTimeout(function() {
58
+ resolve(_this2.add(props));
59
+ }, 300);
72
60
  });
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;
79
61
  }
80
62
  }, {
81
63
  key: "replaceLast",
82
64
  value: function replaceLast(props) {
83
- var _this = this;
84
- if (this.replaceTimer) {
85
- clearTimeout(this.replaceTimer);
86
- }
65
+ var _this3 = this;
87
66
  var item = this.items[this.items.length - 1];
88
67
  if (item !== null && item !== void 0 && item.visible) {
89
68
  this.remove(this.counter - 1);
90
69
  }
91
- this.replaceTimer = setTimeout(function() {
92
- _this.add(props);
93
- }, 300);
70
+ return new Promise(function(resolve) {
71
+ setTimeout(function() {
72
+ resolve(_this3.add(props));
73
+ }, 300);
74
+ });
94
75
  }
95
76
  }, {
96
77
  key: "remove",
97
78
  value: function remove(uid) {
98
- var _this2 = this;
79
+ var _this4 = this;
99
80
  var item = this.items.find(function(item2) {
100
81
  return item2.uid === uid;
101
82
  });
102
83
  if (item) {
103
84
  item.visible = false;
104
85
  setTimeout(function() {
105
- _this2.items = _this2.items.filter(function(item2) {
86
+ _this4.items = _this4.items.filter(function(item2) {
106
87
  return item2.uid !== uid;
107
88
  });
108
- _this2.emit();
89
+ _this4.emit();
109
90
  }, 1e3);
110
91
  this.emit();
111
92
  return true;
@@ -113,8 +94,7 @@ var NoticeBubbleManager = /* @__PURE__ */ function() {
113
94
  return false;
114
95
  }
115
96
  }]);
116
- return NoticeBubbleManager2;
117
- }();
97
+ })();
118
98
  var noticeBubbleDefaultManager = new NoticeBubbleManager();
119
99
  export {
120
100
  NoticeBubbleManager,
package/lib/esm/index.mjs CHANGED
@@ -1,11 +1,7 @@
1
- import { NoticeBubble, default as default2, NoticeBubbleWarning } from "./NoticeBubble.mjs";
2
- import noticeBubbleDefaultManager from "./NoticeBubbleManager.mjs";
3
- import { NoticeBubbleManager } from "./NoticeBubbleManager.mjs";
1
+ import { default as default2 } from "./NoticeBubble.mjs";
2
+ import { NoticeBubbleManager, default as default3 } from "./NoticeBubbleManager.mjs";
4
3
  export {
5
- NoticeBubble,
6
4
  default2 as NoticeBubbleContainer,
7
5
  NoticeBubbleManager,
8
- NoticeBubbleWarning,
9
- noticeBubbleDefaultManager as default,
10
- noticeBubbleDefaultManager
6
+ default3 as noticeBubbleDefaultManager
11
7
  };
@@ -6,12 +6,12 @@ import it from "./it.json.mjs";
6
6
  import ja from "./ja.json.mjs";
7
7
  import ko from "./ko.json.mjs";
8
8
  import nl from "./nl.json.mjs";
9
+ import pl from "./pl.json.mjs";
9
10
  import pt from "./pt.json.mjs";
11
+ import sv from "./sv.json.mjs";
10
12
  import tr from "./tr.json.mjs";
11
13
  import vi from "./vi.json.mjs";
12
14
  import zh from "./zh.json.mjs";
13
- import pl from "./pl.json.mjs";
14
- import sv from "./sv.json.mjs";
15
15
  var localizedMessages = {
16
16
  de,
17
17
  en,
package/lib/esm/utils.mjs CHANGED
@@ -1,18 +1,27 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- var Timer = /* @__PURE__ */ function() {
3
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
+ var Timer = /* @__PURE__ */ (function() {
4
5
  function Timer2(callback, delay) {
5
6
  _classCallCheck(this, Timer2);
7
+ _defineProperty(this, "delay", void 0);
8
+ _defineProperty(this, "callback", void 0);
9
+ _defineProperty(this, "remaining", void 0);
10
+ _defineProperty(this, "timerId", null);
11
+ _defineProperty(this, "start", 0);
12
+ _defineProperty(this, "paused", void 0);
6
13
  this.callback = callback;
7
14
  this.delay = delay;
8
15
  this.remaining = delay;
9
16
  this.paused = false;
10
17
  this.resume();
11
18
  }
12
- _createClass(Timer2, [{
19
+ return _createClass(Timer2, [{
13
20
  key: "pause",
14
21
  value: function pause() {
15
- clearTimeout(this.timerId);
22
+ if (this.timerId) {
23
+ clearTimeout(this.timerId);
24
+ }
16
25
  this.remaining -= Date.now() - this.start;
17
26
  this.paused = true;
18
27
  }
@@ -21,8 +30,10 @@ var Timer = /* @__PURE__ */ function() {
21
30
  value: function resume() {
22
31
  this.start = Date.now();
23
32
  this.paused = false;
24
- clearTimeout(this.timerId);
25
- this.timerId = setTimeout(this.callback, this.remaining);
33
+ if (this.timerId) {
34
+ clearTimeout(this.timerId);
35
+ }
36
+ this.timerId = window.setTimeout(this.callback, this.remaining);
26
37
  }
27
38
  }, {
28
39
  key: "reset",
@@ -33,11 +44,12 @@ var Timer = /* @__PURE__ */ function() {
33
44
  }, {
34
45
  key: "clear",
35
46
  value: function clear() {
36
- clearTimeout(this.timerId);
47
+ if (this.timerId) {
48
+ clearTimeout(this.timerId);
49
+ }
37
50
  }
38
51
  }]);
39
- return Timer2;
40
- }();
52
+ })();
41
53
  export {
42
54
  Timer
43
55
  };
@@ -0,0 +1,4 @@
1
+ import type { Intergalactic } from '@semcore/core';
2
+ import type { NoticeBubbleContainerProps } from './NoticeBubble.type';
3
+ declare const NoticeBubbleContainer: Intergalactic.Component<"div", NoticeBubbleContainerProps>;
4
+ export default NoticeBubbleContainer;
@@ -0,0 +1,91 @@
1
+ import type { PortalProps, BoxProps } from '@semcore/base-components';
2
+ import type { Intergalactic } from '@semcore/core';
3
+ import type { useI18n } from '@semcore/core/lib/utils/enhances/WithI18n';
4
+ import type { RefObject } from 'react';
5
+ /**
6
+ * @deprecated. Pass noticeBubbleContainer property from window.sm2.getNoticeBubbleContainer()
7
+ */
8
+ export type NoticeBubbleContainerPortalProps = PortalProps;
9
+ export type NoticeBubbleContainerProps = BoxProps & NoticeBubbleContainerPortalProps & {
10
+ /** Ref to mount bubbles in. You should use element form window.sm2.getNoticeBubbleContainer() */
11
+ containerNode?: HTMLElement | null;
12
+ /** Manager copy */
13
+ manager?: NoticeBubbleManagerClass;
14
+ /** Specifies the locale for i18n support */
15
+ locale?: string;
16
+ };
17
+ export type NoticeBubbleViewItemProps = NoticeBubbleProps & {
18
+ containerNode?: HTMLElement;
19
+ animationDuration: number;
20
+ getI18nText: ReturnType<typeof useI18n>;
21
+ styles: React.DetailedHTMLProps<React.StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement> | undefined;
22
+ };
23
+ export type NoticeBubbleProps = BoxProps & {
24
+ /** Notice type */
25
+ type?: 'info' | 'warning';
26
+ /**
27
+ * Notice display duration. Set to 0 to disable auto-close.
28
+ */
29
+ duration?: number;
30
+ /**
31
+ * Enables animation on first rendering.
32
+ * @default false
33
+ */
34
+ initialAnimation?: boolean;
35
+ /**
36
+ * Use it for complex notices with important controls.
37
+ * If enabled, browser focus will be locked in the notice
38
+ * until it's closed. After close focus should return to the element
39
+ * where it was placed before notice appear.
40
+ */
41
+ focusLock?: boolean;
42
+ /**
43
+ * Notice visibility.
44
+ */
45
+ visible?: boolean;
46
+ /**
47
+ * Control under the notice children.
48
+ * */
49
+ action?: React.ReactNode;
50
+ /**
51
+ * Callback triggered by "Close" icon click.
52
+ * */
53
+ onClose?: (e?: React.SyntheticEvent) => void;
54
+ /**
55
+ * Notice content.
56
+ * */
57
+ children?: React.ReactNode;
58
+ manager?: NoticeBubbleManagerClass;
59
+ icon?: React.ReactElement;
60
+ };
61
+ export type NoticeBubbleInfoProps = NoticeBubbleProps & {
62
+ readonly type?: 'info';
63
+ };
64
+ export type NoticeBubbleWarningProps = NoticeBubbleProps & {
65
+ readonly type?: 'warning';
66
+ };
67
+ export type AddedNoticeMeta = {
68
+ uid: number;
69
+ update: (props: NoticeBubbleInfoProps | NoticeBubbleWarningProps) => Promise<AddedNoticeMeta>;
70
+ remove: () => boolean;
71
+ ref: RefObject<HTMLElement>;
72
+ };
73
+ export type NoticeBubbleManagerClass = {
74
+ /**
75
+ * Creates and shows a notice.
76
+ * */
77
+ add: (props: NoticeBubbleInfoProps | NoticeBubbleWarningProps) => AddedNoticeMeta;
78
+ /**
79
+ * Removes notice by uid.
80
+ * */
81
+ remove: (uid: number) => boolean;
82
+ /**
83
+ * Replace notice by uid.
84
+ */
85
+ replace: (uid: number, props: NoticeBubbleInfoProps | NoticeBubbleWarningProps) => void;
86
+ /**
87
+ * Replace last notice (if it is existing)
88
+ */
89
+ replaceLast: (props: NoticeBubbleInfoProps | NoticeBubbleWarningProps) => void;
90
+ };
91
+ export declare const NoticeBubbleContainer: Intergalactic.Component<'div', NoticeBubbleContainerProps>;
@@ -0,0 +1,22 @@
1
+ import type { RefObject } from 'react';
2
+ import type { NoticeBubbleManagerClass, NoticeBubbleInfoProps, NoticeBubbleWarningProps, AddedNoticeMeta } from './NoticeBubble.type';
3
+ export type NoticeItem = (NoticeBubbleInfoProps | NoticeBubbleWarningProps) & {
4
+ uid: number;
5
+ visible?: boolean;
6
+ forwardRef: RefObject<HTMLElement>;
7
+ onClose: () => void;
8
+ };
9
+ declare class NoticeBubbleManager implements NoticeBubbleManagerClass {
10
+ private items;
11
+ private emitter;
12
+ private counter;
13
+ addListener(fn: (items: NoticeItem[]) => void): () => void;
14
+ private emit;
15
+ add(props: NoticeBubbleInfoProps | NoticeBubbleWarningProps): AddedNoticeMeta;
16
+ replace(uid: number, props: NoticeBubbleInfoProps | NoticeBubbleWarningProps): Promise<AddedNoticeMeta>;
17
+ replaceLast(props: NoticeBubbleInfoProps | NoticeBubbleWarningProps): Promise<AddedNoticeMeta>;
18
+ remove(uid: number): boolean;
19
+ }
20
+ declare const noticeBubbleDefaultManager: NoticeBubbleManager;
21
+ export { NoticeBubbleManager };
22
+ export default noticeBubbleDefaultManager;
@@ -1,167 +1,7 @@
1
- import { PortalProps } from '@semcore/portal';
2
- import { UnknownProperties, Intergalactic } from '@semcore/core';
3
- import { BoxProps } from '@semcore/flex-box';
4
-
5
- /** @deprecated */
6
- export interface INoticeBubbleContainerProps
7
- extends NoticeBubbleContainerProps,
8
- UnknownProperties {}
9
- export type NoticeBubbleContainerProps = BoxProps &
10
- PortalProps & {
11
- /** Manager copy */
12
- manager?: NoticeBubbleManagerClass;
13
- locale?: string;
14
- };
15
-
16
- /** @deprecated */
17
- export interface INoticeBubbleProps extends NoticeBubbleProps, UnknownProperties {}
18
- export type NoticeBubbleProps = BoxProps & {
19
- /**
20
- * Notice visibility.
21
- */
22
- visible?: boolean;
23
- /**
24
- * Control under the notice children.
25
- * */
26
- action?: React.ReactNode;
27
- /**
28
- * Callback triggered by "Close" icon click.
29
- * */
30
- onClose?: (e?: React.SyntheticEvent) => void;
31
- /**
32
- * Notice content.
33
- * */
34
- children?: React.ReactNode;
35
- manager?: NoticeBubbleManager;
36
- icon?: React.ReactElement;
37
- };
38
- /** @deprecated */
39
- export interface INoticeBubbleInfoProps extends NoticeBubbleInfoProps, UnknownProperties {}
40
- export type NoticeBubbleInfoProps = NoticeBubbleProps & {
41
- readonly type?: 'info';
42
- /**
43
- * Notice display duration. Set to 0 to disable auto-close.
44
- */
45
- duration?: number;
46
- /**
47
- * Enables animation on first rendering.
48
- * @default false
49
- */
50
- initialAnimation?: boolean;
51
- /**
52
- * Use it for complex notices with important controls.
53
- * If enabled, browser focus will be locked in the notice
54
- * until it's closed. After close focus should return to the element
55
- * where it was placed before notice appear.
56
- */
57
- focusLock?: boolean;
58
- };
59
-
60
- /** @deprecated */
61
- export interface INoticeBubbleWarningProps extends NoticeBubbleWarningProps, UnknownProperties {}
62
- export type NoticeBubbleWarningProps = NoticeBubbleProps & {
63
- readonly type?: 'warning';
64
- /**
65
- * Notice display duration.
66
- */
67
- duration?: number;
68
- /**
69
- * Enables animation on first rendering.
70
- * @default false
71
- */
72
- initialAnimation?: boolean;
73
- /**
74
- * Use it for complex notices with important controls.
75
- * If enabled, browser focus will be locked in the notice
76
- * until it's closed. After close focus should return to the element
77
- * where it was placed before notice appear.
78
- */
79
- focusLock?: boolean;
80
- };
81
-
82
- /** @deprecated */
83
- export interface INoticeBubbleManager extends NoticeBubbleManagerClass, UnknownProperties {}
84
- export type NoticeBubbleManagerClass = {
85
- /**
86
- * Creates and shows a notice.
87
- * */
88
- add: (props: NoticeBubbleInfoProps | NoticeBubbleWarningProps) => {
89
- uid: string;
90
- update: (props: Partial<NoticeBubbleInfoProps> | Partial<NoticeBubbleWarningProps>) => boolean;
91
- remove: () => boolean;
92
- ref: React.RefObject<HTMLDivElement>;
93
- focus: () => void;
94
- };
95
- /**
96
- * Updates notice by uid.
97
- * */
98
- update: (
99
- uid: string,
100
- props: Partial<NoticeBubbleInfoProps> | Partial<NoticeBubbleWarningProps>,
101
- ) => boolean;
102
- /**
103
- * Removes notice by uid.
104
- * */
105
- remove: (uid: string) => boolean;
106
- /**
107
- * Replace last notice (if it is existing)
108
- */
109
- replaceLast: (props: NoticeBubbleInfoProps | NoticeBubbleWarningProps) => void;
110
- };
111
-
112
- /**
113
- * @deprecated use `NoticeBubbleManager` instead.
114
- * */
115
- export declare const NoticeBubble: Intergalactic.Component<'div', NoticeBubbleInfoProps>;
116
- /**
117
- * @deprecated use `NoticeBubbleManager` instead.
118
- * */
119
- export declare const NoticeBubbleWarning: Intergalactic.Component<'div', NoticeBubbleWarningProps>;
120
- export declare const NoticeBubbleContainer: Intergalactic.Component<
121
- 'div',
122
- NoticeBubbleContainerProps
123
- > & {
124
- /**
125
- * @deprecated use `NoticeBubbleManager` instead.
126
- * */
127
- Info: typeof NoticeBubble;
128
-
129
- /**
130
- * @deprecated use `NoticeBubbleManager` instead.
131
- * */
132
- Warning: typeof NoticeBubbleWarning;
133
- };
134
- export declare class NoticeBubbleManager implements NoticeBubbleManagerClass {
135
- /**
136
- * Creates and shows a notice.
137
- * */
138
- add(props: NoticeBubbleInfoProps | NoticeBubbleWarningProps): {
139
- uid: string;
140
- update: (props: Partial<NoticeBubbleInfoProps> | Partial<NoticeBubbleWarningProps>) => boolean;
141
- remove: () => boolean;
142
- ref: React.RefObject<HTMLDivElement>;
143
- focus: () => void;
144
- };
145
- /**
146
- * Updates notice by uid.
147
- * */
148
- update(
149
- uid: string,
150
- props: Partial<NoticeBubbleInfoProps> | Partial<NoticeBubbleWarningProps>,
151
- ): boolean;
152
- /**
153
- * Removes notice by uid.
154
- * */
155
- remove(uid: string): boolean;
156
- /**
157
- * Replace last notice (if it is existing)
158
- */
159
- replaceLast: (props: NoticeBubbleInfoProps | NoticeBubbleWarningProps) => void;
160
- }
161
-
162
- export declare const noticeBubbleDefaultManager: NoticeBubbleManager;
163
-
164
- /**
165
- * @deprecated Use `import { noticeBubbleDefaultManager } from ...` instead
166
- */
167
- export default noticeBubbleDefaultManager;
1
+ import { default as NoticeBubbleContainer } from './NoticeBubble';
2
+ import type { NoticeBubbleContainerProps, NoticeBubbleInfoProps, NoticeBubbleWarningProps, AddedNoticeMeta } from './NoticeBubble.type';
3
+ import { default as noticeBubbleDefaultManager } from './NoticeBubbleManager';
4
+ export * from './NoticeBubble';
5
+ export * from './NoticeBubbleManager';
6
+ export { NoticeBubbleContainer, noticeBubbleDefaultManager };
7
+ export type { NoticeBubbleContainerProps, NoticeBubbleInfoProps, NoticeBubbleWarningProps, AddedNoticeMeta, };
@@ -0,0 +1,58 @@
1
+ export declare const localizedMessages: {
2
+ de: {
3
+ close: string;
4
+ notification: string;
5
+ };
6
+ en: {
7
+ close: string;
8
+ notification: string;
9
+ };
10
+ es: {
11
+ close: string;
12
+ notification: string;
13
+ };
14
+ fr: {
15
+ close: string;
16
+ notification: string;
17
+ };
18
+ it: {
19
+ close: string;
20
+ notification: string;
21
+ };
22
+ ja: {
23
+ close: string;
24
+ notification: string;
25
+ };
26
+ ko: {
27
+ close: string;
28
+ notification: string;
29
+ };
30
+ nl: {
31
+ close: string;
32
+ notification: string;
33
+ };
34
+ pt: {
35
+ close: string;
36
+ notification: string;
37
+ };
38
+ tr: {
39
+ close: string;
40
+ notification: string;
41
+ };
42
+ vi: {
43
+ close: string;
44
+ notification: string;
45
+ };
46
+ zh: {
47
+ close: string;
48
+ notification: string;
49
+ };
50
+ pl: {
51
+ close: string;
52
+ notification: string;
53
+ };
54
+ sv: {
55
+ close: string;
56
+ notification: string;
57
+ };
58
+ };
@@ -0,0 +1,14 @@
1
+ declare class Timer {
2
+ private readonly delay;
3
+ private readonly callback;
4
+ private remaining;
5
+ private timerId;
6
+ private start;
7
+ paused: boolean;
8
+ constructor(callback: Function, delay: number);
9
+ pause(): void;
10
+ resume(): void;
11
+ reset(): void;
12
+ clear(): void;
13
+ }
14
+ export { Timer };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/notice-bubble",
3
3
  "description": "Semrush NoticeBubble Component",
4
- "version": "5.55.0-prerelease.4",
4
+ "version": "5.55.0-prerelease.5",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -14,16 +14,16 @@
14
14
  "types": "./lib/types/index.d.ts"
15
15
  },
16
16
  "dependencies": {
17
- "@semcore/button": "5.44.0-prerelease.4",
18
- "@semcore/utils": "4.49.0-prerelease.4",
19
- "@semcore/icon": "4.63.0-prerelease.4",
20
- "@semcore/portal": "3.42.0-prerelease.4",
21
- "@semcore/flex-box": "5.42.0-prerelease.4",
22
- "@semcore/animation": "2.42.0-prerelease.4",
23
- "@semcore/tooltip": "6.50.0-prerelease.4"
17
+ "@semcore/button": "5.44.0-prerelease.5",
18
+ "@semcore/utils": "4.49.0-prerelease.5",
19
+ "@semcore/icon": "4.63.0-prerelease.5",
20
+ "@semcore/portal": "3.42.0-prerelease.5",
21
+ "@semcore/flex-box": "5.42.0-prerelease.5",
22
+ "@semcore/animation": "2.42.0-prerelease.5",
23
+ "@semcore/tooltip": "6.50.0-prerelease.5"
24
24
  },
25
25
  "peerDependencies": {
26
- "@semcore/core": "^2.40.0-prerelease.4",
26
+ "@semcore/core": "^2.40.0-prerelease.5",
27
27
  "react": "16.8 - 18",
28
28
  "react-dom": "16.8 - 18"
29
29
  },
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=index.d.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import { PortalProps } from '@semcore/portal';\nimport { UnknownProperties, Intergalactic } from '@semcore/core';\nimport { BoxProps } from '@semcore/flex-box';\n\n/** @deprecated */\nexport interface INoticeBubbleContainerProps\n extends NoticeBubbleContainerProps,\n UnknownProperties {}\nexport type NoticeBubbleContainerProps = BoxProps &\n PortalProps & {\n /** Manager copy */\n manager?: NoticeBubbleManagerClass;\n locale?: string;\n };\n\n/** @deprecated */\nexport interface INoticeBubbleProps extends NoticeBubbleProps, UnknownProperties {}\nexport type NoticeBubbleProps = BoxProps & {\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 manager?: NoticeBubbleManager;\n icon?: React.ReactElement;\n};\n/** @deprecated */\nexport interface INoticeBubbleInfoProps extends NoticeBubbleInfoProps, UnknownProperties {}\nexport type NoticeBubbleInfoProps = NoticeBubbleProps & {\n readonly type?: 'info';\n /**\n * Notice display duration. Set to 0 to disable auto-close.\n */\n duration?: number;\n /**\n * Enables animation on first rendering.\n * @default false\n */\n initialAnimation?: boolean;\n /**\n * Use it for complex notices with important controls.\n * If enabled, browser focus will be locked in the notice\n * until it's closed. After close focus should return to the element\n * where it was placed before notice appear.\n */\n focusLock?: boolean;\n};\n\n/** @deprecated */\nexport interface INoticeBubbleWarningProps extends NoticeBubbleWarningProps, UnknownProperties {}\nexport type NoticeBubbleWarningProps = NoticeBubbleProps & {\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 * Use it for complex notices with important controls.\n * If enabled, browser focus will be locked in the notice\n * until it's closed. After close focus should return to the element\n * where it was placed before notice appear.\n */\n focusLock?: boolean;\n};\n\n/** @deprecated */\nexport interface INoticeBubbleManager extends NoticeBubbleManagerClass, UnknownProperties {}\nexport type NoticeBubbleManagerClass = {\n /**\n * Creates and shows a notice.\n * */\n add: (props: NoticeBubbleInfoProps | NoticeBubbleWarningProps) => {\n uid: string;\n update: (props: Partial<NoticeBubbleInfoProps> | Partial<NoticeBubbleWarningProps>) => boolean;\n remove: () => boolean;\n ref: React.RefObject<HTMLDivElement>;\n focus: () => void;\n };\n /**\n * Updates notice by uid.\n * */\n update: (\n uid: string,\n props: Partial<NoticeBubbleInfoProps> | Partial<NoticeBubbleWarningProps>,\n ) => boolean;\n /**\n * Removes notice by uid.\n * */\n remove: (uid: string) => boolean;\n /**\n * Replace last notice (if it is existing)\n */\n replaceLast: (props: NoticeBubbleInfoProps | NoticeBubbleWarningProps) => void;\n};\n\n/**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\nexport declare const NoticeBubble: Intergalactic.Component<'div', NoticeBubbleInfoProps>;\n/**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\nexport declare const NoticeBubbleWarning: Intergalactic.Component<'div', NoticeBubbleWarningProps>;\nexport declare const NoticeBubbleContainer: Intergalactic.Component<\n 'div',\n NoticeBubbleContainerProps\n> & {\n /**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\n Info: typeof NoticeBubble;\n\n /**\n * @deprecated use `NoticeBubbleManager` instead.\n * */\n Warning: typeof NoticeBubbleWarning;\n};\nexport declare class NoticeBubbleManager implements NoticeBubbleManagerClass {\n /**\n * Creates and shows a notice.\n * */\n add(props: NoticeBubbleInfoProps | NoticeBubbleWarningProps): {\n uid: string;\n update: (props: Partial<NoticeBubbleInfoProps> | Partial<NoticeBubbleWarningProps>) => boolean;\n remove: () => boolean;\n ref: React.RefObject<HTMLDivElement>;\n focus: () => void;\n };\n /**\n * Updates notice by uid.\n * */\n update(\n uid: string,\n props: Partial<NoticeBubbleInfoProps> | Partial<NoticeBubbleWarningProps>,\n ): boolean;\n /**\n * Removes notice by uid.\n * */\n remove(uid: string): boolean;\n /**\n * Replace last notice (if it is existing)\n */\n replaceLast: (props: NoticeBubbleInfoProps | NoticeBubbleWarningProps) => void;\n}\n\nexport declare const noticeBubbleDefaultManager: NoticeBubbleManager;\n\n/**\n * @deprecated Use `import { noticeBubbleDefaultManager } from ...` instead\n */\nexport default noticeBubbleDefaultManager;\n"],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.d.js.map