@fanvue/ui 3.30.0 → 3.32.0
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/cjs/components/AiButton/AiButton.cjs +8 -6
- package/dist/cjs/components/AiButton/AiButton.cjs.map +1 -1
- package/dist/cjs/components/ChatInput/ChatInput.cjs +6 -5
- package/dist/cjs/components/ChatInput/ChatInput.cjs.map +1 -1
- package/dist/cjs/components/DropdownMenu/DropdownMenuHeader.cjs +190 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuHeader.cjs.map +1 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuItem.cjs +213 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuItem.cjs.map +1 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuReorderGroup.cjs +438 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuReorderGroup.cjs.map +1 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuReorderItem.cjs +197 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuReorderItem.cjs.map +1 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.cjs +221 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.cjs.map +1 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuSelectionItems.cjs +128 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenuSelectionItems.cjs.map +1 -0
- package/dist/cjs/components/DropdownMenu/context.cjs +26 -0
- package/dist/cjs/components/DropdownMenu/context.cjs.map +1 -0
- package/dist/cjs/components/DropdownMenu/reorderShared.cjs +38 -0
- package/dist/cjs/components/DropdownMenu/reorderShared.cjs.map +1 -0
- package/dist/cjs/components/SwitchButton/SwitchButton.cjs +97 -0
- package/dist/cjs/components/SwitchButton/SwitchButton.cjs.map +1 -0
- package/dist/cjs/index.cjs +21 -12
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/components/AiButton/AiButton.mjs +8 -6
- package/dist/components/AiButton/AiButton.mjs.map +1 -1
- package/dist/components/ChatInput/ChatInput.mjs +2 -1
- package/dist/components/ChatInput/ChatInput.mjs.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenuHeader.mjs +173 -0
- package/dist/components/DropdownMenu/DropdownMenuHeader.mjs.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenuItem.mjs +195 -0
- package/dist/components/DropdownMenu/DropdownMenuItem.mjs.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenuReorderGroup.mjs +421 -0
- package/dist/components/DropdownMenu/DropdownMenuReorderGroup.mjs.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenuReorderItem.mjs +180 -0
- package/dist/components/DropdownMenu/DropdownMenuReorderItem.mjs.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenuRoot.mjs +203 -0
- package/dist/components/DropdownMenu/DropdownMenuRoot.mjs.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenuSelectionItems.mjs +110 -0
- package/dist/components/DropdownMenu/DropdownMenuSelectionItems.mjs.map +1 -0
- package/dist/components/DropdownMenu/context.mjs +9 -0
- package/dist/components/DropdownMenu/context.mjs.map +1 -0
- package/dist/components/DropdownMenu/reorderShared.mjs +21 -0
- package/dist/components/DropdownMenu/reorderShared.mjs.map +1 -0
- package/dist/components/SwitchButton/SwitchButton.mjs +80 -0
- package/dist/components/SwitchButton/SwitchButton.mjs.map +1 -0
- package/dist/index.d.ts +223 -1
- package/dist/index.mjs +10 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
- package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs +0 -598
- package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs.map +0 -1
- package/dist/components/DropdownMenu/DropdownMenu.mjs +0 -580
- package/dist/components/DropdownMenu/DropdownMenu.mjs.map +0 -1
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../../utils/cn.mjs";
|
|
5
|
+
import { DropdownMenuVariantContext } from "./context.mjs";
|
|
6
|
+
import { ReorderActionsContext, ReorderLiftedContext } from "./reorderShared.mjs";
|
|
7
|
+
const REORDER_LIFT_THRESHOLD_PX = 4;
|
|
8
|
+
const REORDER_AUTOSCROLL_ZONE_PX = 32;
|
|
9
|
+
const REORDER_AUTOSCROLL_MAX_STEP_PX = 8;
|
|
10
|
+
const DEFAULT_REORDER_INSTRUCTIONS = "Press the up and down arrow keys to move this item.";
|
|
11
|
+
function findScrollableAncestor(element) {
|
|
12
|
+
let current = element.parentElement;
|
|
13
|
+
while (current !== null) {
|
|
14
|
+
const { overflowY } = getComputedStyle(current);
|
|
15
|
+
if ((overflowY === "auto" || overflowY === "scroll") && current.scrollHeight > current.clientHeight) {
|
|
16
|
+
return current;
|
|
17
|
+
}
|
|
18
|
+
current = current.parentElement;
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
function edgeOvershoot(rect, y) {
|
|
23
|
+
if (y < rect.top + REORDER_AUTOSCROLL_ZONE_PX) return y - (rect.top + REORDER_AUTOSCROLL_ZONE_PX);
|
|
24
|
+
if (y > rect.bottom - REORDER_AUTOSCROLL_ZONE_PX) {
|
|
25
|
+
return y - (rect.bottom - REORDER_AUTOSCROLL_ZONE_PX);
|
|
26
|
+
}
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
function useLatestRef(value) {
|
|
30
|
+
const ref = React.useRef(value);
|
|
31
|
+
React.useLayoutEffect(() => {
|
|
32
|
+
ref.current = value;
|
|
33
|
+
});
|
|
34
|
+
return ref;
|
|
35
|
+
}
|
|
36
|
+
function shallowEqualArrays(a, b) {
|
|
37
|
+
return a.length === b.length && a.every((value, index) => value === b[index]);
|
|
38
|
+
}
|
|
39
|
+
function defaultReorderAnnouncement({ label, to, total }) {
|
|
40
|
+
return `${label} moved to position ${to + 1} of ${total}`;
|
|
41
|
+
}
|
|
42
|
+
const DropdownMenuReorderGroup = React.forwardRef(
|
|
43
|
+
({
|
|
44
|
+
values,
|
|
45
|
+
onReorder,
|
|
46
|
+
getAnnouncement = defaultReorderAnnouncement,
|
|
47
|
+
instructions = DEFAULT_REORDER_INSTRUCTIONS,
|
|
48
|
+
className,
|
|
49
|
+
children,
|
|
50
|
+
...props
|
|
51
|
+
}, ref) => {
|
|
52
|
+
const variant = React.useContext(DropdownMenuVariantContext);
|
|
53
|
+
const instructionsId = React.useId();
|
|
54
|
+
const groupRef = React.useRef(null);
|
|
55
|
+
const itemsRef = React.useRef(/* @__PURE__ */ new Map());
|
|
56
|
+
const dragRef = React.useRef(null);
|
|
57
|
+
const ghostRef = React.useRef(null);
|
|
58
|
+
const scrollContainerRef = React.useRef(null);
|
|
59
|
+
const lastPointerRef = React.useRef(null);
|
|
60
|
+
const autoScrollFrameRef = React.useRef(null);
|
|
61
|
+
const dragDisposersRef = React.useRef([]);
|
|
62
|
+
const valuesRef = useLatestRef(values);
|
|
63
|
+
const onReorderRef = useLatestRef(onReorder);
|
|
64
|
+
const getAnnouncementRef = useLatestRef(getAnnouncement);
|
|
65
|
+
const [lifted, setLifted] = React.useState(null);
|
|
66
|
+
const [dropIndex, setDropIndex] = React.useState(-1);
|
|
67
|
+
const [announcement, setAnnouncement] = React.useState("");
|
|
68
|
+
const registerItem = React.useCallback((value, item) => {
|
|
69
|
+
if (item === null) {
|
|
70
|
+
itemsRef.current.delete(value);
|
|
71
|
+
} else {
|
|
72
|
+
itemsRef.current.set(value, item);
|
|
73
|
+
}
|
|
74
|
+
}, []);
|
|
75
|
+
const positionGhost = React.useCallback(() => {
|
|
76
|
+
const drag2 = dragRef.current;
|
|
77
|
+
const ghost = ghostRef.current;
|
|
78
|
+
const pointer = lastPointerRef.current;
|
|
79
|
+
if (drag2 === null || ghost === null || pointer === null) return;
|
|
80
|
+
ghost.style.transform = `translate3d(${pointer.x - drag2.offsetX}px, ${pointer.y - drag2.offsetY}px, 0)`;
|
|
81
|
+
}, []);
|
|
82
|
+
const registerGhost = React.useCallback(
|
|
83
|
+
(element) => {
|
|
84
|
+
ghostRef.current = element;
|
|
85
|
+
if (element !== null) positionGhost();
|
|
86
|
+
},
|
|
87
|
+
[positionGhost]
|
|
88
|
+
);
|
|
89
|
+
const measure = React.useCallback(
|
|
90
|
+
(drag2) => {
|
|
91
|
+
const group = groupRef.current;
|
|
92
|
+
if (group === null) return;
|
|
93
|
+
const groupTop = group.getBoundingClientRect().top;
|
|
94
|
+
const midpoints = [];
|
|
95
|
+
const edges = [];
|
|
96
|
+
let bottom = groupTop;
|
|
97
|
+
for (const value of valuesRef.current) {
|
|
98
|
+
const rect = itemsRef.current.get(value)?.element.getBoundingClientRect();
|
|
99
|
+
if (rect === void 0) {
|
|
100
|
+
midpoints.push(bottom);
|
|
101
|
+
edges.push(bottom - groupTop);
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
midpoints.push(rect.top + rect.height / 2);
|
|
105
|
+
edges.push(rect.top - groupTop);
|
|
106
|
+
bottom = rect.bottom;
|
|
107
|
+
}
|
|
108
|
+
edges.push(bottom - groupTop);
|
|
109
|
+
drag2.midpoints = midpoints;
|
|
110
|
+
drag2.edges = edges;
|
|
111
|
+
const container = scrollContainerRef.current;
|
|
112
|
+
drag2.scrollTopAtMeasure = container?.scrollTop ?? 0;
|
|
113
|
+
drag2.containerRect = container?.getBoundingClientRect() ?? null;
|
|
114
|
+
},
|
|
115
|
+
[valuesRef]
|
|
116
|
+
);
|
|
117
|
+
const computeDropIndex = React.useCallback((drag2, clientY) => {
|
|
118
|
+
const container = scrollContainerRef.current;
|
|
119
|
+
const y = clientY + (container === null ? 0 : container.scrollTop - drag2.scrollTopAtMeasure);
|
|
120
|
+
let index = 0;
|
|
121
|
+
for (const midpoint of drag2.midpoints) {
|
|
122
|
+
if (midpoint >= y) break;
|
|
123
|
+
index += 1;
|
|
124
|
+
}
|
|
125
|
+
return index;
|
|
126
|
+
}, []);
|
|
127
|
+
const refreshDropIndex = React.useCallback(
|
|
128
|
+
(drag2, clientY) => {
|
|
129
|
+
const next = computeDropIndex(drag2, clientY);
|
|
130
|
+
if (next === drag2.dropIndex) return;
|
|
131
|
+
drag2.dropIndex = next;
|
|
132
|
+
setDropIndex(next);
|
|
133
|
+
},
|
|
134
|
+
[computeDropIndex]
|
|
135
|
+
);
|
|
136
|
+
const stopAutoScroll = React.useCallback(() => {
|
|
137
|
+
if (autoScrollFrameRef.current === null) return;
|
|
138
|
+
cancelAnimationFrame(autoScrollFrameRef.current);
|
|
139
|
+
autoScrollFrameRef.current = null;
|
|
140
|
+
}, []);
|
|
141
|
+
const updateAutoScroll = React.useCallback(() => {
|
|
142
|
+
const drag2 = dragRef.current;
|
|
143
|
+
const container = scrollContainerRef.current;
|
|
144
|
+
const pointer = lastPointerRef.current;
|
|
145
|
+
if (drag2 === null || !drag2.lifted || container === null || drag2.containerRect === null || pointer === null || edgeOvershoot(drag2.containerRect, pointer.y) === 0) {
|
|
146
|
+
stopAutoScroll();
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (autoScrollFrameRef.current !== null) return;
|
|
150
|
+
const step = () => {
|
|
151
|
+
autoScrollFrameRef.current = null;
|
|
152
|
+
const current = dragRef.current;
|
|
153
|
+
const latest = lastPointerRef.current;
|
|
154
|
+
if (current === null || !current.lifted || current.containerRect === null || latest === null) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
const overshoot = edgeOvershoot(current.containerRect, latest.y);
|
|
158
|
+
if (overshoot === 0) return;
|
|
159
|
+
const amount = Math.min(Math.ceil(Math.abs(overshoot) / 4), REORDER_AUTOSCROLL_MAX_STEP_PX);
|
|
160
|
+
const before = container.scrollTop;
|
|
161
|
+
container.scrollTop = before + (overshoot < 0 ? -amount : amount);
|
|
162
|
+
if (container.scrollTop === before) return;
|
|
163
|
+
autoScrollFrameRef.current = requestAnimationFrame(step);
|
|
164
|
+
};
|
|
165
|
+
autoScrollFrameRef.current = requestAnimationFrame(step);
|
|
166
|
+
}, [stopAutoScroll]);
|
|
167
|
+
const clearDrag = React.useCallback(() => {
|
|
168
|
+
stopAutoScroll();
|
|
169
|
+
for (const dispose of dragDisposersRef.current) dispose();
|
|
170
|
+
dragDisposersRef.current = [];
|
|
171
|
+
const drag2 = dragRef.current;
|
|
172
|
+
dragRef.current = null;
|
|
173
|
+
lastPointerRef.current = null;
|
|
174
|
+
scrollContainerRef.current = null;
|
|
175
|
+
if (drag2?.lifted) {
|
|
176
|
+
setLifted(null);
|
|
177
|
+
setDropIndex(-1);
|
|
178
|
+
}
|
|
179
|
+
}, [stopAutoScroll]);
|
|
180
|
+
const applyReorder = React.useCallback(
|
|
181
|
+
(value, from, to) => {
|
|
182
|
+
const next = [...valuesRef.current];
|
|
183
|
+
next.splice(from, 1);
|
|
184
|
+
next.splice(to, 0, value);
|
|
185
|
+
const detail = {
|
|
186
|
+
value,
|
|
187
|
+
label: itemsRef.current.get(value)?.label ?? value,
|
|
188
|
+
from,
|
|
189
|
+
to,
|
|
190
|
+
total: next.length
|
|
191
|
+
};
|
|
192
|
+
onReorderRef.current(next, detail);
|
|
193
|
+
setAnnouncement(getAnnouncementRef.current(detail));
|
|
194
|
+
},
|
|
195
|
+
[valuesRef, onReorderRef, getAnnouncementRef]
|
|
196
|
+
);
|
|
197
|
+
const endDrag = React.useCallback(
|
|
198
|
+
(pointerId, commit) => {
|
|
199
|
+
const drag2 = dragRef.current;
|
|
200
|
+
if (drag2 === null || pointerId !== drag2.pointerId) return;
|
|
201
|
+
clearDrag();
|
|
202
|
+
if (!commit || !drag2.lifted) return;
|
|
203
|
+
const current = valuesRef.current;
|
|
204
|
+
const from = current.indexOf(drag2.value);
|
|
205
|
+
if (from === -1) return;
|
|
206
|
+
const to = Math.max(
|
|
207
|
+
0,
|
|
208
|
+
Math.min(drag2.dropIndex > from ? drag2.dropIndex - 1 : drag2.dropIndex, current.length - 1)
|
|
209
|
+
);
|
|
210
|
+
if (to === from) return;
|
|
211
|
+
applyReorder(drag2.value, from, to);
|
|
212
|
+
},
|
|
213
|
+
[clearDrag, applyReorder, valuesRef]
|
|
214
|
+
);
|
|
215
|
+
const startDrag = React.useCallback(
|
|
216
|
+
(value, event, element) => {
|
|
217
|
+
if (dragRef.current !== null || groupRef.current === null) return false;
|
|
218
|
+
dragRef.current = {
|
|
219
|
+
value,
|
|
220
|
+
pointerId: event.pointerId,
|
|
221
|
+
element,
|
|
222
|
+
startX: event.clientX,
|
|
223
|
+
startY: event.clientY,
|
|
224
|
+
offsetX: 0,
|
|
225
|
+
offsetY: 0,
|
|
226
|
+
lifted: false,
|
|
227
|
+
dropIndex: -1,
|
|
228
|
+
midpoints: [],
|
|
229
|
+
edges: [],
|
|
230
|
+
scrollTopAtMeasure: 0,
|
|
231
|
+
containerRect: null
|
|
232
|
+
};
|
|
233
|
+
lastPointerRef.current = { x: event.clientX, y: event.clientY };
|
|
234
|
+
const view = element.ownerDocument.defaultView ?? window;
|
|
235
|
+
const onPointerUp = (pointerEvent) => endDrag(pointerEvent.pointerId, true);
|
|
236
|
+
const onPointerCancel = (pointerEvent) => endDrag(pointerEvent.pointerId, false);
|
|
237
|
+
const onKeyDown = (keyEvent) => {
|
|
238
|
+
if (keyEvent.key !== "Escape" || dragRef.current?.lifted !== true) return;
|
|
239
|
+
keyEvent.preventDefault();
|
|
240
|
+
keyEvent.stopPropagation();
|
|
241
|
+
clearDrag();
|
|
242
|
+
};
|
|
243
|
+
view.addEventListener("pointerup", onPointerUp);
|
|
244
|
+
view.addEventListener("pointercancel", onPointerCancel);
|
|
245
|
+
view.addEventListener("keydown", onKeyDown, true);
|
|
246
|
+
dragDisposersRef.current.push(() => {
|
|
247
|
+
view.removeEventListener("pointerup", onPointerUp);
|
|
248
|
+
view.removeEventListener("pointercancel", onPointerCancel);
|
|
249
|
+
view.removeEventListener("keydown", onKeyDown, true);
|
|
250
|
+
});
|
|
251
|
+
return true;
|
|
252
|
+
},
|
|
253
|
+
[endDrag, clearDrag]
|
|
254
|
+
);
|
|
255
|
+
const lift = React.useCallback(
|
|
256
|
+
(drag2, pointer) => {
|
|
257
|
+
const { element } = drag2;
|
|
258
|
+
const rect = element.getBoundingClientRect();
|
|
259
|
+
drag2.offsetX = drag2.startX - rect.left;
|
|
260
|
+
drag2.offsetY = drag2.startY - rect.top;
|
|
261
|
+
const container = findScrollableAncestor(element);
|
|
262
|
+
scrollContainerRef.current = container;
|
|
263
|
+
if (container !== null) {
|
|
264
|
+
const onScroll = () => {
|
|
265
|
+
const current = dragRef.current;
|
|
266
|
+
const latest = lastPointerRef.current;
|
|
267
|
+
if (current === null || !current.lifted || latest === null) return;
|
|
268
|
+
refreshDropIndex(current, latest.y);
|
|
269
|
+
};
|
|
270
|
+
container.addEventListener("scroll", onScroll, { passive: true });
|
|
271
|
+
dragDisposersRef.current.push(() => container.removeEventListener("scroll", onScroll));
|
|
272
|
+
}
|
|
273
|
+
measure(drag2);
|
|
274
|
+
drag2.lifted = true;
|
|
275
|
+
drag2.dropIndex = computeDropIndex(drag2, pointer.y);
|
|
276
|
+
const surface = element.closest('[role="menu"],[role="dialog"]');
|
|
277
|
+
const surfaceZIndex = surface === null ? "" : getComputedStyle(surface).zIndex;
|
|
278
|
+
setLifted({
|
|
279
|
+
value: drag2.value,
|
|
280
|
+
width: rect.width,
|
|
281
|
+
zIndex: surfaceZIndex === "" || surfaceZIndex === "auto" ? "var(--fanvue-ui-portal-z-index, 50)" : surfaceZIndex
|
|
282
|
+
});
|
|
283
|
+
setDropIndex(drag2.dropIndex);
|
|
284
|
+
},
|
|
285
|
+
[measure, computeDropIndex, refreshDropIndex]
|
|
286
|
+
);
|
|
287
|
+
const updateDrag = React.useCallback(
|
|
288
|
+
(event) => {
|
|
289
|
+
const drag2 = dragRef.current;
|
|
290
|
+
if (drag2 === null || event.pointerId !== drag2.pointerId) return;
|
|
291
|
+
const pointer = { x: event.clientX, y: event.clientY };
|
|
292
|
+
lastPointerRef.current = pointer;
|
|
293
|
+
if (!drag2.lifted) {
|
|
294
|
+
if (Math.hypot(pointer.x - drag2.startX, pointer.y - drag2.startY) <= REORDER_LIFT_THRESHOLD_PX) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
lift(drag2, pointer);
|
|
298
|
+
}
|
|
299
|
+
positionGhost();
|
|
300
|
+
refreshDropIndex(drag2, pointer.y);
|
|
301
|
+
updateAutoScroll();
|
|
302
|
+
},
|
|
303
|
+
[lift, positionGhost, refreshDropIndex, updateAutoScroll]
|
|
304
|
+
);
|
|
305
|
+
const moveItem = React.useCallback(
|
|
306
|
+
(value, delta) => {
|
|
307
|
+
const current = valuesRef.current;
|
|
308
|
+
const from = current.indexOf(value);
|
|
309
|
+
const to = from + delta;
|
|
310
|
+
if (from === -1 || to < 0 || to >= current.length) return;
|
|
311
|
+
applyReorder(value, from, to);
|
|
312
|
+
},
|
|
313
|
+
[applyReorder, valuesRef]
|
|
314
|
+
);
|
|
315
|
+
React.useEffect(() => clearDrag, [clearDrag]);
|
|
316
|
+
const previousValuesRef = React.useRef(values);
|
|
317
|
+
React.useLayoutEffect(() => {
|
|
318
|
+
if (shallowEqualArrays(previousValuesRef.current, values)) return;
|
|
319
|
+
previousValuesRef.current = values;
|
|
320
|
+
const drag2 = dragRef.current;
|
|
321
|
+
if (drag2 === null) return;
|
|
322
|
+
if (!values.includes(drag2.value)) {
|
|
323
|
+
clearDrag();
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
if (!drag2.lifted) return;
|
|
327
|
+
measure(drag2);
|
|
328
|
+
const pointer = lastPointerRef.current;
|
|
329
|
+
if (pointer !== null) refreshDropIndex(drag2, pointer.y);
|
|
330
|
+
}, [values, clearDrag, measure, refreshDropIndex]);
|
|
331
|
+
React.useEffect(() => {
|
|
332
|
+
if (variant !== "menu") return;
|
|
333
|
+
const group = groupRef.current;
|
|
334
|
+
const menu = group?.closest('[role="menu"]') ?? null;
|
|
335
|
+
if (group === null || menu === null) return;
|
|
336
|
+
const doc = group.ownerDocument;
|
|
337
|
+
const focusFirstHandle = () => {
|
|
338
|
+
const handle = group.querySelector("button:not(:disabled)");
|
|
339
|
+
if (handle === null) return false;
|
|
340
|
+
handle.focus({ preventScroll: true });
|
|
341
|
+
return true;
|
|
342
|
+
};
|
|
343
|
+
const frame = requestAnimationFrame(() => {
|
|
344
|
+
const active = doc.activeElement;
|
|
345
|
+
const parkedOnMenu = active === null || active === doc.body || active === menu;
|
|
346
|
+
const hasMenuItems = menu.querySelector('[role^="menuitem"]') !== null;
|
|
347
|
+
if (parkedOnMenu && !hasMenuItems) focusFirstHandle();
|
|
348
|
+
});
|
|
349
|
+
const rescueTab = (event) => {
|
|
350
|
+
if (event.key !== "Tab" || event.altKey || event.ctrlKey || event.metaKey) return;
|
|
351
|
+
const active = doc.activeElement;
|
|
352
|
+
if (active !== null && active !== doc.body) return;
|
|
353
|
+
if (menu.getAttribute("data-state") !== "open") return;
|
|
354
|
+
if (focusFirstHandle()) event.preventDefault();
|
|
355
|
+
};
|
|
356
|
+
doc.addEventListener("keydown", rescueTab, true);
|
|
357
|
+
return () => {
|
|
358
|
+
cancelAnimationFrame(frame);
|
|
359
|
+
doc.removeEventListener("keydown", rescueTab, true);
|
|
360
|
+
};
|
|
361
|
+
}, [variant]);
|
|
362
|
+
const actions = React.useMemo(
|
|
363
|
+
() => ({
|
|
364
|
+
registerItem,
|
|
365
|
+
registerGhost,
|
|
366
|
+
startDrag,
|
|
367
|
+
updateDrag,
|
|
368
|
+
endDrag,
|
|
369
|
+
moveItem,
|
|
370
|
+
instructionsId
|
|
371
|
+
}),
|
|
372
|
+
[registerItem, registerGhost, startDrag, updateDrag, endDrag, moveItem, instructionsId]
|
|
373
|
+
);
|
|
374
|
+
const drag = dragRef.current;
|
|
375
|
+
const liftedFrom = lifted === null ? -1 : values.indexOf(lifted.value);
|
|
376
|
+
const showDropIndicator = lifted !== null && drag !== null && dropIndex !== -1 && dropIndex !== liftedFrom && dropIndex !== liftedFrom + 1;
|
|
377
|
+
return (
|
|
378
|
+
// biome-ignore lint/a11y/useSemanticElements: <fieldset> carries form semantics and default styling we don't want inside a menu; role="group" is the correct ARIA pattern here
|
|
379
|
+
/* @__PURE__ */ jsxs(
|
|
380
|
+
"div",
|
|
381
|
+
{
|
|
382
|
+
ref: (node) => {
|
|
383
|
+
groupRef.current = node;
|
|
384
|
+
if (typeof ref === "function") {
|
|
385
|
+
ref(node);
|
|
386
|
+
} else if (ref) {
|
|
387
|
+
ref.current = node;
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
role: "group",
|
|
391
|
+
"data-dropdown-menu-tab-stops": "",
|
|
392
|
+
className: cn("relative flex w-full flex-col", className),
|
|
393
|
+
...props,
|
|
394
|
+
children: [
|
|
395
|
+
/* @__PURE__ */ jsx(ReorderActionsContext.Provider, { value: actions, children: /* @__PURE__ */ jsx(ReorderLiftedContext.Provider, { value: lifted, children }) }),
|
|
396
|
+
showDropIndicator && /* @__PURE__ */ jsxs(
|
|
397
|
+
"div",
|
|
398
|
+
{
|
|
399
|
+
"aria-hidden": "true",
|
|
400
|
+
"data-reorder-indicator": "",
|
|
401
|
+
className: "pointer-events-none absolute inset-x-3 z-10 flex -translate-y-1/2 items-center",
|
|
402
|
+
style: { top: drag.edges[dropIndex] },
|
|
403
|
+
children: [
|
|
404
|
+
/* @__PURE__ */ jsx("span", { className: "size-2 shrink-0 rounded-full bg-content-primary" }),
|
|
405
|
+
/* @__PURE__ */ jsx("span", { className: "h-0.5 min-w-0 flex-1 rounded-full bg-content-primary" })
|
|
406
|
+
]
|
|
407
|
+
}
|
|
408
|
+
),
|
|
409
|
+
/* @__PURE__ */ jsx("span", { id: instructionsId, className: "sr-only", children: instructions }),
|
|
410
|
+
/* @__PURE__ */ jsx("span", { role: "status", "aria-live": "polite", className: "sr-only", children: announcement })
|
|
411
|
+
]
|
|
412
|
+
}
|
|
413
|
+
)
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
);
|
|
417
|
+
DropdownMenuReorderGroup.displayName = "DropdownMenuReorderGroup";
|
|
418
|
+
export {
|
|
419
|
+
DropdownMenuReorderGroup
|
|
420
|
+
};
|
|
421
|
+
//# sourceMappingURL=DropdownMenuReorderGroup.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownMenuReorderGroup.mjs","sources":["../../../src/components/DropdownMenu/DropdownMenuReorderGroup.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { DropdownMenuVariantContext } from \"./context\";\nimport {\n type DropdownMenuReorderDetail,\n type RegisteredReorderItem,\n type ReorderActions,\n ReorderActionsContext,\n type ReorderDrag,\n type ReorderLifted,\n ReorderLiftedContext,\n} from \"./reorderShared\";\n\n// Movement, in CSS px, below which a press-and-release on a reorder row still\n// counts as a click rather than a drag lift.\nconst REORDER_LIFT_THRESHOLD_PX = 4;\n\n// Distance from a scrollable menu's top/bottom edge within which a lifted drag\n// auto-scrolls it, and the fastest per-frame scroll step that ramps up as the\n// pointer nears the edge.\nconst REORDER_AUTOSCROLL_ZONE_PX = 32;\nconst REORDER_AUTOSCROLL_MAX_STEP_PX = 8;\n\nconst DEFAULT_REORDER_INSTRUCTIONS = \"Press the up and down arrow keys to move this item.\";\n\nfunction findScrollableAncestor(element: HTMLElement): HTMLElement | null {\n let current = element.parentElement;\n while (current !== null) {\n const { overflowY } = getComputedStyle(current);\n if (\n (overflowY === \"auto\" || overflowY === \"scroll\") &&\n current.scrollHeight > current.clientHeight\n ) {\n return current;\n }\n current = current.parentElement;\n }\n return null;\n}\n\n// How far past the auto-scroll zone the pointer sits: negative above the top\n// zone, positive below the bottom one, 0 when it is clear of both.\nfunction edgeOvershoot(rect: DOMRect, y: number): number {\n if (y < rect.top + REORDER_AUTOSCROLL_ZONE_PX) return y - (rect.top + REORDER_AUTOSCROLL_ZONE_PX);\n if (y > rect.bottom - REORDER_AUTOSCROLL_ZONE_PX) {\n return y - (rect.bottom - REORDER_AUTOSCROLL_ZONE_PX);\n }\n return 0;\n}\n\n// Keeps the latest value of a prop reachable from callbacks that must stay\n// referentially stable (they are handed to imperative listeners and a context).\nfunction useLatestRef<T>(value: T): React.RefObject<T> {\n const ref = React.useRef(value);\n React.useLayoutEffect(() => {\n ref.current = value;\n });\n return ref;\n}\n\nfunction shallowEqualArrays(a: readonly string[], b: readonly string[]): boolean {\n return a.length === b.length && a.every((value, index) => value === b[index]);\n}\nfunction defaultReorderAnnouncement({ label, to, total }: DropdownMenuReorderDetail): string {\n return `${label} moved to position ${to + 1} of ${total}`;\n}\n/** Props for the {@link DropdownMenuReorderGroup} component. */\nexport interface DropdownMenuReorderGroupProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n /**\n * Item values in their current order. Must contain one entry per\n * {@link DropdownMenuReorderItem} child, in the same order the children are\n * rendered.\n */\n values: string[];\n /**\n * Fires after a drop or a keyboard move completes with the new order, plus\n * which item moved and from/to where — enough to call a move-to-position\n * API without diffing the arrays.\n */\n onReorder: (values: string[], detail: DropdownMenuReorderDetail) => void;\n /**\n * Builds the text announced to screen readers after a move. Override to\n * localise it.\n * @default ({ label, to, total }) => `${label} moved to position ${to + 1} of ${total}`\n */\n getAnnouncement?: (detail: DropdownMenuReorderDetail) => string;\n /**\n * Screen-reader instructions attached to every drag handle. Override to\n * localise them.\n * @default \"Press the up and down arrow keys to move this item.\"\n */\n instructions?: string;\n}\n\n/**\n * A drag-to-reorder list of {@link DropdownMenuReorderItem} rows within a\n * dropdown menu — the \"Reorganise\" mode of `V2 Menu Dropdown`. Rows are\n * dragged with the pointer (from anywhere on the row with a mouse, from the\n * drag handle on touch) or moved with ArrowUp/ArrowDown on the focused\n * handle. Works in both the `\"menu\"` and `\"sheet\"` variants — for a long\n * list in a sheet, give the scrolling ancestor `overflow-y-auto` (the sheet\n * only caps its height) so edge auto-scroll has something to scroll.\n *\n * Inside a `\"menu\"`, Tab cycles through the handles and any header actions\n * (Radix menus otherwise swallow Tab), and the first handle takes focus when\n * the menu opens straight into the group.\n *\n * Pair with a {@link DropdownMenuHeader} whose `actions` contains a commit\n * button to exit the reorder mode.\n *\n * @example\n * ```tsx\n * <DropdownMenuReorderGroup\n * values={folders.map((folder) => folder.id)}\n * onReorder={(_, { value, to }) => moveFolder(value, to)}\n * aria-label=\"Reorder folders\"\n * >\n * {folders.map((folder) => (\n * <DropdownMenuReorderItem key={folder.id} value={folder.id} label={folder.name}>\n * {folder.name}\n * </DropdownMenuReorderItem>\n * ))}\n * </DropdownMenuReorderGroup>\n * ```\n */\nexport const DropdownMenuReorderGroup = React.forwardRef<\n HTMLDivElement,\n DropdownMenuReorderGroupProps\n>(\n (\n {\n values,\n onReorder,\n getAnnouncement = defaultReorderAnnouncement,\n instructions = DEFAULT_REORDER_INSTRUCTIONS,\n className,\n children,\n ...props\n },\n ref,\n ) => {\n const variant = React.useContext(DropdownMenuVariantContext);\n const instructionsId = React.useId();\n const groupRef = React.useRef<HTMLDivElement | null>(null);\n const itemsRef = React.useRef(new Map<string, RegisteredReorderItem>());\n const dragRef = React.useRef<ReorderDrag | null>(null);\n const ghostRef = React.useRef<HTMLDivElement | null>(null);\n const scrollContainerRef = React.useRef<HTMLElement | null>(null);\n const lastPointerRef = React.useRef<{ x: number; y: number } | null>(null);\n const autoScrollFrameRef = React.useRef<number | null>(null);\n const dragDisposersRef = React.useRef<Array<() => void>>([]);\n const valuesRef = useLatestRef(values);\n const onReorderRef = useLatestRef(onReorder);\n const getAnnouncementRef = useLatestRef(getAnnouncement);\n const [lifted, setLifted] = React.useState<ReorderLifted | null>(null);\n const [dropIndex, setDropIndex] = React.useState(-1);\n const [announcement, setAnnouncement] = React.useState(\"\");\n\n const registerItem = React.useCallback((value: string, item: RegisteredReorderItem | null) => {\n if (item === null) {\n itemsRef.current.delete(value);\n } else {\n itemsRef.current.set(value, item);\n }\n }, []);\n\n const positionGhost = React.useCallback(() => {\n const drag = dragRef.current;\n const ghost = ghostRef.current;\n const pointer = lastPointerRef.current;\n if (drag === null || ghost === null || pointer === null) return;\n // A transform, not left/top: it moves the ghost on the compositor\n // without invalidating layout, so nothing forces a reflow per move.\n ghost.style.transform = `translate3d(${pointer.x - drag.offsetX}px, ${pointer.y - drag.offsetY}px, 0)`;\n }, []);\n\n const registerGhost = React.useCallback(\n (element: HTMLDivElement | null) => {\n ghostRef.current = element;\n // The ghost mounts in the commit after the lift; place it straight away\n // rather than waiting for the next pointer move.\n if (element !== null) positionGhost();\n },\n [positionGhost],\n );\n\n // Reads every row rect once, in a single batch with no writes in between,\n // so it costs one layout flush per lift instead of one per pointer move.\n const measure = React.useCallback(\n (drag: ReorderDrag) => {\n const group = groupRef.current;\n if (group === null) return;\n const groupTop = group.getBoundingClientRect().top;\n const midpoints: number[] = [];\n const edges: number[] = [];\n let bottom = groupTop;\n for (const value of valuesRef.current) {\n const rect = itemsRef.current.get(value)?.element.getBoundingClientRect();\n if (rect === undefined) {\n midpoints.push(bottom);\n edges.push(bottom - groupTop);\n continue;\n }\n midpoints.push(rect.top + rect.height / 2);\n edges.push(rect.top - groupTop);\n bottom = rect.bottom;\n }\n edges.push(bottom - groupTop);\n drag.midpoints = midpoints;\n drag.edges = edges;\n const container = scrollContainerRef.current;\n drag.scrollTopAtMeasure = container?.scrollTop ?? 0;\n drag.containerRect = container?.getBoundingClientRect() ?? null;\n },\n [valuesRef],\n );\n\n // Rows only move when the container scrolls, so a pointer position in\n // measure-time coordinates is the live one shifted by the scroll delta.\n const computeDropIndex = React.useCallback((drag: ReorderDrag, clientY: number) => {\n const container = scrollContainerRef.current;\n const y = clientY + (container === null ? 0 : container.scrollTop - drag.scrollTopAtMeasure);\n let index = 0;\n for (const midpoint of drag.midpoints) {\n if (midpoint >= y) break;\n index += 1;\n }\n return index;\n }, []);\n\n const refreshDropIndex = React.useCallback(\n (drag: ReorderDrag, clientY: number) => {\n const next = computeDropIndex(drag, clientY);\n if (next === drag.dropIndex) return;\n drag.dropIndex = next;\n setDropIndex(next);\n },\n [computeDropIndex],\n );\n\n const stopAutoScroll = React.useCallback(() => {\n if (autoScrollFrameRef.current === null) return;\n cancelAnimationFrame(autoScrollFrameRef.current);\n autoScrollFrameRef.current = null;\n }, []);\n\n // Runs a frame loop only while the pointer sits in an edge zone of a\n // scrollable container; each frame scrolls one step and the container's\n // scroll event (below) moves the drop target. The loop ends by itself when\n // the pointer leaves the zone or the container runs out of scroll range.\n const updateAutoScroll = React.useCallback(() => {\n const drag = dragRef.current;\n const container = scrollContainerRef.current;\n const pointer = lastPointerRef.current;\n if (\n drag === null ||\n !drag.lifted ||\n container === null ||\n drag.containerRect === null ||\n pointer === null ||\n edgeOvershoot(drag.containerRect, pointer.y) === 0\n ) {\n stopAutoScroll();\n return;\n }\n if (autoScrollFrameRef.current !== null) return;\n const step = () => {\n autoScrollFrameRef.current = null;\n const current = dragRef.current;\n const latest = lastPointerRef.current;\n if (\n current === null ||\n !current.lifted ||\n current.containerRect === null ||\n latest === null\n ) {\n return;\n }\n const overshoot = edgeOvershoot(current.containerRect, latest.y);\n if (overshoot === 0) return;\n const amount = Math.min(Math.ceil(Math.abs(overshoot) / 4), REORDER_AUTOSCROLL_MAX_STEP_PX);\n const before = container.scrollTop;\n container.scrollTop = before + (overshoot < 0 ? -amount : amount);\n // At the end of the scroll range there is nothing more to do until the\n // pointer moves again.\n if (container.scrollTop === before) return;\n autoScrollFrameRef.current = requestAnimationFrame(step);\n };\n autoScrollFrameRef.current = requestAnimationFrame(step);\n }, [stopAutoScroll]);\n\n const clearDrag = React.useCallback(() => {\n stopAutoScroll();\n for (const dispose of dragDisposersRef.current) dispose();\n dragDisposersRef.current = [];\n const drag = dragRef.current;\n dragRef.current = null;\n lastPointerRef.current = null;\n scrollContainerRef.current = null;\n if (drag?.lifted) {\n setLifted(null);\n setDropIndex(-1);\n }\n }, [stopAutoScroll]);\n\n const applyReorder = React.useCallback(\n (value: string, from: number, to: number) => {\n const next = [...valuesRef.current];\n next.splice(from, 1);\n next.splice(to, 0, value);\n const detail: DropdownMenuReorderDetail = {\n value,\n label: itemsRef.current.get(value)?.label ?? value,\n from,\n to,\n total: next.length,\n };\n onReorderRef.current(next, detail);\n setAnnouncement(getAnnouncementRef.current(detail));\n },\n [valuesRef, onReorderRef, getAnnouncementRef],\n );\n\n const endDrag = React.useCallback(\n (pointerId: number, commit: boolean) => {\n const drag = dragRef.current;\n if (drag === null || pointerId !== drag.pointerId) return;\n clearDrag();\n if (!commit || !drag.lifted) return;\n const current = valuesRef.current;\n const from = current.indexOf(drag.value);\n if (from === -1) return;\n const to = Math.max(\n 0,\n Math.min(drag.dropIndex > from ? drag.dropIndex - 1 : drag.dropIndex, current.length - 1),\n );\n if (to === from) return;\n applyReorder(drag.value, from, to);\n },\n [clearDrag, applyReorder, valuesRef],\n );\n\n const startDrag = React.useCallback(\n (value: string, event: React.PointerEvent, element: HTMLDivElement) => {\n // One drag at a time: a second finger cannot hijack the first.\n if (dragRef.current !== null || groupRef.current === null) return false;\n dragRef.current = {\n value,\n pointerId: event.pointerId,\n element,\n startX: event.clientX,\n startY: event.clientY,\n offsetX: 0,\n offsetY: 0,\n lifted: false,\n dropIndex: -1,\n midpoints: [],\n edges: [],\n scrollTopAtMeasure: 0,\n containerRect: null,\n };\n lastPointerRef.current = { x: event.clientX, y: event.clientY };\n\n const view = element.ownerDocument.defaultView ?? window;\n // The row's own pointer handlers end the drag in the normal case. These\n // catch the pointer the row never sees again — the row unmounting\n // mid-drag (a list refetch) or its capture being lost — so a drag can't\n // be left half-finished with its listeners still attached.\n const onPointerUp = (pointerEvent: PointerEvent) => endDrag(pointerEvent.pointerId, true);\n const onPointerCancel = (pointerEvent: PointerEvent) =>\n endDrag(pointerEvent.pointerId, false);\n const onKeyDown = (keyEvent: KeyboardEvent) => {\n // Before the lift a press is still just a press: Escape must keep\n // closing the menu as usual.\n if (keyEvent.key !== \"Escape\" || dragRef.current?.lifted !== true) return;\n // Swallow it entirely so Radix's dismissable layer doesn't also close\n // the whole menu — Escape mid-drag only cancels the drag.\n keyEvent.preventDefault();\n keyEvent.stopPropagation();\n clearDrag();\n };\n view.addEventListener(\"pointerup\", onPointerUp);\n view.addEventListener(\"pointercancel\", onPointerCancel);\n view.addEventListener(\"keydown\", onKeyDown, true);\n dragDisposersRef.current.push(() => {\n view.removeEventListener(\"pointerup\", onPointerUp);\n view.removeEventListener(\"pointercancel\", onPointerCancel);\n view.removeEventListener(\"keydown\", onKeyDown, true);\n });\n return true;\n },\n [endDrag, clearDrag],\n );\n\n const lift = React.useCallback(\n (drag: ReorderDrag, pointer: { x: number; y: number }) => {\n const { element } = drag;\n const rect = element.getBoundingClientRect();\n drag.offsetX = drag.startX - rect.left;\n drag.offsetY = drag.startY - rect.top;\n\n const container = findScrollableAncestor(element);\n scrollContainerRef.current = container;\n if (container !== null) {\n // Covers both edge auto-scroll and the user wheel-scrolling mid-drag:\n // the pointer may not move again, so pointermove alone can't keep the\n // drop target honest.\n const onScroll = () => {\n const current = dragRef.current;\n const latest = lastPointerRef.current;\n if (current === null || !current.lifted || latest === null) return;\n refreshDropIndex(current, latest.y);\n };\n container.addEventListener(\"scroll\", onScroll, { passive: true });\n dragDisposersRef.current.push(() => container.removeEventListener(\"scroll\", onScroll));\n }\n\n measure(drag);\n drag.lifted = true;\n drag.dropIndex = computeDropIndex(drag, pointer.y);\n\n // The ghost is portalled to <body>, outside the menu's stacking context,\n // so it inherits none of the menu's z-index. Match the surface it lifted\n // from (the popper sets its own z, and a consumer may have raised it) —\n // being appended later in the DOM keeps it painted above at equal z.\n const surface = element.closest<HTMLElement>('[role=\"menu\"],[role=\"dialog\"]');\n const surfaceZIndex = surface === null ? \"\" : getComputedStyle(surface).zIndex;\n setLifted({\n value: drag.value,\n width: rect.width,\n zIndex:\n surfaceZIndex === \"\" || surfaceZIndex === \"auto\"\n ? \"var(--fanvue-ui-portal-z-index, 50)\"\n : surfaceZIndex,\n });\n setDropIndex(drag.dropIndex);\n },\n [measure, computeDropIndex, refreshDropIndex],\n );\n\n const updateDrag = React.useCallback(\n (event: React.PointerEvent) => {\n const drag = dragRef.current;\n if (drag === null || event.pointerId !== drag.pointerId) return;\n const pointer = { x: event.clientX, y: event.clientY };\n lastPointerRef.current = pointer;\n if (!drag.lifted) {\n if (\n Math.hypot(pointer.x - drag.startX, pointer.y - drag.startY) <=\n REORDER_LIFT_THRESHOLD_PX\n ) {\n return;\n }\n lift(drag, pointer);\n }\n positionGhost();\n refreshDropIndex(drag, pointer.y);\n updateAutoScroll();\n },\n [lift, positionGhost, refreshDropIndex, updateAutoScroll],\n );\n\n const moveItem = React.useCallback(\n (value: string, delta: number) => {\n const current = valuesRef.current;\n const from = current.indexOf(value);\n const to = from + delta;\n if (from === -1 || to < 0 || to >= current.length) return;\n applyReorder(value, from, to);\n },\n [applyReorder, valuesRef],\n );\n\n // Never leave listeners or a frame loop behind when the group goes away\n // mid-drag (the menu closing, for instance).\n React.useEffect(() => clearDrag, [clearDrag]);\n\n // The list changed under a drag: drop the drag if its row is gone, else\n // re-measure so the indicator tracks the rows' new positions.\n const previousValuesRef = React.useRef(values);\n React.useLayoutEffect(() => {\n if (shallowEqualArrays(previousValuesRef.current, values)) return;\n previousValuesRef.current = values;\n const drag = dragRef.current;\n if (drag === null) return;\n if (!values.includes(drag.value)) {\n clearDrag();\n return;\n }\n if (!drag.lifted) return;\n measure(drag);\n const pointer = lastPointerRef.current;\n if (pointer !== null) refreshDropIndex(drag, pointer.y);\n }, [values, clearDrag, measure, refreshDropIndex]);\n\n // Keyboard reachability inside a Radix menu. Radix parks focus on the menu\n // content when it opens and moves it only between menu items — which\n // these rows are not — so without help a keyboard user could never reach\n // a handle. When the menu opens straight into the group, the first handle\n // takes focus once Radix has finished its own focus work. And if focus has\n // fallen to <body> (the control that switched the menu into reorder mode\n // unmounted under it), Tab lands on the first handle instead of leaving\n // the menu for the page behind it.\n React.useEffect(() => {\n if (variant !== \"menu\") return;\n const group = groupRef.current;\n const menu = group?.closest<HTMLElement>('[role=\"menu\"]') ?? null;\n // Nothing to do outside a menu (the sheet variant, or a bare group).\n if (group === null || menu === null) return;\n const doc = group.ownerDocument;\n const focusFirstHandle = () => {\n const handle = group.querySelector<HTMLElement>(\"button:not(:disabled)\");\n if (handle === null) return false;\n handle.focus({ preventScroll: true });\n return true;\n };\n const frame = requestAnimationFrame(() => {\n const active = doc.activeElement;\n const parkedOnMenu = active === null || active === doc.body || active === menu;\n // A menu that also lists regular items keeps Radix's item-first\n // navigation; only claim focus when the group is all there is.\n const hasMenuItems = menu.querySelector('[role^=\"menuitem\"]') !== null;\n if (parkedOnMenu && !hasMenuItems) focusFirstHandle();\n });\n const rescueTab = (event: KeyboardEvent) => {\n if (event.key !== \"Tab\" || event.altKey || event.ctrlKey || event.metaKey) return;\n const active = doc.activeElement;\n if (active !== null && active !== doc.body) return;\n if (menu.getAttribute(\"data-state\") !== \"open\") return;\n if (focusFirstHandle()) event.preventDefault();\n };\n doc.addEventListener(\"keydown\", rescueTab, true);\n return () => {\n cancelAnimationFrame(frame);\n doc.removeEventListener(\"keydown\", rescueTab, true);\n };\n }, [variant]);\n\n const actions = React.useMemo<ReorderActions>(\n () => ({\n registerItem,\n registerGhost,\n startDrag,\n updateDrag,\n endDrag,\n moveItem,\n instructionsId,\n }),\n [registerItem, registerGhost, startDrag, updateDrag, endDrag, moveItem, instructionsId],\n );\n\n const drag = dragRef.current;\n const liftedFrom = lifted === null ? -1 : values.indexOf(lifted.value);\n const showDropIndicator =\n lifted !== null &&\n drag !== null &&\n dropIndex !== -1 &&\n dropIndex !== liftedFrom &&\n dropIndex !== liftedFrom + 1;\n\n return (\n // biome-ignore lint/a11y/useSemanticElements: <fieldset> carries form semantics and default styling we don't want inside a menu; role=\"group\" is the correct ARIA pattern here\n <div\n ref={(node) => {\n groupRef.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n }}\n role=\"group\"\n data-dropdown-menu-tab-stops=\"\"\n className={cn(\"relative flex w-full flex-col\", className)}\n {...props}\n >\n <ReorderActionsContext.Provider value={actions}>\n <ReorderLiftedContext.Provider value={lifted}>{children}</ReorderLiftedContext.Provider>\n </ReorderActionsContext.Provider>\n {showDropIndicator && (\n <div\n aria-hidden=\"true\"\n data-reorder-indicator=\"\"\n className=\"pointer-events-none absolute inset-x-3 z-10 flex -translate-y-1/2 items-center\"\n style={{ top: drag.edges[dropIndex] }}\n >\n <span className=\"size-2 shrink-0 rounded-full bg-content-primary\" />\n <span className=\"h-0.5 min-w-0 flex-1 rounded-full bg-content-primary\" />\n </div>\n )}\n <span id={instructionsId} className=\"sr-only\">\n {instructions}\n </span>\n {/* biome-ignore lint/a11y/useSemanticElements: <output> is not appropriate here; using role=\"status\" for live region announcements */}\n <span role=\"status\" aria-live=\"polite\" className=\"sr-only\">\n {announcement}\n </span>\n </div>\n );\n },\n);\nDropdownMenuReorderGroup.displayName = \"DropdownMenuReorderGroup\";\n"],"names":["drag"],"mappings":";;;;;;AAeA,MAAM,4BAA4B;AAKlC,MAAM,6BAA6B;AACnC,MAAM,iCAAiC;AAEvC,MAAM,+BAA+B;AAErC,SAAS,uBAAuB,SAA0C;AACxE,MAAI,UAAU,QAAQ;AACtB,SAAO,YAAY,MAAM;AACvB,UAAM,EAAE,UAAA,IAAc,iBAAiB,OAAO;AAC9C,SACG,cAAc,UAAU,cAAc,aACvC,QAAQ,eAAe,QAAQ,cAC/B;AACA,aAAO;AAAA,IACT;AACA,cAAU,QAAQ;AAAA,EACpB;AACA,SAAO;AACT;AAIA,SAAS,cAAc,MAAe,GAAmB;AACvD,MAAI,IAAI,KAAK,MAAM,2BAA4B,QAAO,KAAK,KAAK,MAAM;AACtE,MAAI,IAAI,KAAK,SAAS,4BAA4B;AAChD,WAAO,KAAK,KAAK,SAAS;AAAA,EAC5B;AACA,SAAO;AACT;AAIA,SAAS,aAAgB,OAA8B;AACrD,QAAM,MAAM,MAAM,OAAO,KAAK;AAC9B,QAAM,gBAAgB,MAAM;AAC1B,QAAI,UAAU;AAAA,EAChB,CAAC;AACD,SAAO;AACT;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