@homecode/ui 4.27.1 → 4.27.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ import C from './Notifications.constants.json.js';
7
7
  const SHOW_TIME = 5000;
8
8
  const STORE = createStore('notifications', {
9
9
  items: [],
10
- autohide: [],
10
+ autoHide: [],
11
11
  data: {},
12
12
  paused: false,
13
13
  show(data) {
@@ -18,9 +18,8 @@ const STORE = createStore('notifications', {
18
18
  createdAt: Date.now(),
19
19
  };
20
20
  Time.after(C.ANIMATION_DURATION, () => (this.data[id].visible = true));
21
- if (data.autohide !== false) {
22
- this.autohide.push(id);
23
- }
21
+ if (data.autoHide !== false)
22
+ this.autoHide.push(id);
24
23
  return id;
25
24
  },
26
25
  pause() {
@@ -29,7 +28,7 @@ const STORE = createStore('notifications', {
29
28
  },
30
29
  unpause() {
31
30
  const pauseTime = Date.now() - this.pausedAt;
32
- this.autohide.forEach(id => {
31
+ this.autoHide.forEach(id => {
33
32
  this.data[id].createdAt += pauseTime;
34
33
  });
35
34
  this.paused = false;
@@ -39,18 +38,18 @@ const STORE = createStore('notifications', {
39
38
  Time.after(C.ANIMATION_DURATION, () => this.remove(id));
40
39
  },
41
40
  remove(id) {
42
- spliceWhere(this.autohide, id);
41
+ spliceWhere(this.autoHide, id);
43
42
  spliceWhere(this.items, id);
44
43
  delete this.data[id];
45
44
  },
46
45
  });
47
46
  // worker
48
47
  Time.every(50, function tick() {
49
- const { paused, autohide, data } = STORE;
50
- if (paused || autohide.length === 0) {
48
+ const { paused, autoHide, data } = STORE;
49
+ if (paused || autoHide.length === 0) {
51
50
  return;
52
51
  }
53
- const id = autohide[0]; // TODO: move trough all autohide until some will !readyToHide
52
+ const id = autoHide[0]; // TODO: move trough all autoHide until some will !readyToHide
54
53
  const item = data[id];
55
54
  const readyToHide = Date.now() - item.createdAt > SHOW_TIME;
56
55
  if (item.visible && readyToHide) {
@@ -4,6 +4,7 @@ export type ItemParams = {
4
4
  type?: NotificationType;
5
5
  title?: string;
6
6
  content?: string;
7
+ autoHide?: boolean;
7
8
  };
8
9
  export type Methods = {
9
10
  show: (data: ItemParams) => Id;
@@ -1,9 +1,10 @@
1
+ import { ItemParams } from './Notifications.types';
1
2
  declare const STORE: import("justorm/dist/esm/proxy").ProxyStore<{
2
3
  items: string[];
3
- autohide: string[];
4
+ autoHide: string[];
4
5
  data: {};
5
6
  paused: boolean;
6
- show(data: any): any;
7
+ show(data: ItemParams): any;
7
8
  pause(): void;
8
9
  unpause(): void;
9
10
  close(id: any): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homecode/ui",
3
- "version": "4.27.1",
3
+ "version": "4.27.2",
4
4
  "description": "React UI components library",
5
5
  "scripts": {
6
6
  "tests": "jest",