@fanvue/ui 3.31.0 → 3.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/cjs/components/ChatInput/ChatInput.cjs +6 -5
  2. package/dist/cjs/components/ChatInput/ChatInput.cjs.map +1 -1
  3. package/dist/cjs/components/DropdownMenu/DropdownMenuHeader.cjs +190 -0
  4. package/dist/cjs/components/DropdownMenu/DropdownMenuHeader.cjs.map +1 -0
  5. package/dist/cjs/components/DropdownMenu/DropdownMenuItem.cjs +213 -0
  6. package/dist/cjs/components/DropdownMenu/DropdownMenuItem.cjs.map +1 -0
  7. package/dist/cjs/components/DropdownMenu/DropdownMenuReorderGroup.cjs +438 -0
  8. package/dist/cjs/components/DropdownMenu/DropdownMenuReorderGroup.cjs.map +1 -0
  9. package/dist/cjs/components/DropdownMenu/DropdownMenuReorderItem.cjs +197 -0
  10. package/dist/cjs/components/DropdownMenu/DropdownMenuReorderItem.cjs.map +1 -0
  11. package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.cjs +221 -0
  12. package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.cjs.map +1 -0
  13. package/dist/cjs/components/DropdownMenu/DropdownMenuSelectionItems.cjs +128 -0
  14. package/dist/cjs/components/DropdownMenu/DropdownMenuSelectionItems.cjs.map +1 -0
  15. package/dist/cjs/components/DropdownMenu/context.cjs +26 -0
  16. package/dist/cjs/components/DropdownMenu/context.cjs.map +1 -0
  17. package/dist/cjs/components/DropdownMenu/reorderShared.cjs +38 -0
  18. package/dist/cjs/components/DropdownMenu/reorderShared.cjs.map +1 -0
  19. package/dist/cjs/index.cjs +19 -12
  20. package/dist/cjs/index.cjs.map +1 -1
  21. package/dist/components/ChatInput/ChatInput.mjs +2 -1
  22. package/dist/components/ChatInput/ChatInput.mjs.map +1 -1
  23. package/dist/components/DropdownMenu/DropdownMenuHeader.mjs +173 -0
  24. package/dist/components/DropdownMenu/DropdownMenuHeader.mjs.map +1 -0
  25. package/dist/components/DropdownMenu/DropdownMenuItem.mjs +195 -0
  26. package/dist/components/DropdownMenu/DropdownMenuItem.mjs.map +1 -0
  27. package/dist/components/DropdownMenu/DropdownMenuReorderGroup.mjs +421 -0
  28. package/dist/components/DropdownMenu/DropdownMenuReorderGroup.mjs.map +1 -0
  29. package/dist/components/DropdownMenu/DropdownMenuReorderItem.mjs +180 -0
  30. package/dist/components/DropdownMenu/DropdownMenuReorderItem.mjs.map +1 -0
  31. package/dist/components/DropdownMenu/DropdownMenuRoot.mjs +203 -0
  32. package/dist/components/DropdownMenu/DropdownMenuRoot.mjs.map +1 -0
  33. package/dist/components/DropdownMenu/DropdownMenuSelectionItems.mjs +110 -0
  34. package/dist/components/DropdownMenu/DropdownMenuSelectionItems.mjs.map +1 -0
  35. package/dist/components/DropdownMenu/context.mjs +9 -0
  36. package/dist/components/DropdownMenu/context.mjs.map +1 -0
  37. package/dist/components/DropdownMenu/reorderShared.mjs +21 -0
  38. package/dist/components/DropdownMenu/reorderShared.mjs.map +1 -0
  39. package/dist/index.d.ts +121 -1
  40. package/dist/index.mjs +8 -1
  41. package/dist/index.mjs.map +1 -1
  42. package/package.json +3 -2
  43. package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs +0 -598
  44. package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs.map +0 -1
  45. package/dist/components/DropdownMenu/DropdownMenu.mjs +0 -580
  46. package/dist/components/DropdownMenu/DropdownMenu.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropdownMenuReorderGroup.mjs","sources":["../../../src/components/DropdownMenu/DropdownMenuReorderGroup.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { DropdownMenuVariantContext } from \"./context\";\nimport {\n type DropdownMenuReorderDetail,\n type RegisteredReorderItem,\n type ReorderActions,\n ReorderActionsContext,\n type ReorderDrag,\n type ReorderLifted,\n ReorderLiftedContext,\n} from \"./reorderShared\";\n\n// Movement, in CSS px, below which a press-and-release on a reorder row still\n// counts as a click rather than a drag lift.\nconst REORDER_LIFT_THRESHOLD_PX = 4;\n\n// Distance from a scrollable menu's top/bottom edge within which a lifted drag\n// auto-scrolls it, and the fastest per-frame scroll step that ramps up as the\n// pointer nears the edge.\nconst REORDER_AUTOSCROLL_ZONE_PX = 32;\nconst REORDER_AUTOSCROLL_MAX_STEP_PX = 8;\n\nconst DEFAULT_REORDER_INSTRUCTIONS = \"Press the up and down arrow keys to move this item.\";\n\nfunction findScrollableAncestor(element: HTMLElement): HTMLElement | null {\n let current = element.parentElement;\n while (current !== null) {\n const { overflowY } = getComputedStyle(current);\n if (\n (overflowY === \"auto\" || overflowY === \"scroll\") &&\n current.scrollHeight > current.clientHeight\n ) {\n return current;\n }\n current = current.parentElement;\n }\n return null;\n}\n\n// How far past the auto-scroll zone the pointer sits: negative above the top\n// zone, positive below the bottom one, 0 when it is clear of both.\nfunction edgeOvershoot(rect: DOMRect, y: number): number {\n if (y < rect.top + REORDER_AUTOSCROLL_ZONE_PX) return y - (rect.top + REORDER_AUTOSCROLL_ZONE_PX);\n if (y > rect.bottom - REORDER_AUTOSCROLL_ZONE_PX) {\n return y - (rect.bottom - REORDER_AUTOSCROLL_ZONE_PX);\n }\n return 0;\n}\n\n// Keeps the latest value of a prop reachable from callbacks that must stay\n// referentially stable (they are handed to imperative listeners and a context).\nfunction useLatestRef<T>(value: T): React.RefObject<T> {\n const ref = React.useRef(value);\n React.useLayoutEffect(() => {\n ref.current = value;\n });\n return ref;\n}\n\nfunction shallowEqualArrays(a: readonly string[], b: readonly string[]): boolean {\n return a.length === b.length && a.every((value, index) => value === b[index]);\n}\nfunction defaultReorderAnnouncement({ label, to, total }: DropdownMenuReorderDetail): string {\n return `${label} moved to position ${to + 1} of ${total}`;\n}\n/** Props for the {@link DropdownMenuReorderGroup} component. */\nexport interface DropdownMenuReorderGroupProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n /**\n * Item values in their current order. Must contain one entry per\n * {@link DropdownMenuReorderItem} child, in the same order the children are\n * rendered.\n */\n values: string[];\n /**\n * Fires after a drop or a keyboard move completes with the new order, plus\n * which item moved and from/to where — enough to call a move-to-position\n * API without diffing the arrays.\n */\n onReorder: (values: string[], detail: DropdownMenuReorderDetail) => void;\n /**\n * Builds the text announced to screen readers after a move. Override to\n * localise it.\n * @default ({ label, to, total }) => `${label} moved to position ${to + 1} of ${total}`\n */\n getAnnouncement?: (detail: DropdownMenuReorderDetail) => string;\n /**\n * Screen-reader instructions attached to every drag handle. Override to\n * localise them.\n * @default \"Press the up and down arrow keys to move this item.\"\n */\n instructions?: string;\n}\n\n/**\n * A drag-to-reorder list of {@link DropdownMenuReorderItem} rows within a\n * dropdown menu — the \"Reorganise\" mode of `V2 Menu Dropdown`. Rows are\n * dragged with the pointer (from anywhere on the row with a mouse, from the\n * drag handle on touch) or moved with ArrowUp/ArrowDown on the focused\n * handle. Works in both the `\"menu\"` and `\"sheet\"` variants — for a long\n * list in a sheet, give the scrolling ancestor `overflow-y-auto` (the sheet\n * only caps its height) so edge auto-scroll has something to scroll.\n *\n * Inside a `\"menu\"`, Tab cycles through the handles and any header actions\n * (Radix menus otherwise swallow Tab), and the first handle takes focus when\n * the menu opens straight into the group.\n *\n * Pair with a {@link DropdownMenuHeader} whose `actions` contains a commit\n * button to exit the reorder mode.\n *\n * @example\n * ```tsx\n * <DropdownMenuReorderGroup\n * values={folders.map((folder) => folder.id)}\n * onReorder={(_, { value, to }) => moveFolder(value, to)}\n * aria-label=\"Reorder folders\"\n * >\n * {folders.map((folder) => (\n * <DropdownMenuReorderItem key={folder.id} value={folder.id} label={folder.name}>\n * {folder.name}\n * </DropdownMenuReorderItem>\n * ))}\n * </DropdownMenuReorderGroup>\n * ```\n */\nexport const DropdownMenuReorderGroup = React.forwardRef<\n HTMLDivElement,\n DropdownMenuReorderGroupProps\n>(\n (\n {\n values,\n onReorder,\n getAnnouncement = defaultReorderAnnouncement,\n instructions = DEFAULT_REORDER_INSTRUCTIONS,\n className,\n children,\n ...props\n },\n ref,\n ) => {\n const variant = React.useContext(DropdownMenuVariantContext);\n const instructionsId = React.useId();\n const groupRef = React.useRef<HTMLDivElement | null>(null);\n const itemsRef = React.useRef(new Map<string, RegisteredReorderItem>());\n const dragRef = React.useRef<ReorderDrag | null>(null);\n const ghostRef = React.useRef<HTMLDivElement | null>(null);\n const scrollContainerRef = React.useRef<HTMLElement | null>(null);\n const lastPointerRef = React.useRef<{ x: number; y: number } | null>(null);\n const autoScrollFrameRef = React.useRef<number | null>(null);\n const dragDisposersRef = React.useRef<Array<() => void>>([]);\n const valuesRef = useLatestRef(values);\n const onReorderRef = useLatestRef(onReorder);\n const getAnnouncementRef = useLatestRef(getAnnouncement);\n const [lifted, setLifted] = React.useState<ReorderLifted | null>(null);\n const [dropIndex, setDropIndex] = React.useState(-1);\n const [announcement, setAnnouncement] = React.useState(\"\");\n\n const registerItem = React.useCallback((value: string, item: RegisteredReorderItem | null) => {\n if (item === null) {\n itemsRef.current.delete(value);\n } else {\n itemsRef.current.set(value, item);\n }\n }, []);\n\n const positionGhost = React.useCallback(() => {\n const drag = dragRef.current;\n const ghost = ghostRef.current;\n const pointer = lastPointerRef.current;\n if (drag === null || ghost === null || pointer === null) return;\n // A transform, not left/top: it moves the ghost on the compositor\n // without invalidating layout, so nothing forces a reflow per move.\n ghost.style.transform = `translate3d(${pointer.x - drag.offsetX}px, ${pointer.y - drag.offsetY}px, 0)`;\n }, []);\n\n const registerGhost = React.useCallback(\n (element: HTMLDivElement | null) => {\n ghostRef.current = element;\n // The ghost mounts in the commit after the lift; place it straight away\n // rather than waiting for the next pointer move.\n if (element !== null) positionGhost();\n },\n [positionGhost],\n );\n\n // Reads every row rect once, in a single batch with no writes in between,\n // so it costs one layout flush per lift instead of one per pointer move.\n const measure = React.useCallback(\n (drag: ReorderDrag) => {\n const group = groupRef.current;\n if (group === null) return;\n const groupTop = group.getBoundingClientRect().top;\n const midpoints: number[] = [];\n const edges: number[] = [];\n let bottom = groupTop;\n for (const value of valuesRef.current) {\n const rect = itemsRef.current.get(value)?.element.getBoundingClientRect();\n if (rect === undefined) {\n midpoints.push(bottom);\n edges.push(bottom - groupTop);\n continue;\n }\n midpoints.push(rect.top + rect.height / 2);\n edges.push(rect.top - groupTop);\n bottom = rect.bottom;\n }\n edges.push(bottom - groupTop);\n drag.midpoints = midpoints;\n drag.edges = edges;\n const container = scrollContainerRef.current;\n drag.scrollTopAtMeasure = container?.scrollTop ?? 0;\n drag.containerRect = container?.getBoundingClientRect() ?? null;\n },\n [valuesRef],\n );\n\n // Rows only move when the container scrolls, so a pointer position in\n // measure-time coordinates is the live one shifted by the scroll delta.\n const computeDropIndex = React.useCallback((drag: ReorderDrag, clientY: number) => {\n const container = scrollContainerRef.current;\n const y = clientY + (container === null ? 0 : container.scrollTop - drag.scrollTopAtMeasure);\n let index = 0;\n for (const midpoint of drag.midpoints) {\n if (midpoint >= y) break;\n index += 1;\n }\n return index;\n }, []);\n\n const refreshDropIndex = React.useCallback(\n (drag: ReorderDrag, clientY: number) => {\n const next = computeDropIndex(drag, clientY);\n if (next === drag.dropIndex) return;\n drag.dropIndex = next;\n setDropIndex(next);\n },\n [computeDropIndex],\n );\n\n const stopAutoScroll = React.useCallback(() => {\n if (autoScrollFrameRef.current === null) return;\n cancelAnimationFrame(autoScrollFrameRef.current);\n autoScrollFrameRef.current = null;\n }, []);\n\n // Runs a frame loop only while the pointer sits in an edge zone of a\n // scrollable container; each frame scrolls one step and the container's\n // scroll event (below) moves the drop target. The loop ends by itself when\n // the pointer leaves the zone or the container runs out of scroll range.\n const updateAutoScroll = React.useCallback(() => {\n const drag = dragRef.current;\n const container = scrollContainerRef.current;\n const pointer = lastPointerRef.current;\n if (\n drag === null ||\n !drag.lifted ||\n container === null ||\n drag.containerRect === null ||\n pointer === null ||\n edgeOvershoot(drag.containerRect, pointer.y) === 0\n ) {\n stopAutoScroll();\n return;\n }\n if (autoScrollFrameRef.current !== null) return;\n const step = () => {\n autoScrollFrameRef.current = null;\n const current = dragRef.current;\n const latest = lastPointerRef.current;\n if (\n current === null ||\n !current.lifted ||\n current.containerRect === null ||\n latest === null\n ) {\n return;\n }\n const overshoot = edgeOvershoot(current.containerRect, latest.y);\n if (overshoot === 0) return;\n const amount = Math.min(Math.ceil(Math.abs(overshoot) / 4), REORDER_AUTOSCROLL_MAX_STEP_PX);\n const before = container.scrollTop;\n container.scrollTop = before + (overshoot < 0 ? -amount : amount);\n // At the end of the scroll range there is nothing more to do until the\n // pointer moves again.\n if (container.scrollTop === before) return;\n autoScrollFrameRef.current = requestAnimationFrame(step);\n };\n autoScrollFrameRef.current = requestAnimationFrame(step);\n }, [stopAutoScroll]);\n\n const clearDrag = React.useCallback(() => {\n stopAutoScroll();\n for (const dispose of dragDisposersRef.current) dispose();\n dragDisposersRef.current = [];\n const drag = dragRef.current;\n dragRef.current = null;\n lastPointerRef.current = null;\n scrollContainerRef.current = null;\n if (drag?.lifted) {\n setLifted(null);\n setDropIndex(-1);\n }\n }, [stopAutoScroll]);\n\n const applyReorder = React.useCallback(\n (value: string, from: number, to: number) => {\n const next = [...valuesRef.current];\n next.splice(from, 1);\n next.splice(to, 0, value);\n const detail: DropdownMenuReorderDetail = {\n value,\n label: itemsRef.current.get(value)?.label ?? value,\n from,\n to,\n total: next.length,\n };\n onReorderRef.current(next, detail);\n setAnnouncement(getAnnouncementRef.current(detail));\n },\n [valuesRef, onReorderRef, getAnnouncementRef],\n );\n\n const endDrag = React.useCallback(\n (pointerId: number, commit: boolean) => {\n const drag = dragRef.current;\n if (drag === null || pointerId !== drag.pointerId) return;\n clearDrag();\n if (!commit || !drag.lifted) return;\n const current = valuesRef.current;\n const from = current.indexOf(drag.value);\n if (from === -1) return;\n const to = Math.max(\n 0,\n Math.min(drag.dropIndex > from ? drag.dropIndex - 1 : drag.dropIndex, current.length - 1),\n );\n if (to === from) return;\n applyReorder(drag.value, from, to);\n },\n [clearDrag, applyReorder, valuesRef],\n );\n\n const startDrag = React.useCallback(\n (value: string, event: React.PointerEvent, element: HTMLDivElement) => {\n // One drag at a time: a second finger cannot hijack the first.\n if (dragRef.current !== null || groupRef.current === null) return false;\n dragRef.current = {\n value,\n pointerId: event.pointerId,\n element,\n startX: event.clientX,\n startY: event.clientY,\n offsetX: 0,\n offsetY: 0,\n lifted: false,\n dropIndex: -1,\n midpoints: [],\n edges: [],\n scrollTopAtMeasure: 0,\n containerRect: null,\n };\n lastPointerRef.current = { x: event.clientX, y: event.clientY };\n\n const view = element.ownerDocument.defaultView ?? window;\n // The row's own pointer handlers end the drag in the normal case. These\n // catch the pointer the row never sees again — the row unmounting\n // mid-drag (a list refetch) or its capture being lost — so a drag can't\n // be left half-finished with its listeners still attached.\n const onPointerUp = (pointerEvent: PointerEvent) => endDrag(pointerEvent.pointerId, true);\n const onPointerCancel = (pointerEvent: PointerEvent) =>\n endDrag(pointerEvent.pointerId, false);\n const onKeyDown = (keyEvent: KeyboardEvent) => {\n // Before the lift a press is still just a press: Escape must keep\n // closing the menu as usual.\n if (keyEvent.key !== \"Escape\" || dragRef.current?.lifted !== true) return;\n // Swallow it entirely so Radix's dismissable layer doesn't also close\n // the whole menu — Escape mid-drag only cancels the drag.\n keyEvent.preventDefault();\n keyEvent.stopPropagation();\n clearDrag();\n };\n view.addEventListener(\"pointerup\", onPointerUp);\n view.addEventListener(\"pointercancel\", onPointerCancel);\n view.addEventListener(\"keydown\", onKeyDown, true);\n dragDisposersRef.current.push(() => {\n view.removeEventListener(\"pointerup\", onPointerUp);\n view.removeEventListener(\"pointercancel\", onPointerCancel);\n view.removeEventListener(\"keydown\", onKeyDown, true);\n });\n return true;\n },\n [endDrag, clearDrag],\n );\n\n const lift = React.useCallback(\n (drag: ReorderDrag, pointer: { x: number; y: number }) => {\n const { element } = drag;\n const rect = element.getBoundingClientRect();\n drag.offsetX = drag.startX - rect.left;\n drag.offsetY = drag.startY - rect.top;\n\n const container = findScrollableAncestor(element);\n scrollContainerRef.current = container;\n if (container !== null) {\n // Covers both edge auto-scroll and the user wheel-scrolling mid-drag:\n // the pointer may not move again, so pointermove alone can't keep the\n // drop target honest.\n const onScroll = () => {\n const current = dragRef.current;\n const latest = lastPointerRef.current;\n if (current === null || !current.lifted || latest === null) return;\n refreshDropIndex(current, latest.y);\n };\n container.addEventListener(\"scroll\", onScroll, { passive: true });\n dragDisposersRef.current.push(() => container.removeEventListener(\"scroll\", onScroll));\n }\n\n measure(drag);\n drag.lifted = true;\n drag.dropIndex = computeDropIndex(drag, pointer.y);\n\n // The ghost is portalled to <body>, outside the menu's stacking context,\n // so it inherits none of the menu's z-index. Match the surface it lifted\n // from (the popper sets its own z, and a consumer may have raised it) —\n // being appended later in the DOM keeps it painted above at equal z.\n const surface = element.closest<HTMLElement>('[role=\"menu\"],[role=\"dialog\"]');\n const surfaceZIndex = surface === null ? \"\" : getComputedStyle(surface).zIndex;\n setLifted({\n value: drag.value,\n width: rect.width,\n zIndex:\n surfaceZIndex === \"\" || surfaceZIndex === \"auto\"\n ? \"var(--fanvue-ui-portal-z-index, 50)\"\n : surfaceZIndex,\n });\n setDropIndex(drag.dropIndex);\n },\n [measure, computeDropIndex, refreshDropIndex],\n );\n\n const updateDrag = React.useCallback(\n (event: React.PointerEvent) => {\n const drag = dragRef.current;\n if (drag === null || event.pointerId !== drag.pointerId) return;\n const pointer = { x: event.clientX, y: event.clientY };\n lastPointerRef.current = pointer;\n if (!drag.lifted) {\n if (\n Math.hypot(pointer.x - drag.startX, pointer.y - drag.startY) <=\n REORDER_LIFT_THRESHOLD_PX\n ) {\n return;\n }\n lift(drag, pointer);\n }\n positionGhost();\n refreshDropIndex(drag, pointer.y);\n updateAutoScroll();\n },\n [lift, positionGhost, refreshDropIndex, updateAutoScroll],\n );\n\n const moveItem = React.useCallback(\n (value: string, delta: number) => {\n const current = valuesRef.current;\n const from = current.indexOf(value);\n const to = from + delta;\n if (from === -1 || to < 0 || to >= current.length) return;\n applyReorder(value, from, to);\n },\n [applyReorder, valuesRef],\n );\n\n // Never leave listeners or a frame loop behind when the group goes away\n // mid-drag (the menu closing, for instance).\n React.useEffect(() => clearDrag, [clearDrag]);\n\n // The list changed under a drag: drop the drag if its row is gone, else\n // re-measure so the indicator tracks the rows' new positions.\n const previousValuesRef = React.useRef(values);\n React.useLayoutEffect(() => {\n if (shallowEqualArrays(previousValuesRef.current, values)) return;\n previousValuesRef.current = values;\n const drag = dragRef.current;\n if (drag === null) return;\n if (!values.includes(drag.value)) {\n clearDrag();\n return;\n }\n if (!drag.lifted) return;\n measure(drag);\n const pointer = lastPointerRef.current;\n if (pointer !== null) refreshDropIndex(drag, pointer.y);\n }, [values, clearDrag, measure, refreshDropIndex]);\n\n // Keyboard reachability inside a Radix menu. Radix parks focus on the menu\n // content when it opens and moves it only between menu items — which\n // these rows are not — so without help a keyboard user could never reach\n // a handle. When the menu opens straight into the group, the first handle\n // takes focus once Radix has finished its own focus work. And if focus has\n // fallen to <body> (the control that switched the menu into reorder mode\n // unmounted under it), Tab lands on the first handle instead of leaving\n // the menu for the page behind it.\n React.useEffect(() => {\n if (variant !== \"menu\") return;\n const group = groupRef.current;\n const menu = group?.closest<HTMLElement>('[role=\"menu\"]') ?? null;\n // Nothing to do outside a menu (the sheet variant, or a bare group).\n if (group === null || menu === null) return;\n const doc = group.ownerDocument;\n const focusFirstHandle = () => {\n const handle = group.querySelector<HTMLElement>(\"button:not(:disabled)\");\n if (handle === null) return false;\n handle.focus({ preventScroll: true });\n return true;\n };\n const frame = requestAnimationFrame(() => {\n const active = doc.activeElement;\n const parkedOnMenu = active === null || active === doc.body || active === menu;\n // A menu that also lists regular items keeps Radix's item-first\n // navigation; only claim focus when the group is all there is.\n const hasMenuItems = menu.querySelector('[role^=\"menuitem\"]') !== null;\n if (parkedOnMenu && !hasMenuItems) focusFirstHandle();\n });\n const rescueTab = (event: KeyboardEvent) => {\n if (event.key !== \"Tab\" || event.altKey || event.ctrlKey || event.metaKey) return;\n const active = doc.activeElement;\n if (active !== null && active !== doc.body) return;\n if (menu.getAttribute(\"data-state\") !== \"open\") return;\n if (focusFirstHandle()) event.preventDefault();\n };\n doc.addEventListener(\"keydown\", rescueTab, true);\n return () => {\n cancelAnimationFrame(frame);\n doc.removeEventListener(\"keydown\", rescueTab, true);\n };\n }, [variant]);\n\n const actions = React.useMemo<ReorderActions>(\n () => ({\n registerItem,\n registerGhost,\n startDrag,\n updateDrag,\n endDrag,\n moveItem,\n instructionsId,\n }),\n [registerItem, registerGhost, startDrag, updateDrag, endDrag, moveItem, instructionsId],\n );\n\n const drag = dragRef.current;\n const liftedFrom = lifted === null ? -1 : values.indexOf(lifted.value);\n const showDropIndicator =\n lifted !== null &&\n drag !== null &&\n dropIndex !== -1 &&\n dropIndex !== liftedFrom &&\n dropIndex !== liftedFrom + 1;\n\n return (\n // biome-ignore lint/a11y/useSemanticElements: <fieldset> carries form semantics and default styling we don't want inside a menu; role=\"group\" is the correct ARIA pattern here\n <div\n ref={(node) => {\n groupRef.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n }}\n role=\"group\"\n data-dropdown-menu-tab-stops=\"\"\n className={cn(\"relative flex w-full flex-col\", className)}\n {...props}\n >\n <ReorderActionsContext.Provider value={actions}>\n <ReorderLiftedContext.Provider value={lifted}>{children}</ReorderLiftedContext.Provider>\n </ReorderActionsContext.Provider>\n {showDropIndicator && (\n <div\n aria-hidden=\"true\"\n data-reorder-indicator=\"\"\n className=\"pointer-events-none absolute inset-x-3 z-10 flex -translate-y-1/2 items-center\"\n style={{ top: drag.edges[dropIndex] }}\n >\n <span className=\"size-2 shrink-0 rounded-full bg-content-primary\" />\n <span className=\"h-0.5 min-w-0 flex-1 rounded-full bg-content-primary\" />\n </div>\n )}\n <span id={instructionsId} className=\"sr-only\">\n {instructions}\n </span>\n {/* biome-ignore lint/a11y/useSemanticElements: <output> is not appropriate here; using role=\"status\" for live region announcements */}\n <span role=\"status\" aria-live=\"polite\" className=\"sr-only\">\n {announcement}\n </span>\n </div>\n );\n },\n);\nDropdownMenuReorderGroup.displayName = \"DropdownMenuReorderGroup\";\n"],"names":["drag"],"mappings":";;;;;;AAeA,MAAM,4BAA4B;AAKlC,MAAM,6BAA6B;AACnC,MAAM,iCAAiC;AAEvC,MAAM,+BAA+B;AAErC,SAAS,uBAAuB,SAA0C;AACxE,MAAI,UAAU,QAAQ;AACtB,SAAO,YAAY,MAAM;AACvB,UAAM,EAAE,UAAA,IAAc,iBAAiB,OAAO;AAC9C,SACG,cAAc,UAAU,cAAc,aACvC,QAAQ,eAAe,QAAQ,cAC/B;AACA,aAAO;AAAA,IACT;AACA,cAAU,QAAQ;AAAA,EACpB;AACA,SAAO;AACT;AAIA,SAAS,cAAc,MAAe,GAAmB;AACvD,MAAI,IAAI,KAAK,MAAM,2BAA4B,QAAO,KAAK,KAAK,MAAM;AACtE,MAAI,IAAI,KAAK,SAAS,4BAA4B;AAChD,WAAO,KAAK,KAAK,SAAS;AAAA,EAC5B;AACA,SAAO;AACT;AAIA,SAAS,aAAgB,OAA8B;AACrD,QAAM,MAAM,MAAM,OAAO,KAAK;AAC9B,QAAM,gBAAgB,MAAM;AAC1B,QAAI,UAAU;AAAA,EAChB,CAAC;AACD,SAAO;AACT;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,2BAA2B,MAAM;AAAA,EAI5C,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA,kBAAkB;AAAA,IAClB,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,UAAU,MAAM,WAAW,0BAA0B;AAC3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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;"}
