@24i/bigscreen-sdk 1.0.26-alpha.2451 → 1.0.27-alpha.2456

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@24i/bigscreen-sdk",
3
- "version": "1.0.26-alpha.2451",
3
+ "version": "1.0.27-alpha.2456",
4
4
  "description": "SmartApps BIGscreen SDK monorepo",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -60,7 +60,7 @@
60
60
  "@babel/preset-env": "^7.22.14",
61
61
  "@types/fs-extra": "^11.0.1",
62
62
  "@types/inquirer": "^9.0.3",
63
- "@types/jest": "^29.5.4",
63
+ "@types/jest": "^29.5.5",
64
64
  "@types/minimist": "^1.2.2",
65
65
  "@types/node": "^20.5.7",
66
66
  "@types/react": "18.0.33",
@@ -72,7 +72,7 @@
72
72
  "full-icu": "^1.5.0",
73
73
  "identity-obj-proxy": "^3.0.0",
74
74
  "inquirer": "^9.2.10",
75
- "jest": "^29.6.4",
75
+ "jest": "^29.7.0",
76
76
  "jest-canvas-mock": "^2.5.2",
77
77
  "jest-environment-jsdom": "^29.6.4",
78
78
  "jest-sonar": "^0.2.15",
@@ -52,7 +52,7 @@ export const getLayoutBase = (onKeyDown: (event: KeyboardEvent, layout: ILayout)
52
52
  throw new Error(Errors.DOM_REF_ERROR);
53
53
  }
54
54
  domRef.current!.addEventListener('keydown', this.onKeyDown, false);
55
- domRef.current!.addEventListener('keyup', this.onKeyUp, false);
55
+ window.document.addEventListener('keyup', this.onGlobalKeyUp, true);
56
56
  }
57
57
 
58
58
  componentWillUnmount() {
@@ -61,14 +61,14 @@ export const getLayoutBase = (onKeyDown: (event: KeyboardEvent, layout: ILayout)
61
61
  throw new Error(Errors.DOM_REF_ERROR);
62
62
  }
63
63
  domRef.current!.removeEventListener('keydown', this.onKeyDown, false);
64
- domRef.current!.removeEventListener('keyup', this.onKeyUp, false);
64
+ window.document.removeEventListener('keyup', this.onGlobalKeyUp, true);
65
65
  }
66
66
 
67
67
  onKeyDown = (e: KeyboardEvent) => {
68
68
  onKeyDown(e, this);
69
69
  };
70
70
 
71
- onKeyUp = () => {
71
+ onGlobalKeyUp = () => {
72
72
  this.preventBlurCounter = 0;
73
73
  };
74
74
 
@@ -58,7 +58,7 @@ export class Matrix extends Component<Props> implements IFocusable {
58
58
  throw new Error(Errors.DOM_REF_ERROR);
59
59
  }
60
60
  domRef.current!.addEventListener('keydown', this.onKeyDown, false);
61
- domRef.current!.addEventListener('keyup', this.onKeyUp, false);
61
+ window.document.addEventListener('keyup', this.onGlobalKeyUp, true);
62
62
  }
63
63
 
64
64
  componentWillUnmount() {
@@ -67,7 +67,7 @@ export class Matrix extends Component<Props> implements IFocusable {
67
67
  throw new Error(Errors.DOM_REF_ERROR);
68
68
  }
69
69
  domRef.current!.removeEventListener('keydown', this.onKeyDown, false);
70
- domRef.current!.removeEventListener('keyup', this.onKeyUp, false);
70
+ window.document.removeEventListener('keyup', this.onGlobalKeyUp, true);
71
71
  }
72
72
 
73
73
  onKeyDown = (e: KeyboardEvent) => {
@@ -103,7 +103,7 @@ export class Matrix extends Component<Props> implements IFocusable {
103
103
  }
104
104
  };
105
105
 
106
- onKeyUp = () => {
106
+ onGlobalKeyUp = () => {
107
107
  this.preventBlurCounter = 0;
108
108
  };
109
109
 
@@ -111,11 +111,13 @@ export class GridBase<T extends Item<U>, U>
111
111
  componentDidMount() {
112
112
  this.scrollerDom.current!.addEventListener('wheel', this.onWheel);
113
113
  this.scroller.current!.wrapRef.current!.addEventListener('keyup', this.onKeyUp);
114
+ window.document.addEventListener('keyup', this.onGlobalKeyUp, true);
114
115
  }
115
116
 
116
117
  componentWillUnmount() {
117
118
  this.scrollerDom.current!.removeEventListener('wheel', this.onWheel);
118
119
  this.scroller.current!.wrapRef.current!.removeEventListener('keyup', this.onKeyUp);
120
+ window.document.removeEventListener('keyup', this.onGlobalKeyUp, true);
119
121
  }
120
122
 
121
123
  // eslint-disable-next-line sonarjs/cognitive-complexity
@@ -155,6 +157,9 @@ export class GridBase<T extends Item<U>, U>
155
157
  onKeyUp = () => {
156
158
  this.stopFastScrolling();
157
159
  this.fastFocusingOptimizer.stop();
160
+ };
161
+
162
+ onGlobalKeyUp = () => {
158
163
  this.preventBlurCounter = 0;
159
164
  };
160
165
 
@@ -100,11 +100,13 @@ export class ListBase<T extends Item<U>, U>
100
100
  componentDidMount() {
101
101
  this.scrollerDom.current!.addEventListener('wheel', this.onWheel);
102
102
  this.scroller.current!.wrapRef.current!.addEventListener('keyup', this.onKeyUp);
103
+ window.document.addEventListener('keyup', this.onGlobalKeyUp, true);
103
104
  }
104
105
 
105
106
  componentWillUnmount() {
106
107
  this.scrollerDom.current!.removeEventListener('wheel', this.onWheel);
107
108
  this.scroller.current!.wrapRef.current!.removeEventListener('keyup', this.onKeyUp);
109
+ window.document.removeEventListener('keyup', this.onGlobalKeyUp, true);
108
110
  }
109
111
 
110
112
  onKeyDown = (event: KeyboardEvent) => {
@@ -130,6 +132,9 @@ export class ListBase<T extends Item<U>, U>
130
132
  onKeyUp = () => {
131
133
  this.stopFastScrolling();
132
134
  this.fastFocusingOptimizer.stop();
135
+ };
136
+
137
+ onGlobalKeyUp = () => {
133
138
  this.preventBlurCounter = 0;
134
139
  };
135
140
 
@@ -34,11 +34,22 @@ export class ToastService<T extends MinimalToastProps> extends Component<Props<T
34
34
  this.serviceContinue();
35
35
  },
36
36
  } as T);
37
- if (!this.isShowingToast) {
38
- this.appendMount(toastElement, this.rootDivRef);
39
- this.isShowingToast = true;
40
- } else {
41
- this.toastElementBuffer.push(toastElement);
37
+
38
+ // Check if toast element with the same message already exists in stack
39
+ const elementExists = this.toastElementBuffer.find((item) => {
40
+ const { message: newMessage } = toastElement.props;
41
+ const { message } = item.props;
42
+
43
+ return message === newMessage;
44
+ }) !== undefined;
45
+
46
+ if (!elementExists) {
47
+ if (!this.isShowingToast) {
48
+ this.appendMount(toastElement, this.rootDivRef);
49
+ this.isShowingToast = true;
50
+ } else {
51
+ this.toastElementBuffer.push(toastElement);
52
+ }
42
53
  }
43
54
  }
44
55