@primer/react 0.0.0-20260507231001 → 0.0.0-20260507232903
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
export declare function useRovingTabIndex({ containerRef, mouseDownRef, focusOutBehavior, wrapAround, }: {
|
|
2
|
+
export declare function useRovingTabIndex({ containerRef, mouseDownRef, focusOutBehavior, preventScroll, wrapAround, }: {
|
|
3
3
|
containerRef: React.RefObject<HTMLElement | null>;
|
|
4
4
|
mouseDownRef?: React.RefObject<boolean>;
|
|
5
5
|
preventScroll?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRovingTabIndex.d.ts","sourceRoot":"","sources":["../../src/TreeView/useRovingTabIndex.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,wBAAgB,iBAAiB,CAC/B,EACE,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,UAAkB,GACnB,EAAE;IACD,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IACjD,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IACvC,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAClC,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,EACD,YAAY,GAAE,KAAK,CAAC,cAAmB,QA6DxC;AAID,wBAAgB,uBAAuB,CACrC,aAAa,EAAE,WAAW,EAC1B,KAAK,EAAE,aAAa,EACpB,UAAU,GAAE,OAAe,GAC1B,WAAW,GAAG,SAAS,CAgEzB;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAa/E;AAED,wBAA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C/B,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,MAAM,GAAG,UAAU,EAC9B,UAAU,UAAQ,GACjB,WAAW,GAAG,SAAS,CA6BzB;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,GAAG,SAAS,CAGlF;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,GAAG,SAAS,CAI9E;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,GAAG,SAAS,CAI7E;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,GAAG,SAAS,CAuB5E"}
|
|
@@ -4,26 +4,28 @@ import { getScrollContainer } from '../utils/scroll.js';
|
|
|
4
4
|
import { FocusKeys } from '@primer/behaviors';
|
|
5
5
|
|
|
6
6
|
function useRovingTabIndex(t0, t1) {
|
|
7
|
-
const $ = c(
|
|
7
|
+
const $ = c(15);
|
|
8
8
|
const {
|
|
9
9
|
containerRef,
|
|
10
10
|
mouseDownRef,
|
|
11
11
|
focusOutBehavior,
|
|
12
|
-
|
|
12
|
+
preventScroll: t2,
|
|
13
|
+
wrapAround: t3
|
|
13
14
|
} = t0;
|
|
14
|
-
const
|
|
15
|
-
|
|
15
|
+
const preventScroll = t2 === undefined ? true : t2;
|
|
16
|
+
const wrapAround = t3 === undefined ? false : t3;
|
|
17
|
+
let t4;
|
|
16
18
|
if ($[0] !== t1) {
|
|
17
|
-
|
|
19
|
+
t4 = t1 === undefined ? [] : t1;
|
|
18
20
|
$[0] = t1;
|
|
19
|
-
$[1] =
|
|
21
|
+
$[1] = t4;
|
|
20
22
|
} else {
|
|
21
|
-
|
|
23
|
+
t4 = $[1];
|
|
22
24
|
}
|
|
23
|
-
const dependencies =
|
|
24
|
-
let
|
|
25
|
+
const dependencies = t4;
|
|
26
|
+
let t5;
|
|
25
27
|
if ($[2] !== wrapAround) {
|
|
26
|
-
|
|
28
|
+
t5 = (direction, from, event) => {
|
|
27
29
|
var _getNextFocusableElem;
|
|
28
30
|
if (!(from instanceof HTMLElement)) {
|
|
29
31
|
return;
|
|
@@ -36,23 +38,23 @@ function useRovingTabIndex(t0, t1) {
|
|
|
36
38
|
return (_getNextFocusableElem = getNextFocusableElement(from, event, wrapAround)) !== null && _getNextFocusableElem !== void 0 ? _getNextFocusableElem : from;
|
|
37
39
|
};
|
|
38
40
|
$[2] = wrapAround;
|
|
39
|
-
$[3] =
|
|
41
|
+
$[3] = t5;
|
|
40
42
|
} else {
|
|
41
|
-
|
|
43
|
+
t5 = $[3];
|
|
42
44
|
}
|
|
43
|
-
let
|
|
45
|
+
let t6;
|
|
44
46
|
if ($[4] !== focusOutBehavior) {
|
|
45
|
-
|
|
47
|
+
t6 = focusOutBehavior ? {
|
|
46
48
|
focusOutBehavior
|
|
47
49
|
} : {};
|
|
48
50
|
$[4] = focusOutBehavior;
|
|
49
|
-
$[5] =
|
|
51
|
+
$[5] = t6;
|
|
50
52
|
} else {
|
|
51
|
-
|
|
53
|
+
t6 = $[5];
|
|
52
54
|
}
|
|
53
|
-
let
|
|
55
|
+
let t7;
|
|
54
56
|
if ($[6] !== containerRef || $[7] !== mouseDownRef) {
|
|
55
|
-
|
|
57
|
+
t7 = () => {
|
|
56
58
|
var _containerRef$current, _containerRef$current2, _containerRef$current3;
|
|
57
59
|
if (mouseDownRef !== null && mouseDownRef !== void 0 && mouseDownRef.current) {
|
|
58
60
|
return;
|
|
@@ -69,29 +71,30 @@ function useRovingTabIndex(t0, t1) {
|
|
|
69
71
|
};
|
|
70
72
|
$[6] = containerRef;
|
|
71
73
|
$[7] = mouseDownRef;
|
|
72
|
-
$[8] =
|
|
74
|
+
$[8] = t7;
|
|
73
75
|
} else {
|
|
74
|
-
|
|
76
|
+
t7 = $[8];
|
|
75
77
|
}
|
|
76
|
-
let
|
|
77
|
-
if ($[9] !== containerRef || $[10] !==
|
|
78
|
-
|
|
78
|
+
let t8;
|
|
79
|
+
if ($[9] !== containerRef || $[10] !== preventScroll || $[11] !== t5 || $[12] !== t6 || $[13] !== t7) {
|
|
80
|
+
t8 = {
|
|
79
81
|
containerRef,
|
|
80
82
|
bindKeys: FocusKeys.ArrowVertical | FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd | FocusKeys.Backspace | FocusKeys.PageUpDown,
|
|
81
|
-
preventScroll
|
|
82
|
-
getNextFocusable:
|
|
83
|
-
...
|
|
84
|
-
focusInStrategy:
|
|
83
|
+
preventScroll,
|
|
84
|
+
getNextFocusable: t5,
|
|
85
|
+
...t6,
|
|
86
|
+
focusInStrategy: t7
|
|
85
87
|
};
|
|
86
88
|
$[9] = containerRef;
|
|
87
|
-
$[10] =
|
|
89
|
+
$[10] = preventScroll;
|
|
88
90
|
$[11] = t5;
|
|
89
91
|
$[12] = t6;
|
|
90
92
|
$[13] = t7;
|
|
93
|
+
$[14] = t8;
|
|
91
94
|
} else {
|
|
92
|
-
|
|
95
|
+
t8 = $[14];
|
|
93
96
|
}
|
|
94
|
-
useFocusZone(
|
|
97
|
+
useFocusZone(t8, dependencies);
|
|
95
98
|
}
|
|
96
99
|
|
|
97
100
|
// DOM utilities used for focus management
|
package/package.json
CHANGED