@@ -0,0 +1,180 @@
1
+ "use client";
2
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { createPortal } from "react-dom";
5
+ import { cn } from "../../utils/cn.mjs";
6
+ import { DropdownMenuVariantContext } from "./context.mjs";
7
+ import { ReorderActionsContext, ReorderLiftedContext, DragHandleDots } from "./reorderShared.mjs";
8
+ const INTERACTIVE_CONTROL_SELECTOR = 'button, a[href], input, select, textarea, [role="button"]';
9
+ function canStartReorderDrag(event, handle) {
10
+ if (event.defaultPrevented || !(event.target instanceof Element)) return false;
11
+ const onHandle = handle?.contains(event.target) === true;
12
+ if (event.pointerType !== "mouse") return onHandle;
13
+ if (event.button !== 0) return false;
14
+ return onHandle || event.target.closest(INTERACTIVE_CONTROL_SELECTOR) === null;
15
+ }
16
+ function focusHandleAfterClick(event, handle) {
17
+ if (handle !== null && event.target instanceof Node && handle.contains(event.target)) {
18
+ handle.focus({ preventScroll: true });
19
+ }
20
+ }
21
+ function ReorderRowContent({
22
+ leadingIcon,
23
+ trailing,
24
+ children
25
+ }) {
26
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
27
+ leadingIcon != null && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: leadingIcon }),
28
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children }),
29
+ trailing != null && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: trailing })
30
+ ] });
31
+ }
32
+ function ReorderGhost({
33
+ lifted,
34
+ registerGhost,
35
+ container,
36
+ children
37
+ }) {
38
+ return createPortal(
39
+ /* @__PURE__ */ jsx(
40
+ "div",
41
+ {
42
+ "aria-hidden": "true",
43
+ "data-reorder-ghost": "",
44
+ ref: registerGhost,
45
+ className: "pointer-events-none fixed top-0 left-0 will-change-transform",
46
+ style: { width: lifted.width, zIndex: lifted.zIndex },
47
+ children: /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-sm bg-surface-primary/65 backdrop-blur-[20px]", children: /* @__PURE__ */ jsxs("div", { className: "typography-body-small-14px-regular flex min-h-10 items-center gap-2 bg-neutral-alphas-100 py-2 pr-6 pl-3 text-content-primary", children: [
48
+ /* @__PURE__ */ jsx(DragHandleDots, { className: "size-4 shrink-0 text-icons-tertiary" }),
49
+ children
50
+ ] }) })
51
+ }
52
+ ),
53
+ container
54
+ );
55
+ }
56
+ const DropdownMenuReorderItem = React.forwardRef(
57
+ ({
58
+ value,
59
+ label,
60
+ leadingIcon,
61
+ trailing,
62
+ dragHandleLabel = "Reorder",
63
+ disabled,
64
+ className,
65
+ children,
66
+ onPointerDown,
67
+ onPointerMove,
68
+ onPointerUp,
69
+ onPointerCancel,
70
+ ...props
71
+ }, ref) => {
72
+ const actions = React.useContext(ReorderActionsContext);
73
+ const lifted = React.useContext(ReorderLiftedContext);
74
+ const variant = React.useContext(DropdownMenuVariantContext);
75
+ const elementRef = React.useRef(null);
76
+ const handleRef = React.useRef(null);
77
+ const liftedHere = lifted !== null && lifted.value === value ? lifted : null;
78
+ const isLifted = liftedHere !== null;
79
+ const resolvedLabel = label ?? (typeof children === "string" || typeof children === "number" ? String(children) : value);
80
+ const grabCursor = isLifted ? "cursor-grabbing" : "cursor-grab";
81
+ const rowStateClasses = disabled ? "cursor-default text-content-disabled" : cn(grabCursor, isLifted ? "opacity-60" : "hover:bg-neutral-alphas-50");
82
+ const handleStateClasses = disabled ? "cursor-not-allowed [&>svg]:text-content-disabled" : grabCursor;
83
+ const setElement = React.useCallback(
84
+ (node) => {
85
+ elementRef.current = node;
86
+ if (typeof ref === "function") {
87
+ ref(node);
88
+ } else if (ref) {
89
+ ref.current = node;
90
+ }
91
+ },
92
+ [ref]
93
+ );
94
+ React.useLayoutEffect(() => {
95
+ const element = elementRef.current;
96
+ if (actions === null || element === null) return;
97
+ actions.registerItem(value, { element, label: resolvedLabel });
98
+ return () => actions.registerItem(value, null);
99
+ }, [actions, value, resolvedLabel]);
100
+ const rowContent = /* @__PURE__ */ jsx(ReorderRowContent, { leadingIcon, trailing, children });
101
+ return /* @__PURE__ */ jsxs(
102
+ "div",
103
+ {
104
+ ref: setElement,
105
+ "data-dragging": isLifted || void 0,
106
+ className: cn(
107
+ "typography-body-small-14px-regular group relative flex min-h-10 w-full select-none items-center gap-2 rounded-sm px-3 py-2 text-content-primary",
108
+ variant === "sheet" && "mx-3 w-auto",
109
+ rowStateClasses,
110
+ className
111
+ ),
112
+ ...props,
113
+ onPointerDown: (event) => {
114
+ onPointerDown?.(event);
115
+ const element = elementRef.current;
116
+ if (disabled || actions === null || element === null) return;
117
+ if (!canStartReorderDrag(event, handleRef.current)) return;
118
+ if (!actions.startDrag(value, event, element)) return;
119
+ event.preventDefault();
120
+ element.setPointerCapture?.(event.pointerId);
121
+ },
122
+ onPointerMove: (event) => {
123
+ onPointerMove?.(event);
124
+ actions?.updateDrag(event);
125
+ },
126
+ onPointerUp: (event) => {
127
+ onPointerUp?.(event);
128
+ actions?.endDrag(event.pointerId, true);
129
+ if (!isLifted) focusHandleAfterClick(event, handleRef.current);
130
+ },
131
+ onPointerCancel: (event) => {
132
+ onPointerCancel?.(event);
133
+ actions?.endDrag(event.pointerId, false);
134
+ },
135
+ children: [
136
+ /* @__PURE__ */ jsx(
137
+ "button",
138
+ {
139
+ ref: handleRef,
140
+ type: "button",
141
+ "aria-label": dragHandleLabel,
142
+ "aria-describedby": actions?.instructionsId,
143
+ disabled,
144
+ className: cn(
145
+ "relative flex size-4 shrink-0 touch-none items-center justify-center rounded-2xs outline-none focus-visible:shadow-focus-ring",
146
+ // The grip draws at 16px but is the only touch drag affordance, so
147
+ // its hit area extends 12px each way to the row's edges — a 40px
148
+ // target — without changing the glyph.
149
+ "before:absolute before:-inset-3 before:content-['']",
150
+ handleStateClasses
151
+ ),
152
+ onKeyDown: (event) => {
153
+ if (event.key !== "ArrowUp" && event.key !== "ArrowDown") return;
154
+ event.preventDefault();
155
+ event.stopPropagation();
156
+ actions?.moveItem(value, event.key === "ArrowUp" ? -1 : 1);
157
+ },
158
+ children: /* @__PURE__ */ jsx(DragHandleDots, { className: "size-4 text-icons-tertiary" })
159
+ }
160
+ ),
161
+ rowContent,
162
+ liftedHere !== null && actions !== null && /* @__PURE__ */ jsx(
163
+ ReorderGhost,
164
+ {
165
+ lifted: liftedHere,
166
+ registerGhost: actions.registerGhost,
167
+ container: elementRef.current?.ownerDocument.body ?? document.body,
168
+ children: rowContent
169
+ }
170
+ )
171
+ ]
172
+ }
173
+ );
174
+ }
175
+ );
176
+ DropdownMenuReorderItem.displayName = "DropdownMenuReorderItem";
177
+ export {
178
+ DropdownMenuReorderItem
179
+ };
180
+ //# sourceMappingURL=DropdownMenuReorderItem.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropdownMenuReorderItem.mjs","sources":["../../../src/components/DropdownMenu/DropdownMenuReorderItem.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { cn } from \"../../utils/cn\";\nimport { DropdownMenuVariantContext } from \"./context\";\nimport {\n DragHandleDots,\n type ReorderActions,\n ReorderActionsContext,\n type ReorderLifted,\n ReorderLiftedContext,\n} from \"./reorderShared\";\n\nconst INTERACTIVE_CONTROL_SELECTOR = 'button, a[href], input, select, textarea, [role=\"button\"]';\n\n// A drag starts from a primary mouse button anywhere on the row — except on\n// another control inside it (a `trailing` action, say), which keeps its click\n// and focus — or from the drag handle only for touch/pen, so the rest of the\n// row still scrolls a long menu with a finger.\nfunction canStartReorderDrag(event: React.PointerEvent, handle: HTMLElement | null): boolean {\n if (event.defaultPrevented || !(event.target instanceof Element)) return false;\n const onHandle = handle?.contains(event.target) === true;\n if (event.pointerType !== \"mouse\") return onHandle;\n if (event.button !== 0) return false;\n return onHandle || event.target.closest(INTERACTIVE_CONTROL_SELECTOR) === null;\n}\n\n// pointerdown's preventDefault (needed to stop text selection) also suppresses\n// focus, so a plain click on the grip focuses it here — ArrowUp/Down then work.\nfunction focusHandleAfterClick(event: React.PointerEvent, handle: HTMLElement | null): void {\n if (handle !== null && event.target instanceof Node && handle.contains(event.target)) {\n handle.focus({ preventScroll: true });\n }\n}\n// Icon, label and trailing slot of a row — rendered once in the row itself and\n// again inside its floating copy while lifted.\nfunction ReorderRowContent({\n leadingIcon,\n trailing,\n children,\n}: Pick<DropdownMenuReorderItemProps, \"leadingIcon\" | \"trailing\" | \"children\">) {\n return (\n <>\n {leadingIcon != null && <span className=\"shrink-0\">{leadingIcon}</span>}\n <span className=\"min-w-0 flex-1 truncate\">{children}</span>\n {trailing != null && <span className=\"shrink-0\">{trailing}</span>}\n </>\n );\n}\n\n// The floating copy of a lifted row. Anchored at the viewport origin and moved\n// with a transform (see the group's positionGhost) so each pointer move is\n// compositor work only.\nfunction ReorderGhost({\n lifted,\n registerGhost,\n container,\n children,\n}: {\n lifted: ReorderLifted;\n registerGhost: ReorderActions[\"registerGhost\"];\n container: Element;\n children: React.ReactNode;\n}) {\n return createPortal(\n <div\n aria-hidden=\"true\"\n data-reorder-ghost=\"\"\n ref={registerGhost}\n className=\"pointer-events-none fixed top-0 left-0 will-change-transform\"\n style={{ width: lifted.width, zIndex: lifted.zIndex }}\n >\n {/*\n * The design draws the floating copy as frosted glass — a translucent\n * surface with a heavy backdrop blur and no drop shadow (the same\n * treatment the panel itself gets) — so what the ghost passes over\n * smears through it.\n */}\n <div className=\"overflow-hidden rounded-sm bg-surface-primary/65 backdrop-blur-[20px]\">\n <div className=\"typography-body-small-14px-regular flex min-h-10 items-center gap-2 bg-neutral-alphas-100 py-2 pr-6 pl-3 text-content-primary\">\n <DragHandleDots className=\"size-4 shrink-0 text-icons-tertiary\" />\n {children}\n </div>\n </div>\n </div>,\n container,\n );\n}\n\n/** Props for the {@link DropdownMenuReorderItem} component. */\nexport interface DropdownMenuReorderItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Value identifying this item within the parent group's `values`. */\n value: string;\n /**\n * Plain-text name used in the group's screen-reader announcements and\n * reported in `onReorder`'s detail. Defaults to `children` when that is a\n * string or number, then to `value` — so pass it whenever `value` is an id.\n */\n label?: string;\n /** Icon (or other node) rendered between the drag handle and the label. */\n leadingIcon?: React.ReactNode;\n /** Content rendered at the end of the row, e.g. an item count. */\n trailing?: React.ReactNode;\n /** Accessible label for the drag handle button. @default \"Reorder\" */\n dragHandleLabel?: string;\n /** Disables dragging and keyboard reordering for this item. @default false */\n disabled?: boolean;\n}\n\n/**\n * A draggable row within a {@link DropdownMenuReorderGroup}. Shows the drag\n * handle grip, dims in place while its floating copy follows the pointer, and\n * supports ArrowUp/ArrowDown reordering when the handle has focus.\n */\nexport const DropdownMenuReorderItem = React.forwardRef<\n HTMLDivElement,\n DropdownMenuReorderItemProps\n>(\n (\n {\n value,\n label,\n leadingIcon,\n trailing,\n dragHandleLabel = \"Reorder\",\n disabled,\n className,\n children,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n onPointerCancel,\n ...props\n },\n ref,\n ) => {\n const actions = React.useContext(ReorderActionsContext);\n const lifted = React.useContext(ReorderLiftedContext);\n const variant = React.useContext(DropdownMenuVariantContext);\n const elementRef = React.useRef<HTMLDivElement | null>(null);\n const handleRef = React.useRef<HTMLButtonElement | null>(null);\n const liftedHere = lifted !== null && lifted.value === value ? lifted : null;\n const isLifted = liftedHere !== null;\n const resolvedLabel =\n label ??\n (typeof children === \"string\" || typeof children === \"number\" ? String(children) : value);\n const grabCursor = isLifted ? \"cursor-grabbing\" : \"cursor-grab\";\n // The design dims the lifted source row as a whole — 60% opacity over its\n // own colours — rather than swapping to the disabled tone.\n const rowStateClasses = disabled\n ? \"cursor-default text-content-disabled\"\n : cn(grabCursor, isLifted ? \"opacity-60\" : \"hover:bg-neutral-alphas-50\");\n const handleStateClasses = disabled\n ? \"cursor-not-allowed [&>svg]:text-content-disabled\"\n : grabCursor;\n\n const setElement = React.useCallback(\n (node: HTMLDivElement | null) => {\n elementRef.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n },\n [ref],\n );\n\n // Registered from an effect, not the ref callback, so re-renders don't\n // churn the group's registry with a delete + set per row.\n React.useLayoutEffect(() => {\n const element = elementRef.current;\n if (actions === null || element === null) return;\n actions.registerItem(value, { element, label: resolvedLabel });\n return () => actions.registerItem(value, null);\n }, [actions, value, resolvedLabel]);\n\n const rowContent = (\n <ReorderRowContent leadingIcon={leadingIcon} trailing={trailing}>\n {children}\n </ReorderRowContent>\n );\n\n return (\n <div\n ref={setElement}\n data-dragging={isLifted || undefined}\n className={cn(\n \"typography-body-small-14px-regular group relative flex min-h-10 w-full select-none items-center gap-2 rounded-sm px-3 py-2 text-content-primary\",\n variant === \"sheet\" && \"mx-3 w-auto\",\n rowStateClasses,\n className,\n )}\n {...props}\n onPointerDown={(event) => {\n onPointerDown?.(event);\n const element = elementRef.current;\n if (disabled || actions === null || element === null) return;\n if (!canStartReorderDrag(event, handleRef.current)) return;\n if (!actions.startDrag(value, event, element)) return;\n event.preventDefault();\n element.setPointerCapture?.(event.pointerId);\n }}\n onPointerMove={(event) => {\n onPointerMove?.(event);\n actions?.updateDrag(event);\n }}\n onPointerUp={(event) => {\n onPointerUp?.(event);\n actions?.endDrag(event.pointerId, true);\n if (!isLifted) focusHandleAfterClick(event, handleRef.current);\n }}\n onPointerCancel={(event) => {\n onPointerCancel?.(event);\n actions?.endDrag(event.pointerId, false);\n }}\n >\n <button\n ref={handleRef}\n type=\"button\"\n aria-label={dragHandleLabel}\n aria-describedby={actions?.instructionsId}\n disabled={disabled}\n className={cn(\n \"relative flex size-4 shrink-0 touch-none items-center justify-center rounded-2xs outline-none focus-visible:shadow-focus-ring\",\n // The grip draws at 16px but is the only touch drag affordance, so\n // its hit area extends 12px each way to the row's edges — a 40px\n // target — without changing the glyph.\n \"before:absolute before:-inset-3 before:content-['']\",\n handleStateClasses,\n )}\n onKeyDown={(event) => {\n if (event.key !== \"ArrowUp\" && event.key !== \"ArrowDown\") return;\n event.preventDefault();\n event.stopPropagation();\n actions?.moveItem(value, event.key === \"ArrowUp\" ? -1 : 1);\n }}\n >\n <DragHandleDots className=\"size-4 text-icons-tertiary\" />\n </button>\n {rowContent}\n {liftedHere !== null && actions !== null && (\n <ReorderGhost\n lifted={liftedHere}\n registerGhost={actions.registerGhost}\n container={elementRef.current?.ownerDocument.body ?? document.body}\n >\n {rowContent}\n </ReorderGhost>\n )}\n </div>\n );\n },\n);\nDropdownMenuReorderItem.displayName = \"DropdownMenuReorderItem\";\n"],"names":[],"mappings":";;;;;;;AAYA,MAAM,+BAA+B;AAMrC,SAAS,oBAAoB,OAA2B,QAAqC;AAC3F,MAAI,MAAM,oBAAoB,EAAE,MAAM,kBAAkB,SAAU,QAAO;AACzE,QAAM,WAAW,QAAQ,SAAS,MAAM,MAAM,MAAM;AACpD,MAAI,MAAM,gBAAgB,QAAS,QAAO;AAC1C,MAAI,MAAM,WAAW,EAAG,QAAO;AAC/B,SAA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Q;AAAA,cACvB,WAAW,WAAW,SAAS,cAAc,QAAQ,SAAS;AAAA,cAE7D,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AACA,wBAAwB,cAAc;"}
@@ -0,0 +1,203 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
4
+ import { useControllableState } from "@radix-ui/react-use-controllable-state";
5
+ import * as React from "react";
6
+ import { cn } from "../../utils/cn.mjs";
7
+ import { FLOATING_CONTENT_COLLISION_PADDING } from "../../utils/floatingContentCollisionPadding.mjs";
8
+ import { Drawer, DrawerContent, DrawerTrigger } from "../Drawer/Drawer.mjs";
9
+ import { DropdownMenuVariantContext, ToggleOpenContext } from "./context.mjs";
10
+ const TAP_MOVEMENT_THRESHOLD_PX = 10;
11
+ const TAB_STOPS_ATTRIBUTE = "data-dropdown-menu-tab-stops";
12
+ const FOCUSABLE_SELECTOR = "a[href], button, input, select, textarea, [tabindex]";
13
+ function getMenuTabStops(content) {
14
+ const stops = [];
15
+ for (const container of content.querySelectorAll(`[${TAB_STOPS_ATTRIBUTE}]`)) {
16
+ for (const element of container.querySelectorAll(FOCUSABLE_SELECTOR)) {
17
+ if (element.tabIndex < 0 || element.matches(":disabled") || element.hidden) continue;
18
+ stops.push(element);
19
+ }
20
+ }
21
+ return stops;
22
+ }
23
+ function cycleMenuTabStops(event) {
24
+ if (event.key !== "Tab" || event.altKey || event.ctrlKey || event.metaKey) return;
25
+ const target = event.target;
26
+ if (target.closest("[data-radix-menu-content]") !== event.currentTarget) return;
27
+ const stops = getMenuTabStops(event.currentTarget);
28
+ if (stops.length === 0) return;
29
+ event.preventDefault();
30
+ const index = stops.indexOf(target);
31
+ const last = stops.length - 1;
32
+ const next = event.shiftKey ? stops[index <= 0 ? last : index - 1] : stops[index === -1 || index === last ? 0 : index + 1];
33
+ next?.focus({ preventScroll: true });
34
+ }
35
+ function DropdownMenu({
36
+ open: openProp,
37
+ defaultOpen,
38
+ onOpenChange,
39
+ variant = "menu",
40
+ children,
41
+ ...props
42
+ }) {
43
+ const [open = false, setOpen] = useControllableState({
44
+ prop: openProp,
45
+ defaultProp: defaultOpen ?? false,
46
+ onChange: onOpenChange
47
+ });
48
+ if (variant === "sheet") {
49
+ return /* @__PURE__ */ jsx(DropdownMenuVariantContext.Provider, { value: "sheet", children: /* @__PURE__ */ jsx(ToggleOpenContext.Provider, { value: setOpen, children: /* @__PURE__ */ jsx(Drawer, { open, onOpenChange: setOpen, children }) }) });
50
+ }
51
+ return /* @__PURE__ */ jsx(DropdownMenuVariantContext.Provider, { value: "menu", children: /* @__PURE__ */ jsx(ToggleOpenContext.Provider, { value: setOpen, children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, { open, onOpenChange: setOpen, ...props, children }) }) });
52
+ }
53
+ const DropdownMenuTrigger = React.forwardRef((props, ref) => {
54
+ const variant = React.useContext(DropdownMenuVariantContext);
55
+ const toggleOpen = React.useContext(ToggleOpenContext);
56
+ const tapRef = React.useRef(null);
57
+ if (variant === "sheet") {
58
+ return /* @__PURE__ */ jsx(DrawerTrigger, { ...props, ref });
59
+ }
60
+ if (toggleOpen === null) {
61
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Trigger, { ...props, ref });
62
+ }
63
+ return /* @__PURE__ */ jsx(
64
+ DropdownMenuPrimitive.Trigger,
65
+ {
66
+ ...props,
67
+ ref,
68
+ onPointerDown: (event) => {
69
+ props.onPointerDown?.(event);
70
+ if (event.pointerType === "mouse" || props.disabled) return;
71
+ event.currentTarget.setPointerCapture?.(event.pointerId);
72
+ tapRef.current = {
73
+ pointerId: event.pointerId,
74
+ x: event.clientX,
75
+ y: event.clientY,
76
+ movedPastThreshold: false
77
+ };
78
+ event.preventDefault();
79
+ },
80
+ onPointerMove: (event) => {
81
+ props.onPointerMove?.(event);
82
+ const tap = tapRef.current;
83
+ if (tap === null || event.pointerId !== tap.pointerId || tap.movedPastThreshold) {
84
+ return;
85
+ }
86
+ const dx = event.clientX - tap.x;
87
+ const dy = event.clientY - tap.y;
88
+ if (Math.hypot(dx, dy) > TAP_MOVEMENT_THRESHOLD_PX) {
89
+ tap.movedPastThreshold = true;
90
+ }
91
+ },
92
+ onPointerUp: (event) => {
93
+ props.onPointerUp?.(event);
94
+ const tap = tapRef.current;
95
+ if (tap === null || event.pointerId !== tap.pointerId) return;
96
+ const wasDrag = tap.movedPastThreshold;
97
+ tapRef.current = null;
98
+ if (!wasDrag && !props.disabled) {
99
+ toggleOpen((prev) => !prev);
100
+ }
101
+ },
102
+ onPointerCancel: (event) => {
103
+ props.onPointerCancel?.(event);
104
+ const tap = tapRef.current;
105
+ if (tap !== null && event.pointerId === tap.pointerId) {
106
+ tapRef.current = null;
107
+ }
108
+ }
109
+ }
110
+ );
111
+ });
112
+ DropdownMenuTrigger.displayName = "DropdownMenuTrigger";
113
+ const DropdownMenuContent = React.forwardRef(
114
+ ({
115
+ className,
116
+ style,
117
+ sideOffset = 4,
118
+ // Radix defaults `avoidCollisions` to true, so passing `collisionPadding`
119
+ // is enough to keep the menu flipping/shifting to stay on screen — no
120
+ // hand-rolled reposition logic needed.
121
+ collisionPadding = FLOATING_CONTENT_COLLISION_PADDING,
122
+ onPointerDownOutside,
123
+ onCloseAutoFocus,
124
+ onKeyDown,
125
+ children,
126
+ ...props
127
+ }, ref) => {
128
+ const variant = React.useContext(DropdownMenuVariantContext);
129
+ const dismissedByPointer = React.useRef(false);
130
+ if (variant === "sheet") {
131
+ return /* @__PURE__ */ jsx(
132
+ DrawerContent,
133
+ {
134
+ ref,
135
+ position: "bottom",
136
+ variant: "menu",
137
+ overlayProps: { className: "backdrop-blur-[8px]" },
138
+ className: cn("flex flex-col gap-1 p-1 pb-4", className),
139
+ style,
140
+ onPointerDownOutside,
141
+ onCloseAutoFocus,
142
+ onKeyDown,
143
+ ...props,
144
+ children
145
+ }
146
+ );
147
+ }
148
+ return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
149
+ DropdownMenuPrimitive.Content,
150
+ {
151
+ ref,
152
+ onPointerDownOutside: (event) => {
153
+ dismissedByPointer.current = true;
154
+ onPointerDownOutside?.(event);
155
+ },
156
+ onCloseAutoFocus: (event) => {
157
+ if (dismissedByPointer.current) event.preventDefault();
158
+ dismissedByPointer.current = false;
159
+ onCloseAutoFocus?.(event);
160
+ },
161
+ onKeyDown: (event) => {
162
+ onKeyDown?.(event);
163
+ if (!event.defaultPrevented) cycleMenuTabStops(event);
164
+ },
165
+ sideOffset,
166
+ collisionPadding,
167
+ className: cn(
168
+ // `rounded-sm` (12px) is the panel radius `V2 Menu Dropdown` carries
169
+ // (product file node `7393:62008`). The 8px `rounded-xs` belongs to the
170
+ // rows inside it, not the panel.
171
+ //
172
+ // The `sheet` variant is deliberately not 12px: it renders through
173
+ // `DrawerContent variant="menu"`, whose `MENU_CLASSES` is `rounded-lg`
174
+ // (24px). A bottom sheet is a full-width surface with its own radius,
175
+ // not a scaled-up popper, so the two are meant to differ.
176
+ "w-max min-w-(--radix-dropdown-menu-trigger-width) max-w-(--radix-dropdown-menu-content-available-width) overflow-y-auto rounded-sm border border-border-primary bg-surface-primary p-1 text-content-primary shadow-blur-menu backdrop-blur-[4px]",
177
+ "data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:animate-in",
178
+ "data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:animate-out",
179
+ "data-[side=top]:slide-in-from-bottom-2 data-[side=bottom]:slide-in-from-top-2",
180
+ "data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2",
181
+ className
182
+ ),
183
+ style: {
184
+ zIndex: "var(--fanvue-ui-portal-z-index, 50)",
185
+ maxHeight: "var(--radix-dropdown-menu-content-available-height)",
186
+ ...style
187
+ },
188
+ ...props,
189
+ children
190
+ }
191
+ ) });
192
+ }
193
+ );
194
+ DropdownMenuContent.displayName = "DropdownMenuContent";
195
+ const DropdownMenuGroup = DropdownMenuPrimitive.Group;
196
+ DropdownMenuGroup.displayName = "DropdownMenuGroup";
197
+ export {
198
+ DropdownMenu,
199
+ DropdownMenuContent,
200
+ DropdownMenuGroup,
201
+ DropdownMenuTrigger
202
+ };
203
+ //# sourceMappingURL=DropdownMenuRoot.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropdownMenuRoot.mjs","sources":["../../../src/components/DropdownMenu/DropdownMenuRoot.tsx"],"sourcesContent":["import * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { FLOATING_CONTENT_COLLISION_PADDING } from \"../../utils/floatingContentCollisionPadding\";\nimport { Drawer, DrawerContent, DrawerTrigger } from \"../Drawer/Drawer\";\nimport { type DropdownMenuVariant, DropdownMenuVariantContext, ToggleOpenContext } from \"./context\";\n\n// Movement, in CSS px, above which a touch press-and-release counts as a drag.\nconst TAP_MOVEMENT_THRESHOLD_PX = 10;\n\n// Radix menus swallow Tab (a menu has no tab stops, only items), which strands\n// any non-item control rendered inside one — header actions, a search input,\n// reorder handles. Containers of such controls carry this attribute and\n// `DropdownMenuContent` cycles Tab through the focusable elements inside them.\nconst TAB_STOPS_ATTRIBUTE = \"data-dropdown-menu-tab-stops\";\nconst FOCUSABLE_SELECTOR = \"a[href], button, input, select, textarea, [tabindex]\";\n\nfunction getMenuTabStops(content: HTMLElement): HTMLElement[] {\n const stops: HTMLElement[] = [];\n for (const container of content.querySelectorAll<HTMLElement>(`[${TAB_STOPS_ATTRIBUTE}]`)) {\n for (const element of container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)) {\n if (element.tabIndex < 0 || element.matches(\":disabled\") || element.hidden) continue;\n stops.push(element);\n }\n }\n return stops;\n}\n\n// Cycles focus through the menu's tab stops on Tab / Shift+Tab, skipping menu\n// items (which keep their arrow-key navigation). Returns without acting when\n// the key isn't a plain Tab, came from a nested menu, or there is nothing to\n// cycle through — Radix then swallows the key as it always has.\nfunction cycleMenuTabStops(event: React.KeyboardEvent<HTMLElement>): void {\n if (event.key !== \"Tab\" || event.altKey || event.ctrlKey || event.metaKey) return;\n // A nested menu's keydowns bubble here through React's portal tree; they are\n // the nested menu's to handle.\n const target = event.target as HTMLElement;\n if (target.closest(\"[data-radix-menu-content]\") !== event.currentTarget) return;\n const stops = getMenuTabStops(event.currentTarget);\n if (stops.length === 0) return;\n // Prevented here so Radix's own handler (which would swallow the key) is\n // skipped — Radix composes it after ours and checks `defaultPrevented`.\n event.preventDefault();\n const index = stops.indexOf(target);\n const last = stops.length - 1;\n const next = event.shiftKey\n ? stops[index <= 0 ? last : index - 1]\n : stops[index === -1 || index === last ? 0 : index + 1];\n // Radix's FocusScope also sees this Tab (after us, ignoring\n // `defaultPrevented`), but a menu's scope is trapped without `loop`, so it\n // only prevents the default — it never moves focus itself.\n next?.focus({ preventScroll: true });\n}\n\ntype ActiveTap = {\n pointerId: number;\n x: number;\n y: number;\n movedPastThreshold: boolean;\n};\n\n/** Props for the {@link DropdownMenu} root component. */\nexport interface DropdownMenuProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Root> {\n /** How the menu presents its content. @default \"menu\" */\n variant?: DropdownMenuVariant;\n}\n\n/** Root component that manages open/close state for a dropdown menu. */\nexport function DropdownMenu({\n open: openProp,\n defaultOpen,\n onOpenChange,\n variant = \"menu\",\n children,\n ...props\n}: DropdownMenuProps) {\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n });\n\n if (variant === \"sheet\") {\n return (\n <DropdownMenuVariantContext.Provider value=\"sheet\">\n <ToggleOpenContext.Provider value={setOpen}>\n <Drawer open={open} onOpenChange={setOpen}>\n {children}\n </Drawer>\n </ToggleOpenContext.Provider>\n </DropdownMenuVariantContext.Provider>\n );\n }\n\n return (\n <DropdownMenuVariantContext.Provider value=\"menu\">\n <ToggleOpenContext.Provider value={setOpen}>\n <DropdownMenuPrimitive.Root open={open} onOpenChange={setOpen} {...props}>\n {children}\n </DropdownMenuPrimitive.Root>\n </ToggleOpenContext.Provider>\n </DropdownMenuVariantContext.Provider>\n );\n}\n\n/** Props for the {@link DropdownMenuTrigger} component. */\nexport type DropdownMenuTriggerProps = React.ComponentPropsWithoutRef<\n typeof DropdownMenuPrimitive.Trigger\n>;\n\n/**\n * The element that toggles the dropdown menu when clicked.\n *\n * On touch devices, the menu only opens if the press-and-release stays within\n * a small movement threshold. A drag that incidentally ends over the trigger\n * (common when scrolling a feed on Android Chrome) is ignored. Mouse and\n * keyboard interactions are unchanged.\n */\nexport const DropdownMenuTrigger = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Trigger>,\n DropdownMenuTriggerProps\n>((props, ref) => {\n const variant = React.useContext(DropdownMenuVariantContext);\n const toggleOpen = React.useContext(ToggleOpenContext);\n const tapRef = React.useRef<ActiveTap | null>(null);\n\n // The sheet variant opens a Drawer (Dialog), which already suppresses\n // scroll-drag-end synthetic clicks itself — no need for the touch-tap gating below.\n if (variant === \"sheet\") {\n return <DrawerTrigger {...props} ref={ref} />;\n }\n\n // Used outside our DropdownMenu wrapper — fall through to Radix defaults.\n if (toggleOpen === null) {\n return <DropdownMenuPrimitive.Trigger {...props} ref={ref} />;\n }\n\n return (\n <DropdownMenuPrimitive.Trigger\n {...props}\n ref={ref}\n onPointerDown={(event) => {\n props.onPointerDown?.(event);\n if (event.pointerType === \"mouse\" || props.disabled) return;\n // Keep pointerup / pointercancel on this element if the finger drifts off.\n // Optional because jsdom (used in tests) doesn't implement it.\n event.currentTarget.setPointerCapture?.(event.pointerId);\n tapRef.current = {\n pointerId: event.pointerId,\n x: event.clientX,\n y: event.clientY,\n movedPastThreshold: false,\n };\n // preventDefault stops Radix's pointerdown open path via composeEventHandlers.\n event.preventDefault();\n }}\n onPointerMove={(event) => {\n props.onPointerMove?.(event);\n const tap = tapRef.current;\n if (tap === null || event.pointerId !== tap.pointerId || tap.movedPastThreshold) {\n return;\n }\n const dx = event.clientX - tap.x;\n const dy = event.clientY - tap.y;\n if (Math.hypot(dx, dy) > TAP_MOVEMENT_THRESHOLD_PX) {\n tap.movedPastThreshold = true;\n }\n }}\n onPointerUp={(event) => {\n props.onPointerUp?.(event);\n const tap = tapRef.current;\n if (tap === null || event.pointerId !== tap.pointerId) return;\n const wasDrag = tap.movedPastThreshold;\n tapRef.current = null;\n if (!wasDrag && !props.disabled) {\n toggleOpen((prev) => !prev);\n }\n }}\n onPointerCancel={(event) => {\n props.onPointerCancel?.(event);\n const tap = tapRef.current;\n if (tap !== null && event.pointerId === tap.pointerId) {\n tapRef.current = null;\n }\n }}\n />\n );\n});\nDropdownMenuTrigger.displayName = \"DropdownMenuTrigger\";\n\n/** Props for the {@link DropdownMenuContent} component. */\nexport interface DropdownMenuContentProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content> {}\n\n/**\n * The positioned content panel rendered inside a portal.\n *\n * Override the portal z-index per-instance via `style={{ zIndex: 1500 }}` or\n * globally with the `--fanvue-ui-portal-z-index` CSS custom property.\n *\n * @example\n * ```tsx\n * <DropdownMenu>\n * <DropdownMenuTrigger asChild>\n * <Button>Open</Button>\n * </DropdownMenuTrigger>\n * <DropdownMenuContent>\n * <DropdownMenuItem>Option 1</DropdownMenuItem>\n * <DropdownMenuItem>Option 2</DropdownMenuItem>\n * </DropdownMenuContent>\n * </DropdownMenu>\n * ```\n */\nexport const DropdownMenuContent = React.forwardRef<\n React.ComponentRef<typeof DropdownMenuPrimitive.Content>,\n DropdownMenuContentProps\n>(\n (\n {\n className,\n style,\n sideOffset = 4,\n // Radix defaults `avoidCollisions` to true, so passing `collisionPadding`\n // is enough to keep the menu flipping/shifting to stay on screen — no\n // hand-rolled reposition logic needed.\n collisionPadding = FLOATING_CONTENT_COLLISION_PADDING,\n onPointerDownOutside,\n onCloseAutoFocus,\n onKeyDown,\n children,\n ...props\n },\n ref,\n ) => {\n const variant = React.useContext(DropdownMenuVariantContext);\n // Radix returns focus to the trigger when the menu closes. That is right for\n // the keyboard, but Chrome's :focus-visible heuristic also paints the ring on\n // that programmatic refocus, so dismissing with a click left a focus ring\n // sitting on the trigger. Track pointer dismissals and skip the restore for\n // them only — Escape and Tab still hand focus back with the ring.\n const dismissedByPointer = React.useRef(false);\n\n if (variant === \"sheet\") {\n return (\n <DrawerContent\n ref={ref}\n position=\"bottom\"\n // `\"sheet\"` sits flush to the bottom edge at full width; the design draws\n // this panel inset from all three sides and rounded on every corner, which\n // is `\"menu\"`. Both carry the same modal surface.\n variant=\"menu\"\n // The design's `blur + shadow/menu` effect is a background blur, and the\n // panel's own fill is opaque — so the blur has to go on the overlay to be\n // visible at all. Scoped here rather than on DrawerOverlay so only menus\n // shown this way blur the page behind them.\n overlayProps={{ className: \"backdrop-blur-[8px]\" }}\n // `pb-4` gives the design's 16px below the last row. The rows inset\n // themselves horizontally (see the item's `mx-3`) rather than the panel\n // padding doing it, so the header and its rule can still run full width.\n className={cn(\"flex flex-col gap-1 p-1 pb-4\", className)}\n style={style}\n // Both are destructured above for the popper branch's focus-ring\n // handling, which takes them out of `props` — so the sheet branch has\n // to re-attach them or they are silently dropped. `DrawerContent`\n // forwards them to its `DialogPrimitive.Content`, which supports both.\n // Consumers stack sheets on these (a nested sheet's `onCloseAutoFocus`\n // is the only point at which the parent knows the child has finished\n // animating out), so dropping them breaks the flow with no error.\n onPointerDownOutside={onPointerDownOutside}\n onCloseAutoFocus={onCloseAutoFocus}\n onKeyDown={onKeyDown}\n {...props}\n >\n {children}\n </DrawerContent>\n );\n }\n\n return (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n onPointerDownOutside={(event) => {\n dismissedByPointer.current = true;\n onPointerDownOutside?.(event);\n }}\n onCloseAutoFocus={(event) => {\n if (dismissedByPointer.current) event.preventDefault();\n dismissedByPointer.current = false;\n onCloseAutoFocus?.(event);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (!event.defaultPrevented) cycleMenuTabStops(event);\n }}\n sideOffset={sideOffset}\n collisionPadding={collisionPadding}\n className={cn(\n // `rounded-sm` (12px) is the panel radius `V2 Menu Dropdown` carries\n // (product file node `7393:62008`). The 8px `rounded-xs` belongs to the\n // rows inside it, not the panel.\n //\n // The `sheet` variant is deliberately not 12px: it renders through\n // `DrawerContent variant=\"menu\"`, whose `MENU_CLASSES` is `rounded-lg`\n // (24px). A bottom sheet is a full-width surface with its own radius,\n // not a scaled-up popper, so the two are meant to differ.\n \"w-max min-w-(--radix-dropdown-menu-trigger-width) max-w-(--radix-dropdown-menu-content-available-width) overflow-y-auto rounded-sm border border-border-primary bg-surface-primary p-1 text-content-primary shadow-blur-menu backdrop-blur-[4px]\",\n \"data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:animate-out\",\n \"data-[side=top]:slide-in-from-bottom-2 data-[side=bottom]:slide-in-from-top-2\",\n \"data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2\",\n className,\n )}\n style={{\n zIndex: \"var(--fanvue-ui-portal-z-index, 50)\",\n maxHeight: \"var(--radix-dropdown-menu-content-available-height)\",\n ...style,\n }}\n {...props}\n >\n {children}\n </DropdownMenuPrimitive.Content>\n </DropdownMenuPrimitive.Portal>\n );\n },\n);\nDropdownMenuContent.displayName = \"DropdownMenuContent\";\n\n/** Props for the {@link DropdownMenuGroup} component. */\nexport type DropdownMenuGroupProps = React.ComponentPropsWithoutRef<\n typeof DropdownMenuPrimitive.Group\n>;\n\n/**\n * Groups related menu items. Accepts an optional `DropdownMenuLabel`.\n *\n * Requires Radix menu context — not supported inside a `variant=\"sheet\"` menu.\n */\nexport const DropdownMenuGroup = DropdownMenuPrimitive.Group;\n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