@os-design/core 1.0.262 → 1.0.264

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 +1 @@
1
- {"version":3,"file":"getFocusableElements.d.ts","sourceRoot":"","sources":["../../../src/Input/utils/getFocusableElements.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,oBAAoB,YAAa,UAAU,KAAG,WAAW,EAKf,CAAC;AAEjD,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"getFocusableElements.d.ts","sourceRoot":"","sources":["../../../src/Input/utils/getFocusableElements.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,oBAAoB,YAAa,UAAU,KAAG,WAAW,EAW9D,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -1,2 +1,11 @@
1
- const getFocusableElements = element => [...element.querySelectorAll('a, button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])')].filter(el => !el.hasAttribute('disabled'));
1
+ const getFocusableElements = element => {
2
+ const nodes = element.querySelectorAll('a, button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])');
3
+ const res = [];
4
+ nodes.forEach(node => {
5
+ if (!node.hasAttribute('disabled')) {
6
+ res.push(node);
7
+ }
8
+ });
9
+ return res;
10
+ };
2
11
  export default getFocusableElements;
@@ -7,7 +7,7 @@ const useFocusWithArrows = ref => {
7
7
  const {
8
8
  activeElement
9
9
  } = document;
10
- const curFocusedIndex = activeElement ? [...focusableListItems].indexOf(activeElement) : -1;
10
+ const curFocusedIndex = activeElement ? Array.from(focusableListItems).indexOf(activeElement) : -1;
11
11
  let nextFocusedIndex;
12
12
  if (curFocusedIndex === -1 && e.key === 'ArrowUp') {
13
13
  nextFocusedIndex = focusableListItems.length - 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@os-design/core",
3
- "version": "1.0.262",
3
+ "version": "1.0.264",
4
4
  "license": "UNLICENSED",
5
5
  "repository": "git@gitlab.com:os-team/libs/os-design.git",
6
6
  "type": "module",
@@ -29,17 +29,17 @@
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@os-design/date-picker-utils": "^1.0.29",
33
- "@os-design/icons": "^1.0.65",
34
- "@os-design/input-number-utils": "^1.0.35",
35
- "@os-design/input-password-utils": "^1.0.2",
36
- "@os-design/media": "^1.0.30",
37
- "@os-design/menu-utils": "^1.0.26",
38
- "@os-design/portal": "^1.0.22",
39
- "@os-design/styles": "^1.0.62",
40
- "@os-design/theming": "^1.0.58",
41
- "@os-design/time-picker-utils": "^1.0.20",
42
- "@os-design/utils": "^1.0.82",
32
+ "@os-design/date-picker-utils": "^1.0.31",
33
+ "@os-design/icons": "^1.0.67",
34
+ "@os-design/input-number-utils": "^1.0.37",
35
+ "@os-design/input-password-utils": "^1.0.3",
36
+ "@os-design/media": "^1.0.31",
37
+ "@os-design/menu-utils": "^1.0.27",
38
+ "@os-design/portal": "^1.0.23",
39
+ "@os-design/styles": "^1.0.64",
40
+ "@os-design/theming": "^1.0.60",
41
+ "@os-design/time-picker-utils": "^1.0.22",
42
+ "@os-design/utils": "^1.0.84",
43
43
  "facepaint": "^1.2.1",
44
44
  "react-focus-lock": "^2.13.2",
45
45
  "react-window": "^1.8.10"
@@ -58,5 +58,5 @@
58
58
  "react": ">=18",
59
59
  "react-dom": ">=18"
60
60
  },
61
- "gitHead": "f6531f28cc5bdb3a1786e494d118eac84eefe795"
61
+ "gitHead": "ed7b645f040dc652da07a9bd23a5983b0416f126"
62
62
  }
@@ -1,8 +1,14 @@
1
- const getFocusableElements = (element: ParentNode): HTMLElement[] =>
2
- [
3
- ...element.querySelectorAll<HTMLElement>(
4
- 'a, button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])'
5
- ),
6
- ].filter((el) => !el.hasAttribute('disabled'));
1
+ const getFocusableElements = (element: ParentNode): HTMLElement[] => {
2
+ const nodes = element.querySelectorAll<HTMLElement>(
3
+ 'a, button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])'
4
+ );
5
+ const res: HTMLElement[] = [];
6
+ nodes.forEach((node) => {
7
+ if (!node.hasAttribute('disabled')) {
8
+ res.push(node);
9
+ }
10
+ });
11
+ return res;
12
+ };
7
13
 
8
14
  export default getFocusableElements;
@@ -10,10 +10,10 @@ const useFocusWithArrows = (ref: RefObject<Element>): void => {
10
10
  );
11
11
  const { activeElement } = document;
12
12
  const curFocusedIndex = activeElement
13
- ? ([...focusableListItems] as Element[]).indexOf(activeElement)
13
+ ? (Array.from(focusableListItems) as Element[]).indexOf(activeElement)
14
14
  : -1;
15
15
 
16
- let nextFocusedIndex;
16
+ let nextFocusedIndex: number | undefined;
17
17
  if (curFocusedIndex === -1 && e.key === 'ArrowUp') {
18
18
  nextFocusedIndex = focusableListItems.length - 1;
19
19
  } else if (curFocusedIndex === -1 && e.key === 'ArrowDown') {