@radix-ui/react-roving-focus 1.0.5-rc.9 → 1.1.0-rc.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.
- package/dist/index.d.mts +27 -15
- package/dist/index.d.ts +27 -15
- package/dist/index.js +237 -256
- package/dist/index.js.map +7 -1
- package/dist/index.mjs +208 -240
- package/dist/index.mjs.map +7 -1
- package/package.json +10 -11
- package/dist/index.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,271 +1,252 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
(() => {
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
11
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
12
|
+
}) : x)(function(x) {
|
|
13
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
14
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
15
|
+
});
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
+
mod
|
|
31
|
+
));
|
|
32
|
+
|
|
33
|
+
// packages/react/roving-focus/src/RovingFocusGroup.tsx
|
|
34
|
+
var React = __toESM(__require("react"));
|
|
35
|
+
var import_primitive = __require("@radix-ui/primitive");
|
|
36
|
+
var import_react_collection = __require("@radix-ui/react-collection");
|
|
37
|
+
var import_react_compose_refs = __require("@radix-ui/react-compose-refs");
|
|
38
|
+
var import_react_context = __require("@radix-ui/react-context");
|
|
39
|
+
var import_react_id = __require("@radix-ui/react-id");
|
|
40
|
+
var import_react_primitive = __require("@radix-ui/react-primitive");
|
|
41
|
+
var import_react_use_callback_ref = __require("@radix-ui/react-use-callback-ref");
|
|
42
|
+
var import_react_use_controllable_state = __require("@radix-ui/react-use-controllable-state");
|
|
43
|
+
var import_react_direction = __require("@radix-ui/react-direction");
|
|
44
|
+
var import_jsx_runtime = __require("react/jsx-runtime");
|
|
45
|
+
var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
|
|
46
|
+
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
47
|
+
var GROUP_NAME = "RovingFocusGroup";
|
|
48
|
+
var [Collection, useCollection, createCollectionScope] = (0, import_react_collection.createCollection)(GROUP_NAME);
|
|
49
|
+
var [createRovingFocusGroupContext, createRovingFocusGroupScope] = (0, import_react_context.createContextScope)(
|
|
50
|
+
GROUP_NAME,
|
|
51
|
+
[createCollectionScope]
|
|
52
|
+
);
|
|
53
|
+
var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);
|
|
54
|
+
var RovingFocusGroup = React.forwardRef(
|
|
55
|
+
(props, forwardedRef) => {
|
|
56
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
RovingFocusGroup.displayName = GROUP_NAME;
|
|
60
|
+
var RovingFocusGroupImpl = React.forwardRef((props, forwardedRef) => {
|
|
61
|
+
const {
|
|
62
|
+
__scopeRovingFocusGroup,
|
|
63
|
+
orientation,
|
|
64
|
+
loop = false,
|
|
65
|
+
dir,
|
|
66
|
+
currentTabStopId: currentTabStopIdProp,
|
|
67
|
+
defaultCurrentTabStopId,
|
|
68
|
+
onCurrentTabStopIdChange,
|
|
69
|
+
onEntryFocus,
|
|
70
|
+
preventScrollOnEntryFocus = false,
|
|
71
|
+
...groupProps
|
|
72
|
+
} = props;
|
|
73
|
+
const ref = React.useRef(null);
|
|
74
|
+
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref);
|
|
75
|
+
const direction = (0, import_react_direction.useDirection)(dir);
|
|
76
|
+
const [currentTabStopId = null, setCurrentTabStopId] = (0, import_react_use_controllable_state.useControllableState)({
|
|
77
|
+
prop: currentTabStopIdProp,
|
|
78
|
+
defaultProp: defaultCurrentTabStopId,
|
|
79
|
+
onChange: onCurrentTabStopIdChange
|
|
70
80
|
});
|
|
71
|
-
const [isTabbingBackOut, setIsTabbingBackOut] =
|
|
72
|
-
const handleEntryFocus =
|
|
73
|
-
const getItems =
|
|
74
|
-
const isClickFocusRef =
|
|
75
|
-
const [focusableItemsCount, setFocusableItemsCount] =
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return /*#__PURE__*/ $9QJ9Y$react.createElement($0063afae63b3fa70$var$RovingFocusProvider, {
|
|
81
|
+
const [isTabbingBackOut, setIsTabbingBackOut] = React.useState(false);
|
|
82
|
+
const handleEntryFocus = (0, import_react_use_callback_ref.useCallbackRef)(onEntryFocus);
|
|
83
|
+
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
84
|
+
const isClickFocusRef = React.useRef(false);
|
|
85
|
+
const [focusableItemsCount, setFocusableItemsCount] = React.useState(0);
|
|
86
|
+
React.useEffect(() => {
|
|
87
|
+
const node = ref.current;
|
|
88
|
+
if (node) {
|
|
89
|
+
node.addEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
90
|
+
return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
91
|
+
}
|
|
92
|
+
}, [handleEntryFocus]);
|
|
93
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
94
|
+
RovingFocusProvider,
|
|
95
|
+
{
|
|
87
96
|
scope: __scopeRovingFocusGroup,
|
|
88
|
-
orientation
|
|
97
|
+
orientation,
|
|
89
98
|
dir: direction,
|
|
90
|
-
loop
|
|
91
|
-
currentTabStopId
|
|
92
|
-
onItemFocus:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
onItemShiftTab:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
onFocusableItemRemove:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
// instead, the wrapper will get focused and not through a bubbling event.
|
|
121
|
-
const isKeyboardFocus = !isClickFocusRef.current;
|
|
122
|
-
if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
|
|
123
|
-
const entryFocusEvent = new CustomEvent($0063afae63b3fa70$var$ENTRY_FOCUS, $0063afae63b3fa70$var$EVENT_OPTIONS);
|
|
99
|
+
loop,
|
|
100
|
+
currentTabStopId,
|
|
101
|
+
onItemFocus: React.useCallback(
|
|
102
|
+
(tabStopId) => setCurrentTabStopId(tabStopId),
|
|
103
|
+
[setCurrentTabStopId]
|
|
104
|
+
),
|
|
105
|
+
onItemShiftTab: React.useCallback(() => setIsTabbingBackOut(true), []),
|
|
106
|
+
onFocusableItemAdd: React.useCallback(
|
|
107
|
+
() => setFocusableItemsCount((prevCount) => prevCount + 1),
|
|
108
|
+
[]
|
|
109
|
+
),
|
|
110
|
+
onFocusableItemRemove: React.useCallback(
|
|
111
|
+
() => setFocusableItemsCount((prevCount) => prevCount - 1),
|
|
112
|
+
[]
|
|
113
|
+
),
|
|
114
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
115
|
+
import_react_primitive.Primitive.div,
|
|
116
|
+
{
|
|
117
|
+
tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
|
|
118
|
+
"data-orientation": orientation,
|
|
119
|
+
...groupProps,
|
|
120
|
+
ref: composedRefs,
|
|
121
|
+
style: { outline: "none", ...props.style },
|
|
122
|
+
onMouseDown: (0, import_primitive.composeEventHandlers)(props.onMouseDown, () => {
|
|
123
|
+
isClickFocusRef.current = true;
|
|
124
|
+
}),
|
|
125
|
+
onFocus: (0, import_primitive.composeEventHandlers)(props.onFocus, (event) => {
|
|
126
|
+
const isKeyboardFocus = !isClickFocusRef.current;
|
|
127
|
+
if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
|
|
128
|
+
const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
|
|
124
129
|
event.currentTarget.dispatchEvent(entryFocusEvent);
|
|
125
130
|
if (!entryFocusEvent.defaultPrevented) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
currentItem,
|
|
135
|
-
...items
|
|
136
|
-
].filter(Boolean);
|
|
137
|
-
const candidateNodes = candidateItems.map((item)=>item.ref.current
|
|
138
|
-
);
|
|
139
|
-
$0063afae63b3fa70$var$focusFirst(candidateNodes, preventScrollOnEntryFocus);
|
|
131
|
+
const items = getItems().filter((item) => item.focusable);
|
|
132
|
+
const activeItem = items.find((item) => item.active);
|
|
133
|
+
const currentItem = items.find((item) => item.id === currentTabStopId);
|
|
134
|
+
const candidateItems = [activeItem, currentItem, ...items].filter(
|
|
135
|
+
Boolean
|
|
136
|
+
);
|
|
137
|
+
const candidateNodes = candidateItems.map((item) => item.ref.current);
|
|
138
|
+
focusFirst(candidateNodes, preventScrollOnEntryFocus);
|
|
140
139
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
140
|
+
}
|
|
141
|
+
isClickFocusRef.current = false;
|
|
142
|
+
}),
|
|
143
|
+
onBlur: (0, import_primitive.composeEventHandlers)(props.onBlur, () => setIsTabbingBackOut(false))
|
|
144
|
+
}
|
|
145
145
|
)
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
});
|
|
149
|
+
var ITEM_NAME = "RovingFocusGroupItem";
|
|
150
|
+
var RovingFocusGroupItem = React.forwardRef(
|
|
151
|
+
(props, forwardedRef) => {
|
|
152
|
+
const {
|
|
153
|
+
__scopeRovingFocusGroup,
|
|
154
|
+
focusable = true,
|
|
155
|
+
active = false,
|
|
156
|
+
tabStopId,
|
|
157
|
+
...itemProps
|
|
158
|
+
} = props;
|
|
159
|
+
const autoId = (0, import_react_id.useId)();
|
|
160
|
+
const id = tabStopId || autoId;
|
|
161
|
+
const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup);
|
|
162
|
+
const isCurrentTabStop = context.currentTabStopId === id;
|
|
163
|
+
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
164
|
+
const { onFocusableItemAdd, onFocusableItemRemove } = context;
|
|
165
|
+
React.useEffect(() => {
|
|
160
166
|
if (focusable) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
;
|
|
167
|
+
onFocusableItemAdd();
|
|
168
|
+
return () => onFocusableItemRemove();
|
|
164
169
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
let candidateNodes = items.map((item)=>item.ref.current
|
|
201
|
-
);
|
|
202
|
-
if (focusIntent === 'last') candidateNodes.reverse();
|
|
203
|
-
else if (focusIntent === 'prev' || focusIntent === 'next') {
|
|
204
|
-
if (focusIntent === 'prev') candidateNodes.reverse();
|
|
170
|
+
}, [focusable, onFocusableItemAdd, onFocusableItemRemove]);
|
|
171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
172
|
+
Collection.ItemSlot,
|
|
173
|
+
{
|
|
174
|
+
scope: __scopeRovingFocusGroup,
|
|
175
|
+
id,
|
|
176
|
+
focusable,
|
|
177
|
+
active,
|
|
178
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
179
|
+
import_react_primitive.Primitive.span,
|
|
180
|
+
{
|
|
181
|
+
tabIndex: isCurrentTabStop ? 0 : -1,
|
|
182
|
+
"data-orientation": context.orientation,
|
|
183
|
+
...itemProps,
|
|
184
|
+
ref: forwardedRef,
|
|
185
|
+
onMouseDown: (0, import_primitive.composeEventHandlers)(props.onMouseDown, (event) => {
|
|
186
|
+
if (!focusable) event.preventDefault();
|
|
187
|
+
else context.onItemFocus(id);
|
|
188
|
+
}),
|
|
189
|
+
onFocus: (0, import_primitive.composeEventHandlers)(props.onFocus, () => context.onItemFocus(id)),
|
|
190
|
+
onKeyDown: (0, import_primitive.composeEventHandlers)(props.onKeyDown, (event) => {
|
|
191
|
+
if (event.key === "Tab" && event.shiftKey) {
|
|
192
|
+
context.onItemShiftTab();
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (event.target !== event.currentTarget) return;
|
|
196
|
+
const focusIntent = getFocusIntent(event, context.orientation, context.dir);
|
|
197
|
+
if (focusIntent !== void 0) {
|
|
198
|
+
if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
|
|
199
|
+
event.preventDefault();
|
|
200
|
+
const items = getItems().filter((item) => item.focusable);
|
|
201
|
+
let candidateNodes = items.map((item) => item.ref.current);
|
|
202
|
+
if (focusIntent === "last") candidateNodes.reverse();
|
|
203
|
+
else if (focusIntent === "prev" || focusIntent === "next") {
|
|
204
|
+
if (focusIntent === "prev") candidateNodes.reverse();
|
|
205
205
|
const currentIndex = candidateNodes.indexOf(event.currentTarget);
|
|
206
|
-
candidateNodes = context.loop ?
|
|
206
|
+
candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);
|
|
207
|
+
}
|
|
208
|
+
setTimeout(() => focusFirst(candidateNodes));
|
|
207
209
|
}
|
|
208
|
-
|
|
209
|
-
* Imperative focus during keydown is risky so we prevent React's batching updates
|
|
210
|
-
* to avoid potential bugs. See: https://github.com/facebook/react/issues/20332
|
|
211
|
-
*/ setTimeout(()=>$0063afae63b3fa70$var$focusFirst(candidateNodes)
|
|
212
|
-
);
|
|
210
|
+
})
|
|
213
211
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
if (orientation ===
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
if (orientation === 'horizontal' && [
|
|
242
|
-
'ArrowUp',
|
|
243
|
-
'ArrowDown'
|
|
244
|
-
].includes(key)) return undefined;
|
|
245
|
-
return $0063afae63b3fa70$var$MAP_KEY_TO_FOCUS_INTENT[key];
|
|
246
|
-
}
|
|
247
|
-
function $0063afae63b3fa70$var$focusFirst(candidates, preventScroll = false) {
|
|
212
|
+
)
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
);
|
|
217
|
+
RovingFocusGroupItem.displayName = ITEM_NAME;
|
|
218
|
+
var MAP_KEY_TO_FOCUS_INTENT = {
|
|
219
|
+
ArrowLeft: "prev",
|
|
220
|
+
ArrowUp: "prev",
|
|
221
|
+
ArrowRight: "next",
|
|
222
|
+
ArrowDown: "next",
|
|
223
|
+
PageUp: "first",
|
|
224
|
+
Home: "first",
|
|
225
|
+
PageDown: "last",
|
|
226
|
+
End: "last"
|
|
227
|
+
};
|
|
228
|
+
function getDirectionAwareKey(key, dir) {
|
|
229
|
+
if (dir !== "rtl") return key;
|
|
230
|
+
return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
|
|
231
|
+
}
|
|
232
|
+
function getFocusIntent(event, orientation, dir) {
|
|
233
|
+
const key = getDirectionAwareKey(event.key, dir);
|
|
234
|
+
if (orientation === "vertical" && ["ArrowLeft", "ArrowRight"].includes(key)) return void 0;
|
|
235
|
+
if (orientation === "horizontal" && ["ArrowUp", "ArrowDown"].includes(key)) return void 0;
|
|
236
|
+
return MAP_KEY_TO_FOCUS_INTENT[key];
|
|
237
|
+
}
|
|
238
|
+
function focusFirst(candidates, preventScroll = false) {
|
|
248
239
|
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
249
|
-
for (const candidate of candidates){
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
preventScroll: preventScroll
|
|
254
|
-
});
|
|
255
|
-
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
240
|
+
for (const candidate of candidates) {
|
|
241
|
+
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
242
|
+
candidate.focus({ preventScroll });
|
|
243
|
+
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
256
244
|
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}
|
|
265
|
-
const $0063afae63b3fa70$export$be92b6f5f03c0fe9 = $0063afae63b3fa70$export$8699f7c8af148338;
|
|
266
|
-
const $0063afae63b3fa70$export$6d08773d2e66f8f2 = $0063afae63b3fa70$export$ab9df7c53fe8454;
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
245
|
+
}
|
|
246
|
+
function wrapArray(array, startIndex) {
|
|
247
|
+
return array.map((_, index) => array[(startIndex + index) % array.length]);
|
|
248
|
+
}
|
|
249
|
+
var Root = RovingFocusGroup;
|
|
250
|
+
var Item = RovingFocusGroupItem;
|
|
251
|
+
})();
|
|
271
252
|
//# sourceMappingURL=index.js.map
|