@streamlayer/react-ui 1.28.1 → 1.28.3

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": "@streamlayer/react-ui",
3
- "version": "1.28.1",
3
+ "version": "1.28.3",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "typings": "./lib/index.d.ts",
@@ -80,19 +80,19 @@
80
80
  "@noriginmedia/norigin-spatial-navigation": "^2.3.0",
81
81
  "react-window-infinite-loader": "^1.0.9",
82
82
  "uuid": "^11.1.0",
83
- "@streamlayer/feature-gamification": "^1.21.1",
84
- "@streamlayer/react-polyfills": "^0.1.32",
85
- "@streamlayer/sdk-web": "^1.14.5",
86
- "@streamlayer/sdk-web-anonymous-auth": "^1.1.51",
87
- "@streamlayer/sdk-web-analytics": "^1.11.5",
88
- "@streamlayer/sdk-web-api": "^1.12.5",
89
- "@streamlayer/sdk-web-core": "^1.15.5",
90
- "@streamlayer/sdk-web-features": "^1.0.72",
91
- "@streamlayer/sdk-web-interfaces": "^1.7.5",
92
- "@streamlayer/sdk-web-logger": "^1.0.72",
93
- "@streamlayer/sdk-web-notifications": "^1.3.34",
94
- "@streamlayer/sdk-web-storage": "^1.0.72",
95
- "@streamlayer/sdk-web-types": "^1.14.5"
83
+ "@streamlayer/react-polyfills": "^0.1.34",
84
+ "@streamlayer/feature-gamification": "^1.21.3",
85
+ "@streamlayer/sdk-web": "^1.14.7",
86
+ "@streamlayer/sdk-web-anonymous-auth": "^1.1.53",
87
+ "@streamlayer/sdk-web-analytics": "^1.11.7",
88
+ "@streamlayer/sdk-web-api": "^1.12.7",
89
+ "@streamlayer/sdk-web-core": "^1.15.7",
90
+ "@streamlayer/sdk-web-interfaces": "^1.7.7",
91
+ "@streamlayer/sdk-web-features": "^1.0.74",
92
+ "@streamlayer/sdk-web-logger": "^1.0.74",
93
+ "@streamlayer/sdk-web-notifications": "^1.3.36",
94
+ "@streamlayer/sdk-web-storage": "^1.0.74",
95
+ "@streamlayer/sdk-web-types": "^1.14.7"
96
96
  },
97
97
  "nx": {
98
98
  "implicitDependencies": [
@@ -133,7 +133,7 @@
133
133
  "vite-plugin-svgr": "^4.2.0",
134
134
  "vite-svg-loader": "^5.1.0",
135
135
  "vite-tsconfig-paths": "^5.0.1",
136
- "@streamlayer/react": "^1.18.5"
136
+ "@streamlayer/react": "^1.18.7"
137
137
  },
138
138
  "dependencies": {
139
139
  "@dailymotion/vast-client": "^6.2.0",
@@ -1,15 +0,0 @@
1
- import { DependencyList } from 'react';
2
- interface KeyboardNavigationOptions {
3
- containerSelector: string;
4
- getElements?: (container: HTMLElement) => HTMLElement[];
5
- onEscape: () => void;
6
- onEnter?: (element: HTMLElement, index: number) => void;
7
- initialFocusPriority?: 'close-btn' | 'first' | number;
8
- enabled?: boolean;
9
- dependencies?: DependencyList;
10
- resetFocusOn?: unknown[];
11
- }
12
- export declare const useKeyboardNavigation: (options: KeyboardNavigationOptions) => {
13
- focusedIndex: import('react').MutableRefObject<number>;
14
- };
15
- export {};
@@ -1,74 +0,0 @@
1
- import { useRef as m, useEffect as D } from "react";
2
- const R = (g) => {
3
- const {
4
- containerSelector: y,
5
- getElements: A,
6
- onEscape: v,
7
- onEnter: a,
8
- initialFocusPriority: l = "close-btn",
9
- enabled: E = !0,
10
- dependencies: h = [],
11
- resetFocusOn: f = []
12
- } = g, t = m(0), d = m(!1), k = m(f);
13
- return f.some((o, p) => o !== k.current[p]) && (d.current = !1, k.current = f), D(() => {
14
- if (!E) return;
15
- const o = document.querySelector(y);
16
- if (!o) return;
17
- const b = A || ((e) => Array.from(e.querySelectorAll("button")).filter((r) => !r.disabled));
18
- let n = b(o);
19
- (() => {
20
- var e, c, r;
21
- if (n.length !== 0) {
22
- if (d.current) {
23
- const s = document.activeElement;
24
- if (n.includes(s))
25
- return;
26
- }
27
- if (l === "close-btn") {
28
- const s = o.querySelector('[data-close-btn="true"]');
29
- if (s) {
30
- const i = n.indexOf(s);
31
- t.current = i !== -1 ? i : 0, s.focus();
32
- } else
33
- t.current = 0, (e = n[t.current]) == null || e.focus();
34
- } else l === "first" ? (t.current = 0, (c = n[t.current]) == null || c.focus()) : typeof l == "number" && (t.current = Math.min(l, n.length - 1), (r = n[t.current]) == null || r.focus());
35
- d.current = !0;
36
- }
37
- })();
38
- const w = (e) => {
39
- var s, i;
40
- if (!o) return;
41
- n = b(o);
42
- const c = n.length;
43
- if (c === 0) return;
44
- const r = e.keyCode;
45
- if (["ArrowDown", "ArrowRight"].includes(e.key) || r === 40 || r === 39) {
46
- t.current = (t.current + 1) % c, (s = n[t.current]) == null || s.focus(), e.preventDefault();
47
- return;
48
- }
49
- if (["ArrowUp", "ArrowLeft"].includes(e.key) || r === 38 || r === 37) {
50
- t.current = (t.current - 1 + c) % c, (i = n[t.current]) == null || i.focus(), e.preventDefault();
51
- return;
52
- }
53
- if (e.key === "Enter" || r === 13 || e.key === " ") {
54
- const u = n[t.current];
55
- if (!u) return;
56
- const F = document.activeElement;
57
- if (!n.includes(F))
58
- return;
59
- a ? a(u, t.current) : (u.tagName === "BUTTON" || u.tagName, u.click()), e.preventDefault();
60
- return;
61
- }
62
- if (e.key === "Escape" || e.key === "Backspace" || e.code === "Back" || r === 10009) {
63
- v(), e.preventDefault();
64
- return;
65
- }
66
- };
67
- return window.addEventListener("keydown", w), () => {
68
- window.removeEventListener("keydown", w);
69
- };
70
- }, [E, y, l, v, a, ...h, ...f]), { focusedIndex: t };
71
- };
72
- export {
73
- R as useKeyboardNavigation
74
- };