@fanvue/ui 3.33.0 → 3.33.1

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.
@@ -45,6 +45,16 @@ function edgeOvershoot(rect, y) {
45
45
  }
46
46
  return 0;
47
47
  }
48
+ const POSITIONED = /* @__PURE__ */ new Set(["relative", "absolute", "fixed", "sticky"]);
49
+ function surfaceZIndex(element) {
50
+ let zIndex = null;
51
+ const { body } = element.ownerDocument;
52
+ for (let node = element.parentElement; node !== null && node !== body; node = node.parentElement) {
53
+ const { position, zIndex: candidate } = getComputedStyle(node);
54
+ if (POSITIONED.has(position) && candidate !== "" && candidate !== "auto") zIndex = candidate;
55
+ }
56
+ return zIndex;
57
+ }
48
58
  function useLatestRef(value) {
49
59
  const ref = React__namespace.useRef(value);
50
60
  React__namespace.useLayoutEffect(() => {
@@ -292,12 +302,10 @@ const DropdownMenuReorderGroup = React__namespace.forwardRef(
292
302
  measure(drag2);
293
303
  drag2.lifted = true;
294
304
  drag2.dropIndex = computeDropIndex(drag2, pointer.y);
295
- const surface = element.closest('[role="menu"],[role="dialog"]');
296
- const surfaceZIndex = surface === null ? "" : getComputedStyle(surface).zIndex;
297
305
  setLifted({
298
306
  value: drag2.value,
299
307
  width: rect.width,
300
- zIndex: surfaceZIndex === "" || surfaceZIndex === "auto" ? "var(--fanvue-ui-portal-z-index, 50)" : surfaceZIndex
308
+ zIndex: surfaceZIndex(element) ?? "var(--fanvue-ui-portal-z-index, 50)"
301
309
  });
302
310
  setDropIndex(drag2.dropIndex);
303
311
  },
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownMenuReorderGroup.cjs","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":["React","DropdownMenuVariantContext","drag","jsxs","cn","jsx","ReorderActionsContext","ReorderLiftedContext"],"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,MAAMA,iBAAM,OAAO,KAAK;AAC9BA,mBAAM,gBAAgB,MAAM;AAC1B,QAAI,UAAU;AAAA,EAChB,CAAC;AACD,SAAO;AACT;AAEA,SAAS,mBAAmB,GAAsB,GAA+B;AAC/E,SAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,CAAC,OAAO,UAAU,UAAU,EAAE,KAAK,CAAC;AAC9E;AACA,SAAS,2BAA2B,EAAE,OAAO,IAAI,SAA4C;AAC3F,SAAO,GAAG,KAAK,sBAAsB,KAAK,CAAC,OAAO,KAAK;AACzD;AA6DO,MAAM,2BAA2BA,iBAAM;AAAA,EAI5C,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA,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AC,SAAS;AACb,qBAAS,UAAU;AACnB,gBAAI,OAAO,QAAQ,YAAY;AAC7B,kBAAI,IAAI;AAAA,YACV,WAAW,KAAK;AACd,kBAAI,UAAU;AAAA,YAChB;AAAA,UACF;AAAA,UACA,MAAK;AAAA,UACL,gCAA6B;AAAA,UAC7B,WAAWC,GAAAA,GAAG,iCAAiC,SAAS;AAAA,UACvD,GAAG;AAAA,UAEJ,UAAA;AAAA,YAAAC,2BAAAA,IAACC,cAAAA,sBAAsB,UAAtB,EAA+B,OAAO,SACrC,UAAAD,2BAAAA,IAACE,cAAAA,qBAAqB,UAArB,EAA8B,OAAO,QAAS,SAAA,CAAS,EAAA,CAC1D;AAAA,YACC,qBACCJ,2BAAAA;AAAAA,cAAC;AAAA,cAAA;AAAA,gBACC,eAAY;AAAA,gBACZ,0BAAuB;AAAA,gBACvB,WAAU;AAAA,gBACV,OAAO,EAAE,KAAK,KAAK,MAAM,SAAS,EAAA;AAAA,gBAElC,UAAA;AAAA,kBAAAE,2BAAAA,IAAC,QAAA,EAAK,WAAU,kDAAA,CAAkD;AAAA,kBAClEA,2BAAAA,IAAC,QAAA,EAAK,WAAU,uDAAA,CAAuD;AAAA,gBAAA;AAAA,cAAA;AAAA,YAAA;AAAA,2CAG1E,QAAA,EAAK,IAAI,gBAAgB,WAAU,WACjC,UAAA,cACH;AAAA,YAEAA,2BAAAA,IAAC,UAAK,MAAK,UAAS,aAAU,UAAS,WAAU,WAC9C,UAAA,aAAA,CACH;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA;AAAA,EAGN;AACF;AACA,yBAAyB,cAAc;;"}
1
+ {"version":3,"file":"DropdownMenuReorderGroup.cjs","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\nconst POSITIONED = new Set([\"relative\", \"absolute\", \"fixed\", \"sticky\"]);\n\n// The z-index a row's surface paints at, or null when no positioned ancestor\n// carries one. The row's own menu / dialog element is not the place to read\n// it: Radix's popper copies the content's z-index onto its wrapper, which is\n// where the browser applies it — and a host may raise the wrapper further\n// (eden lifts `[data-radix-popper-content-wrapper]` above dialogs with\n// `!important`). Walking up to <body> and taking the outermost positioned\n// ancestor with a numeric z-index finds the value that wins in either variant.\nfunction surfaceZIndex(element: HTMLElement): string | null {\n let zIndex: string | null = null;\n const { body } = element.ownerDocument;\n for (\n let node = element.parentElement;\n node !== null && node !== body;\n node = node.parentElement\n ) {\n const { position, zIndex: candidate } = getComputedStyle(node);\n if (POSITIONED.has(position) && candidate !== \"\" && candidate !== \"auto\") zIndex = candidate;\n }\n return zIndex;\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 z the surface it\n // lifted from actually paints at — being appended later in the DOM keeps\n // the ghost above at equal z.\n setLifted({\n value: drag.value,\n width: rect.width,\n zIndex: surfaceZIndex(element) ?? \"var(--fanvue-ui-portal-z-index, 50)\",\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":["React","DropdownMenuVariantContext","drag","jsxs","cn","jsx","ReorderActionsContext","ReorderLiftedContext"],"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;AAEA,MAAM,iCAAiB,IAAI,CAAC,YAAY,YAAY,SAAS,QAAQ,CAAC;AAStE,SAAS,cAAc,SAAqC;AAC1D,M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UAAA;AAAA,kBAAAE,2BAAAA,IAAC,QAAA,EAAK,WAAU,kDAAA,CAAkD;AAAA,kBAClEA,2BAAAA,IAAC,QAAA,EAAK,WAAU,uDAAA,CAAuD;AAAA,gBAAA;AAAA,cAAA;AAAA,YAAA;AAAA,2CAG1E,QAAA,EAAK,IAAI,gBAAgB,WAAU,WACjC,UAAA,cACH;AAAA,YAEAA,2BAAAA,IAAC,UAAK,MAAK,UAAS,aAAU,UAAS,WAAU,WAC9C,UAAA,aAAA,CACH;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA;AAAA,EAGN;AACF;AACA,yBAAyB,cAAc;;"}
@@ -26,6 +26,16 @@ function edgeOvershoot(rect, y) {
26
26
  }
27
27
  return 0;
28
28
  }
29
+ const POSITIONED = /* @__PURE__ */ new Set(["relative", "absolute", "fixed", "sticky"]);
30
+ function surfaceZIndex(element) {
31
+ let zIndex = null;
32
+ const { body } = element.ownerDocument;
33
+ for (let node = element.parentElement; node !== null && node !== body; node = node.parentElement) {
34
+ const { position, zIndex: candidate } = getComputedStyle(node);
35
+ if (POSITIONED.has(position) && candidate !== "" && candidate !== "auto") zIndex = candidate;
36
+ }
37
+ return zIndex;
38
+ }
29
39
  function useLatestRef(value) {
30
40
  const ref = React.useRef(value);
31
41
  React.useLayoutEffect(() => {
@@ -273,12 +283,10 @@ const DropdownMenuReorderGroup = React.forwardRef(
273
283
  measure(drag2);
274
284
  drag2.lifted = true;
275
285
  drag2.dropIndex = computeDropIndex(drag2, pointer.y);
276
- const surface = element.closest('[role="menu"],[role="dialog"]');
277
- const surfaceZIndex = surface === null ? "" : getComputedStyle(surface).zIndex;
278
286
  setLifted({
279
287
  value: drag2.value,
280
288
  width: rect.width,
281
- zIndex: surfaceZIndex === "" || surfaceZIndex === "auto" ? "var(--fanvue-ui-portal-z-index, 50)" : surfaceZIndex
289
+ zIndex: surfaceZIndex(element) ?? "var(--fanvue-ui-portal-z-index, 50)"
282
290
  });
283
291
  setDropIndex(drag2.dropIndex);
284
292
  },
@@ -1 +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;AAEA,SAAS,mBAAmB,GAAsB,GAA+B;AAC/E,SAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,CAAC,OAAO,UAAU,UAAU,EAAE,KAAK,CAAC;AAC9E;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cAAc,MACd,cAAc,cACd,cAAc,aAAa;AAE7B;AAAA;AAAA,MAEE;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,KAAK,CAAC,SAAS;AACb,qBAAS,UAAU;AACnB,gBAAI,OAAO,QAAQ,YAAY;AAC7B,kBAAI,IAAI;AAAA,YACV,WAAW,KAAK;AACd,kBAAI,UAAU;AAAA,YAChB;AAAA,UACF;AAAA,UACA,MAAK;AAAA,UACL,gCAA6B;AAAA,UAC7B,WAAW,GAAG,iCAAiC,SAAS;AAAA,UACvD,GAAG;AAAA,UAEJ,UAAA;AAAA,YAAA,oBAAC,sBAAsB,UAAtB,EAA+B,OAAO,SACrC,UAAA,oBAAC,qBAAqB,UAArB,EAA8B,OAAO,QAAS,SAAA,CAAS,EAAA,CAC1D;AAAA,YACC,qBACC;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,eAAY;AAAA,gBACZ,0BAAuB;AAAA,gBACvB,WAAU;AAAA,gBACV,OAAO,EAAE,KAAK,KAAK,MAAM,SAAS,EAAA;AAAA,gBAElC,UAAA;AAAA,kBAAA,oBAAC,QAAA,EAAK,WAAU,kDAAA,CAAkD;AAAA,kBAClE,oBAAC,QAAA,EAAK,WAAU,uDAAA,CAAuD;AAAA,gBAAA;AAAA,cAAA;AAAA,YAAA;AAAA,gCAG1E,QAAA,EAAK,IAAI,gBAAgB,WAAU,WACjC,UAAA,cACH;AAAA,YAEA,oBAAC,UAAK,MAAK,UAAS,aAAU,UAAS,WAAU,WAC9C,UAAA,aAAA,CACH;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA;AAAA,EAGN;AACF;AACA,yBAAyB,cAAc;"}
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\nconst POSITIONED = new Set([\"relative\", \"absolute\", \"fixed\", \"sticky\"]);\n\n// The z-index a row's surface paints at, or null when no positioned ancestor\n// carries one. The row's own menu / dialog element is not the place to read\n// it: Radix's popper copies the content's z-index onto its wrapper, which is\n// where the browser applies it — and a host may raise the wrapper further\n// (eden lifts `[data-radix-popper-content-wrapper]` above dialogs with\n// `!important`). Walking up to <body> and taking the outermost positioned\n// ancestor with a numeric z-index finds the value that wins in either variant.\nfunction surfaceZIndex(element: HTMLElement): string | null {\n let zIndex: string | null = null;\n const { body } = element.ownerDocument;\n for (\n let node = element.parentElement;\n node !== null && node !== body;\n node = node.parentElement\n ) {\n const { position, zIndex: candidate } = getComputedStyle(node);\n if (POSITIONED.has(position) && candidate !== \"\" && candidate !== \"auto\") zIndex = candidate;\n }\n return zIndex;\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 z the surface it\n // lifted from actually paints at — being appended later in the DOM keeps\n // the ghost above at equal z.\n setLifted({\n value: drag.value,\n width: rect.width,\n zIndex: surfaceZIndex(element) ?? \"var(--fanvue-ui-portal-z-index, 50)\",\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;AAEA,MAAM,iCAAiB,IAAI,CAAC,YAAY,YAAY,SAAS,QAAQ,CAAC;AAStE,SAAS,cAAc,SAAqC;AAC1D,MAAI,SAAwB;AAC5B,QAAM,EAAE,SAAS,QAAQ;AACzB,WACM,OA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,UAAA,cACH;AAAA,YAEA,oBAAC,UAAK,MAAK,UAAS,aAAU,UAAS,WAAU,WAC9C,UAAA,aAAA,CACH;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA;AAAA,EAGN;AACF;AACA,yBAAyB,cAAc;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fanvue/ui",
3
- "version": "3.33.0",
3
+ "version": "3.33.1",
4
4
  "description": "React component library built with Tailwind CSS for Fanvue ecosystem",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org",