{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "menu",
  "title": "Menu",
  "description": "A list of actions that opens from a button, from a right-click or long press, or from a menubar, with one API for all three.",
  "dependencies": [
    "@base-ui/react@^1.8.0"
  ],
  "registryDependencies": [
    "@ouro/kbd",
    "@ouro/lib-class-name-check",
    "@ouro/lib-cn",
    "@ouro/lib-dev",
    "@ouro/lib-env",
    "@ouro/lib-floating",
    "@ouro/lib-key-shortcuts",
    "@ouro/lib-page-direction",
    "@ouro/lib-page-scroll-hold",
    "@ouro/lib-platform",
    "@ouro/lib-portal-container",
    "@ouro/lib-router-link",
    "@ouro/lib-tones",
    "@ouro/lib-use-dev-messages",
    "@ouro/lib-use-platform",
    "@ouro/lib-use-sheet-presentation"
  ],
  "files": [
    {
      "path": "registry/ouro/components/ouro/menu/menu-styles.ts",
      "content": "export {\n  menuBackdropClass,\n  menuBarClass,\n  menuBarTriggerClass,\n  menuContextTriggerClass,\n  menuGroupLabelClass,\n  menuGuardsClass,\n  menuIndicatorClass,\n  menuItemClass,\n  menuPopupClass,\n  menuPositionerClass,\n  menuSeparatorClass,\n  menuSheetPopupClass,\n  menuSheetPositionerClass,\n};\n\n// Class strings for Menu and its items, apart from the components so menu.tsx exports only\n// components (React Fast Refresh). Class strings are literals so the app's Tailwind finds them.\n\n/**\n * The positioner beside a trigger or at the pointer.\n *\n * @internal\n */\nconst menuPositionerClass = \"outline-none\";\n\n/**\n * The positioner of a phone sheet: pinned to the bottom edge at full width, over the place\n * Base UI computed beside the trigger.\n *\n * @internal\n */\nconst menuSheetPositionerClass =\n  \"outline-none fixed! inset-x-0! top-auto! bottom-0! w-auto! transform-none!\";\n\n/**\n * The menu panel beside its trigger. It opens instantly and closes with a 150ms scale and\n * fade towards the trigger; reduced motion keeps only the fade,\n * and Base UI's `data-instant` (switching between menubar menus) skips it. A menu with\n * checkbox or radio items indents every label by the indicator's width, so labels line up.\n *\n * @internal\n * @claim \"A menu with checkbox or radio\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu items > indents every item when the menu has checkbox or radio items, so labels line up)\n * @claim \"It opens instantly and closes with\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu motion > opens instantly and closes with a quick scale and fade from its origin)\n */\nconst menuPopupClass =\n  \"box-border min-w-48 max-w-(--available-width) max-h-(--available-height) overflow-y-auto overscroll-contain p-1 \" +\n  \"rounded-ouro-lg bg-popover text-popover-foreground outline-none \" +\n  \"ring-1 ring-border/60 shadow-(--shadow-lg) \" +\n  \"has-[[data-ouro-menu-indicator]]:[--ouro-menu-inset:1.5rem] \" +\n  \"origin-(--transform-origin) \" +\n  \"[transition:transform_var(--ouro-duration-fast)_var(--ouro-ease-out),opacity_var(--ouro-duration-fast)_var(--ouro-ease-out)] \" +\n  \"data-ending-style:[transform:scale(0.96)] data-ending-style:opacity-0 \" +\n  \"motion-reduce:[transition:opacity_var(--ouro-duration-fast)_var(--ouro-ease-out)] motion-reduce:data-ending-style:[transform:none] \" +\n  \"data-instant:[transition:none]\";\n\n/**\n * The menu as a bottom sheet on a phone: full width with rounded top corners, clear of the\n * home indicator, scrolling when it is taller than most of the screen. It rises on the\n * drawer easing token and drops quickly; reduced motion fades it instead.\n *\n * @internal\n * @claim \"The menu as a bottom sheet\" registry/ouro/components/ouro/menu/menu.touch.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.touch.test.tsx::Menu on a phone > opens a dropdown as a bottom sheet from a tap, with 44px items and 16px text)\n * @claim \"The menu as a bottom sheet\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu presentation > is a bottom sheet below 640px, with a backdrop, and its submenu is a sheet with a Back item)\n */\nconst menuSheetPopupClass =\n  \"box-border w-full max-h-[min(80dvh,calc(100dvh-4rem))] overflow-y-auto overscroll-contain \" +\n  \"px-2 pt-2 pb-[calc(env(safe-area-inset-bottom,0px)+0.5rem)] \" +\n  \"rounded-t-ouro-xl bg-popover text-popover-foreground outline-none \" +\n  \"[box-shadow:var(--ouro-shadow-sheet-bottom)] \" +\n  \"has-[[data-ouro-menu-indicator]]:[--ouro-menu-inset:1.5rem] \" +\n  \"[transition:transform_var(--ouro-duration-sheet)_var(--ouro-ease-drawer),opacity_var(--ouro-duration-fast)_var(--ouro-ease-out)] \" +\n  \"data-starting-style:[transform:translateY(100%)] data-ending-style:[transform:translateY(100%)] \" +\n  \"data-ending-style:duration-(--ouro-duration-base) \" +\n  \"motion-reduce:[transition:opacity_var(--ouro-duration-base)_var(--ouro-ease-out)] \" +\n  \"motion-reduce:data-starting-style:[transform:none] motion-reduce:data-ending-style:[transform:none] \" +\n  \"motion-reduce:data-starting-style:opacity-0 motion-reduce:data-ending-style:opacity-0\";\n\n/**\n * The dimmed page behind the phone sheet.\n *\n * @internal\n */\nconst menuBackdropClass =\n  \"fixed inset-0 bg-(--ouro-backdrop-color) opacity-(--ouro-backdrop-max) \" +\n  \"transition-opacity duration-(--ouro-duration-base) ease-(--ouro-ease-out) data-starting-style:opacity-0 data-ending-style:opacity-0\";\n\n/**\n * One item: 44px tall with 16px text on a coarse pointer, 32px with 14px text with a fine\n * pointer. Highlighted by keyboard or pointer, dimmed when disabled; `tone=\"destructive\"`\n * mixes the destructive color 20% toward the foreground, for contrast on the highlight.\n * Links lose their underline and color.\n *\n * @internal\n * @claim \"One item: 44px tall with 16px\" registry/ouro/components/ouro/menu/menu.touch.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.touch.test.tsx::Menu on a phone > opens a dropdown as a bottom sheet from a tap, with 44px items and 16px text)\n * @claim \"Highlighted by keyboard or pointer, dimmed\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu items > paints tone destructive in the destructive color)\n * @claim \"Highlighted by keyboard or pointer, dimmed\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu items > paints tone destructive in the destructive color)\n */\nconst menuItemClass =\n  \"relative m-0 box-border flex w-full min-h-11 pointer-fine:min-h-8 cursor-default items-center gap-3 \" +\n  \"rounded-ouro-md py-1.5 pe-2 ps-[calc(0.5rem+var(--ouro-menu-inset,0px))] \" +\n  \"text-start text-base leading-5 pointer-fine:text-sm text-popover-foreground no-underline outline-none select-none \" +\n  \"[-webkit-tap-highlight-color:transparent] \" +\n  \"data-highlighted:bg-accent data-highlighted:text-accent-foreground active:bg-accent active:text-accent-foreground data-popup-open:bg-accent data-popup-open:text-accent-foreground \" +\n  // Forced colours drop the fill, so the highlight (and an open submenu's trigger) takes the system's pair.\n  \"forced-colors:data-highlighted:bg-[Highlight] forced-colors:data-highlighted:text-[HighlightText] forced-colors:data-popup-open:bg-[Highlight] forced-colors:data-popup-open:text-[HighlightText] \" +\n  // The current page is marked by weight and a bar at the start edge, so it differs from the highlight without relying on color.\n  \"aria-[current=page]:font-medium aria-[current=page]:before:absolute aria-[current=page]:before:inset-y-2 aria-[current=page]:before:start-0 aria-[current=page]:before:w-0.5 aria-[current=page]:before:rounded-full aria-[current=page]:before:bg-current aria-[current=page]:before:content-[''] \" +\n  \"forced-colors:aria-[current=page]:before:border-s-2 forced-colors:aria-[current=page]:before:border-solid forced-colors:aria-[current=page]:before:border-current \" +\n  \"data-[tone=destructive]:text-[color-mix(in_oklab,var(--destructive)_80%,var(--foreground))] \" +\n  \"data-[tone=destructive]:data-highlighted:bg-destructive/10 \" +\n  \"data-disabled:pointer-events-none data-disabled:opacity-50 \" +\n  \"[&_svg]:size-4 [&_svg]:shrink-0\";\n\n/**\n * The slot at the start of a checkbox or radio item that holds its mark.\n *\n * @internal\n */\nconst menuIndicatorClass = \"absolute start-2 top-1/2 flex size-4 -translate-y-1/2 items-center justify-center\";\n\n/**\n * A group's label: small and muted, lined up with the item labels.\n *\n * @internal\n */\nconst menuGroupLabelClass =\n  \"box-border py-1.5 pe-2 ps-[calc(0.5rem+var(--ouro-menu-inset,0px))] text-xs leading-4 font-medium text-muted-foreground select-none\";\n\n/**\n * A hairline between items.\n *\n * @internal\n */\nconst menuSeparatorClass = \"-mx-1 my-1 h-px border-0 bg-border\";\n\n/**\n * The menubar: a row of menu buttons.\n *\n * @internal\n */\nconst menuBarClass = \"box-border flex items-center gap-1\";\n\n/**\n * The holder of a bar menu's or a submenu's focus guards: out of the flow, so the bar's gap stays shut.\n *\n * @internal\n */\nconst menuGuardsClass = \"absolute\";\n\n/**\n * A menubar's menu button: 44px tall on a coarse pointer, 32px with a fine pointer,\n * highlighted while its menu is open.\n *\n * @internal\n * @claim \"A menubar's menu button: 44px tall\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::MenuBar > gives its triggers a 32px row with a fine pointer)\n * @claim \"A menubar's menu button: 44px tall\" registry/ouro/components/ouro/menu/menu.touch.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.touch.test.tsx::Menu on a phone > gives menubar buttons a 44px height)\n */\nconst menuBarTriggerClass =\n  \"relative m-0 box-border inline-flex h-11 pointer-fine:h-8 items-center rounded-ouro-md border-0 bg-transparent px-3 \" +\n  \"font-[inherit] text-base pointer-fine:text-sm leading-5 font-medium text-foreground cursor-default select-none \" +\n  \"[-webkit-tap-highlight-color:transparent] outline-ring focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-solid \" +\n  \"pointer-fine:hover:bg-accent pointer-fine:hover:text-accent-foreground active:bg-accent active:text-accent-foreground data-popup-open:bg-accent data-popup-open:text-accent-foreground \" +\n  \"data-disabled:opacity-50\";\n\n/**\n * The context menu's area: its text stays selectable and keeps its callout, except while a\n * finger is down (a long press opens the menu instead of the iOS text-selection callout).\n *\n * @internal\n */\nconst menuContextTriggerClass = \"data-ouro-pressing:select-none data-ouro-pressing:[-webkit-touch-callout:none]\";\n",
      "type": "registry:ui",
      "target": "@components/ouro/menu/menu-styles.ts"
    },
    {
      "path": "registry/ouro/components/ouro/menu/menu.tsx",
      "content": "\"use client\";\n\nimport { ContextMenu } from \"@base-ui/react/context-menu\";\nimport { Menu as BaseMenu } from \"@base-ui/react/menu\";\nimport { Menubar } from \"@base-ui/react/menubar\";\nimport {\n  createContext,\n  useContext,\n  useEffect,\n  useLayoutEffect,\n  useRef,\n  useState,\n  type HTMLAttributes,\n  type JSX,\n  type ReactElement,\n  type MouseEvent,\n  type ReactNode,\n  type TouchEvent,\n} from \"react\";\nimport { useAppearanceClassNameCheck } from \"@/registry/ouro/lib/ouro/class-name-check\";\nimport { cn } from \"@/registry/ouro/lib/ouro/cn\";\nimport { PageDirection } from \"@/registry/ouro/lib/ouro/page-direction\";\nimport { devThrow } from \"@/registry/ouro/lib/ouro/dev\";\nimport { ariaKeyShortcuts } from \"@/registry/ouro/lib/ouro/key-shortcuts\";\nimport type { Platform } from \"@/registry/ouro/lib/ouro/platform\";\nimport { usePlatform } from \"@/registry/ouro/lib/ouro/use-platform\";\nimport {\n  floatingAligns,\n  floatingHint,\n  floatingPlacementWarnings,\n  floatingPortalClass,\n  floatingSide,\n  type FloatingAlign,\n  type FloatingSide,\n} from \"@/registry/ouro/lib/ouro/floating\";\nimport { RouterLink } from \"@/registry/ouro/lib/ouro/router-link\";\nimport { toneWarning } from \"@/registry/ouro/lib/ouro/tones\";\nimport { useDevWarnings } from \"@/registry/ouro/lib/ouro/use-dev-messages\";\nimport { useSheetPresentation } from \"@/registry/ouro/lib/ouro/use-sheet-presentation\";\nimport { holdPageAtPress } from \"@/registry/ouro/lib/ouro/page-scroll-hold\";\nimport { PortalScope, usePortalContainer } from \"@/registry/ouro/lib/ouro/portal-container\";\nimport { Kbd } from \"@/registry/ouro/components/ouro/kbd/kbd\";\nimport {\n  menuBackdropClass,\n  menuBarClass,\n  menuBarTriggerClass,\n  menuContextTriggerClass,\n  menuGroupLabelClass,\n  menuGuardsClass,\n  menuIndicatorClass,\n  menuItemClass,\n  menuPopupClass,\n  menuPositionerClass,\n  menuSeparatorClass,\n  menuSheetPopupClass,\n  menuSheetPositionerClass,\n} from \"@/registry/ouro/components/ouro/menu/menu-styles\";\n\nexport type { FloatingAlign as MenuAlign, FloatingSide as MenuSide } from \"@/registry/ouro/lib/ouro/floating\";\n\n/** Keys for a shortcut, as `Kbd` takes them: `[\"mod\", \"e\"]` shows ⌘E on Apple platforms and Ctrl+E elsewhere. */\nexport type MenuShortcut = readonly string[] | (string & { 'Use an array: shortcut={[\"mod\", \"k\"]}': never });\n\n/** A menu entry for `items`: an action, or a link with `href`. */\nexport interface MenuItemEntry {\n  type?: \"item\" | undefined;\n  /** The item's text. */\n  label: string;\n  /**\n   * An icon before the text, as a `MenuItem` shows one in its children: an `<svg>` drawn at 16px\n   * in the item's color. It is decoration: screen readers hear the label alone.\n   * @claim \"An icon before the text, as a\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu items > shows an entry's icon before its label, at 16px, out of its name)\n   */\n  icon?: ReactNode;\n  /** Runs when the item is chosen, by click, tap or Enter. The menu then closes. */\n  onClick?: (() => void) | undefined;\n  /** Makes the item a link, through `OuroProvider`'s router link for an internal path. */\n  href?: string | undefined;\n  /** The keys of the item's shortcut, shown at its end: `[\"mod\", \"e\"]`. It does not bind them. */\n  shortcut?: MenuShortcut | undefined;\n  /** `\"destructive\"` for an action that deletes or cannot be undone. */\n  tone?: \"destructive\" | undefined;\n  /** Shown, but cannot be chosen. */\n  disabled?: boolean | undefined;\n  /**\n   * The id of the agent action this item performs, set as `data-ax-action` on it, so the component\n   * that declares the action finds its control: `axAction: \"mute\"`.\n   */\n  axAction?: string | undefined;\n}\n\n/** A menu entry for `items`: an on/off setting that stays in the menu when toggled. */\nexport interface MenuCheckboxEntry {\n  type: \"checkbox\";\n  label: string;\n  checked?: boolean | undefined;\n  defaultChecked?: boolean | undefined;\n  onCheckedChange?: ((checked: boolean) => void) | undefined;\n  shortcut?: MenuShortcut | undefined;\n  disabled?: boolean | undefined;\n  /** The id of the agent action it performs, set as `data-ax-action` on it, as on an item. */\n  axAction?: string | undefined;\n}\n\n/** A menu entry for `items`: one choice of several, as radio items under an optional label. */\nexport interface MenuRadioEntry {\n  type: \"radio\";\n  /** Names the group: \"Sort by\". */\n  label?: string | undefined;\n  value?: string | undefined;\n  defaultValue?: string | undefined;\n  onValueChange?: ((value: string) => void) | undefined;\n  options: ReadonlyArray<{ value: string; label: string; shortcut?: MenuShortcut | undefined; disabled?: boolean | undefined }>;\n}\n\n/** A menu entry for `items`: entries under a label. */\nexport interface MenuGroupEntry {\n  type: \"group\";\n  label: string;\n  items: readonly MenuEntry[];\n}\n\n/** A menu entry for `items`: an item that opens a nested menu. */\nexport interface MenuSubmenuEntry {\n  type: \"submenu\";\n  label: string;\n  items: readonly MenuEntry[];\n  disabled?: boolean | undefined;\n  /** The text of the item that goes back from the submenu in the phone sheet. Default \"Back\". */\n  backLabel?: string | undefined;\n}\n\n/** One entry in a Menu's `items`: an item (the default `type`), a checkbox, a radio group, a group, a submenu or a separator. */\nexport type MenuEntry =\n  | MenuItemEntry\n  | MenuCheckboxEntry\n  | MenuRadioEntry\n  | MenuGroupEntry\n  | MenuSubmenuEntry\n  | { type: \"separator\" };\n\n/**\n * Props shared by every way of opening a Menu.\n *\n * @claim \"Props shared by every way of\" registry/ouro/components/ouro/menu/menu.test.tsx verify:fileLine(registry/ouro/components/ouro/menu/menu.test.tsx, /throws\\sthe\\sexact\\sfix\\swith\\sno\\sway\\sto\\sopen/)\n */\nexport interface MenuBaseProps {\n  /** The entries as data, in place of children: `items={[{ label: \"Edit\", onClick: edit }, { type: \"separator\" }]}`. */\n  items?: readonly MenuEntry[] | undefined;\n  /** The entries as `MenuItem`, `MenuCheckboxItem`, `MenuRadioGroup`, `MenuGroup`, `MenuSub` and `MenuSeparator`. */\n  children?: ReactNode;\n  /** Whether the menu is open, to control it; pass `onOpenChange` with it. */\n  open?: boolean | undefined;\n  /** Called when the menu opens or closes. */\n  onOpenChange?: ((open: boolean) => void) | undefined;\n  /**\n   * Layout only, applied to the menu panel: width (`w-64`; at least 12rem by default) and\n   * margins. The phone sheet keeps its full width. Appearance classes warn in development.\n   * @claim \"Layout only, applied to the menu\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu dropdown > is at least 12rem wide, and className sets layout)\n   */\n  className?: string | undefined;\n  /**\n   * The text of the item that ends the phone sheet and closes it, for screen-reader and\n   * switch users, who cannot swipe or tap the backdrop. Default \"Close\".\n   */\n  closeLabel?: string | undefined;\n\n  /** Not a prop. Ouro UI uses `open` with `onOpenChange`: `<Menu open={open} onOpenChange={setOpen} trigger={…}>`. */\n  isOpen?: { 'Use <Menu open={open} onOpenChange={setOpen} trigger={...}>': never };\n  /** Not a prop. `onOpenChange(false)` fires on close: `<Menu open={open} onOpenChange={setOpen} trigger={…}>`. */\n  onClose?: { 'Use <Menu open={open} onOpenChange={setOpen} trigger={...}>': never };\n  /** Not a prop. Ouro UI splits placement into `side` and `align`: `<Menu side=\"bottom\" align=\"start\">`. */\n  placement?: { 'Use side=\"bottom\" align=\"start\"': never };\n  /** Not a prop. The trigger element is the button: `trigger={<Button>Actions</Button>}`. */\n  asChild?: { \"Use trigger={<Button>Actions</Button>}\": never };\n  /** Not a prop. The entries are `items` (or children): `items={[{ label: \"Edit\", onClick: edit }]}`. */\n  options?: { 'Use items={[{ label: \"Edit\", onClick: edit }]}': never };\n}\n\n/** Where a dropdown sits beside its trigger. */\ninterface MenuPlacementProps {\n  /**\n   * The side of the trigger the menu sits on; it flips when there is no room. @default \"bottom\"\n   *\n   * @claim \"it flips when there is no room\" https://base-ui.com/react/components/menu verify:urlOk(https://base-ui.com/react/components/menu)\n   */\n  side?: FloatingSide | (string & { 'Use \"top\", \"bottom\", \"left\" or \"right\"': never }) | undefined;\n  /** How the menu lines up with the trigger along that side. @default \"start\" */\n  align?: FloatingAlign | (string & { 'Use \"start\", \"center\" or \"end\": left is \"start\", right is \"end\"': never }) | undefined;\n}\n\n/**\n * A dropdown: `trigger` opens it. Below 640px it is a bottom sheet.\n *\n * @claim \"Below 640px it is a bottom\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu presentation > is a bottom sheet below 640px, with a backdrop, and its submenu is a sheet with a Back item)\n */\nexport type MenuDropdownProps = MenuBaseProps &\n  MenuPlacementProps & {\n    /** The button that opens the menu, usually a Button: `trigger={<Button>Actions</Button>}`. */\n    trigger: ReactElement;\n    /**\n     * Whether the open dropdown holds the page: it locks the page's scroll, and a click outside\n     * only closes it. `modal={false}` leaves the page scrolling and its controls live, and spares\n     * the browser a layout and repaint of the whole page each time the menu opens and closes:\n     * for a small menu that a list repeats on every row. The phone sheet always holds the page.\n     * @default true\n     * @claim \"it locks the page's scroll\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu modal > holds the page while open: its scroll is locked, and a click outside only closes it)\n     * @claim \"a click outside only closes it\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu modal > holds the page while open: its scroll is locked, and a click outside only closes it)\n     * @claim \"leaves the page scrolling and its controls live\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu modal > with modal={false}, leaves the page's scroll alone while a modal Menu's lock comes and goes) verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu modal > with modal={false}, leaves the page's controls live: a click outside reaches them and closes the menu)\n     * @claim \"The phone sheet always holds the page\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu modal > keeps the phone sheet holding the page with modal={false})\n     */\n    modal?: boolean | undefined;\n    /** Not with `trigger`. Use one way to open a menu. */\n    contextTrigger?: never;\n    /** Not with `trigger`. `label` is for a Menu inside `MenuBar`. */\n    label?: never;\n    /** Not with `trigger`. Use one way to open a menu. */\n    anchor?: never;\n  };\n\n/** A context menu: right-click or long-press on `contextTrigger` opens it at the pointer. */\nexport type MenuContextProps = MenuBaseProps & {\n  /**\n   * The area that opens the menu on right-click, or on a long press on touch screens:\n   * `contextTrigger={<div>…</div>}`. Its text stays selectable; only while a finger is\n   * down does it turn off text selection and the iOS callout, so a long press opens the\n   * menu. Give the same actions a visible control too: a context menu is hard to discover.\n   */\n  contextTrigger: ReactElement;\n  /** Not with `contextTrigger`. Use one way to open a menu. */\n  trigger?: never;\n  /** Not with `contextTrigger`. `label` is for a Menu inside `MenuBar`. */\n  label?: never;\n  /** Not with `contextTrigger`: a context menu opens at the pointer. */\n  side?: never;\n  /** Not with `contextTrigger`: a context menu opens at the pointer. */\n  align?: never;\n  /** Not with `contextTrigger`: a context menu holds the page while it is open. */\n  modal?: never;\n  /** Not with `contextTrigger`. Use one way to open a menu. */\n  anchor?: never;\n};\n\n/** A menu in a `MenuBar`: `label` is its button's text. */\nexport type MenuBarMenuProps = MenuBaseProps &\n  MenuPlacementProps & {\n    /** The text of the menu's button in the `MenuBar`: `<Menu label=\"File\">`. */\n    label: string;\n    /** Not with `label`. A menu in a `MenuBar` gets its button from `label`. */\n    trigger?: never;\n    /** Not with `label`. A menu in a `MenuBar` gets its button from `label`. */\n    contextTrigger?: never;\n    /** Not with `label`: the `MenuBar` decides how its menus hold the page. */\n    modal?: never;\n    /** Not with `label`. A menu in a `MenuBar` gets its button from `label`. */\n    anchor?: never;\n  };\n\n/**\n * A menu the app opens itself, at an element or a point: one menu that many rows share, opened from\n * each row's own button, right-click or keys. Beside an element it is a bottom sheet below 640px, as a\n * dropdown is; at a point it is a menu at every width, as a context menu is.\n *\n * @claim \"A menu the app opens itself\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu anchor > opens at a point the app gives, named by its aria-label, and puts focus back where the app says when it closes)\n * @claim \"Beside an element it is a\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu anchor > opens beside an element, as a bottom sheet below 640px, and at a point as a menu)\n */\nexport type MenuAnchorProps = MenuBaseProps &\n  MenuPlacementProps & {\n    /**\n     * Where the menu opens: beside an element (`side` and `align` place it), beside a box measured\n     * once (`{ getBoundingClientRect: () => box }`, for an element that goes as the menu opens), or at\n     * a point in the window, `{ x, y }`, as a right-click's `clientX` and `clientY`.\n     */\n    anchor: MenuAnchor;\n    /** Whether the menu is open: the app opens it. */\n    open: boolean;\n    /** Called when the menu opens or closes: an item chosen, Escape, a press outside. */\n    onOpenChange: (open: boolean) => void;\n    /** What screen readers hear for the menu, in place of a button's name: \"Actions for Ana's message\". */\n    \"aria-label\": string;\n    /**\n     * Where focus goes when the menu closes (Escape, an item chosen), such as the row it opened for.\n     * An item that moved focus itself, as one opening a dialog does, keeps it there.\n     * @claim \"An item that moved focus itself\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu anchor > leaves focus where a chosen item moved it)\n     */\n    returnFocus?: HTMLElement | null | undefined;\n    /** Not with `anchor`. Use one way to open a menu. */\n    trigger?: never;\n    /** Not with `anchor`. Use one way to open a menu. */\n    contextTrigger?: never;\n    /** Not with `anchor`. `label` is for a Menu inside `MenuBar`; name this one with `aria-label`. */\n    label?: never;\n    /** Not with `anchor`: it leaves the page live, so it opens and closes without a layout of the whole page. */\n    modal?: never;\n  };\n\n/** Where an anchored Menu opens: an element, a box (`{ getBoundingClientRect }`) or a point in the window (`{ x, y }`). */\nexport type MenuAnchor = Element | { getBoundingClientRect: () => DOMRect } | { x: number; y: number };\n\n/** Props for {@link Menu}: `trigger` (a dropdown), `contextTrigger` (a context menu), `label` (in a `MenuBar`) or `anchor` (opened by the app). */\nexport type MenuProps = MenuDropdownProps | MenuContextProps | MenuBarMenuProps | MenuAnchorProps;\n\n/** What items read from the menu around them: that there is one, and whether it is a phone sheet. */\nconst MenuContext = createContext<{ sheet: boolean } | null>(null);\n/** Whether a Menu sits in a MenuBar. */\nconst MenuBarContext = createContext(false);\n/** Whether a radio item sits in a MenuRadioGroup. */\nconst RadioGroupContext = createContext(false);\n\nconst openFix =\n  \"Pass trigger={<Button>…</Button>} for a dropdown, contextTrigger={<div>…</div>} for a right-click or long-press area, label inside <MenuBar>, or anchor={element} with open for a menu the app opens\";\nconst controlFix = \"<Menu open={open} onOpenChange={setOpen} trigger={…}>\";\nconst itemsFix = '<Menu trigger={…} items={[{ label: \"Edit\", onClick: edit }]} />';\n\n/** Throws in development, with the JSX the item belongs in, unless it sits inside a Menu. */\nfunction useMenuPart(part: string, inner: string): { sheet: boolean } {\n  const context = useContext(MenuContext);\n  if (!context) {\n    devThrow(\n      part,\n      \"must be rendered inside <Menu>\",\n      process.env.NODE_ENV !== \"production\"\n        ? `<Menu trigger={<Button>Actions</Button>}>${inner}</Menu>`\n        : /* istanbul ignore next @preserve -- production only */ \"\",\n    );\n  }\n  return context;\n}\n\n/** The items for `items`. */\nfunction renderEntries(entries: readonly MenuEntry[]): ReactNode {\n  return entries.map((entry, index) => {\n    switch (entry.type) {\n      case \"separator\":\n        return <MenuSeparator key={index} />;\n      case \"checkbox\":\n        return (\n          <MenuCheckboxItem\n            key={index}\n            checked={entry.checked}\n            defaultChecked={entry.defaultChecked}\n            onCheckedChange={entry.onCheckedChange}\n            shortcut={entry.shortcut}\n            disabled={entry.disabled}\n            axAction={entry.axAction}\n          >\n            {entry.label}\n          </MenuCheckboxItem>\n        );\n      case \"radio\":\n        return (\n          <MenuRadioGroup\n            key={index}\n            label={entry.label}\n            value={entry.value}\n            defaultValue={entry.defaultValue}\n            onValueChange={entry.onValueChange}\n          >\n            {entry.options.map((option) => (\n              <MenuRadioItem key={option.value} value={option.value} shortcut={option.shortcut} disabled={option.disabled}>\n                {option.label}\n              </MenuRadioItem>\n            ))}\n          </MenuRadioGroup>\n        );\n      case \"group\":\n        return (\n          <MenuGroup key={index} label={entry.label}>\n            {renderEntries(entry.items)}\n          </MenuGroup>\n        );\n      case \"submenu\":\n        return (\n          <MenuSub key={index} label={entry.label} disabled={entry.disabled} backLabel={entry.backLabel}>\n            {renderEntries(entry.items)}\n          </MenuSub>\n        );\n      default:\n        return (\n          <MenuItem\n            key={index}\n            onClick={entry.onClick}\n            href={entry.href}\n            shortcut={entry.shortcut}\n            tone={entry.tone}\n            disabled={entry.disabled}\n            axAction={entry.axAction}\n          >\n            {entry.icon !== undefined && (\n              <span aria-hidden=\"true\" data-ouro-menu-icon=\"\" className=\"flex shrink-0\">\n                {entry.icon}\n              </span>\n            )}\n            {entry.label}\n          </MenuItem>\n        );\n    }\n  });\n}\n\n/** Marks a context area as pressed while a finger is down, so the class turns off selection and the callout. */\nfunction pressing(on: boolean) {\n  return (event: TouchEvent<HTMLElement>) => event.currentTarget.toggleAttribute(\"data-ouro-pressing\", on);\n}\n\n/** The portal, positioner and popup of a menu or submenu, beside its trigger or as a phone sheet. */\nfunction MenuSurface({\n  sheet,\n  context,\n  side,\n  align,\n  className,\n  children,\n  closeLabel,\n  anchor,\n  point,\n  label,\n  finalFocus,\n}: {\n  sheet: boolean;\n  context: boolean;\n  side?: FloatingSide | undefined;\n  align?: FloatingAlign | undefined;\n  className?: string | undefined;\n  children: ReactNode;\n  /** Set for a top-level menu: its phone sheet ends with a Close item. */\n  closeLabel?: string | undefined;\n  /** An anchored menu's place: an element or a box. */\n  anchor?: Element | { getBoundingClientRect: () => DOMRect } | undefined;\n  /** At a point: the menu opens right at it, as a context menu opens at the pointer. */\n  point?: boolean | undefined;\n  /** An anchored menu's name. */\n  label?: string | undefined;\n  /** An anchored menu's focus on closing. */\n  finalFocus?: (() => HTMLElement | boolean) | undefined;\n}): JSX.Element {\n  const Positioner = context ? ContextMenu.Positioner : BaseMenu.Positioner;\n  const portal = usePortalContainer(\"Menu\", true);\n  // An open menu leaves two focus guards beside its trigger (Base UI's FloatingPortal): a menubar's menu leaves them in\n  // the bar, a submenu in its menu. In WebKit on Apple platforms they are role=\"button\", so that VoiceOver's cursor\n  // lands on them and is sent into the popup (Base UI utils/FocusGuard), and a menubar or a menu may hold no buttons\n  // (aria-required-children, issue #663). There they are hidden, as they are on every other platform; Tab still stops on\n  // them. The group Base UI puts between them owns the popup (aria-owns), so the popup is read right after its trigger.\n  // The guards inside the popup are left as buttons on purpose, so VoiceOver's cursor still moves focus into and out of\n  // it: they sit in the owned popup, beside the menu, not among the bar's or the menu's own children. A dropdown's guards\n  // are left alone too, as its trigger sits in no container that limits its children.\n  const inMenu = useContext(MenuContext) !== null;\n  const inBar = useContext(MenuBarContext);\n  const inside = inMenu || inBar;\n  const guards = useRef<HTMLSpanElement | null>(null);\n  useLayoutEffect(() => {\n    const holder = guards.current;\n    if (holder === null) return;\n    const hide = () => {\n      for (const guard of holder.querySelectorAll(\"[data-base-ui-focus-guard][role]\")) {\n        guard.removeAttribute(\"role\");\n        guard.setAttribute(\"aria-hidden\", \"true\");\n      }\n    };\n    const observer = new MutationObserver(hide);\n    // Base UI mounts a guard without a role and gives it one a render later, so a change of role is all to watch for.\n    observer.observe(holder, { subtree: true, attributeFilter: [\"role\"] });\n    // `inside` comes from context fixed by where the surface is rendered, so the holder never comes or goes.\n    // Stryker disable next-line ArrowFunction: an observer left on a holder that has left the page sees no more changes.\n    return () => observer.disconnect();\n  },\n  // Stryker disable next-line ArrayDeclaration: the effect reads only the holder, the same element for the surface's life, so it runs once whatever it lists.\n  []);\n  const surface = (\n    <BaseMenu.Portal {...portal} data-ouro=\"menu-portal\" className={floatingPortalClass}>\n      <PortalScope>\n        {sheet && <BaseMenu.Backdrop data-ouro=\"menu-backdrop\" className={menuBackdropClass} />}\n        <Positioner\n          data-ouro=\"menu-positioner\"\n          className={sheet ? menuSheetPositionerClass : menuPositionerClass}\n          sideOffset={context || point ? 0 : 4}\n          collisionPadding={8}\n          // Stryker disable next-line ConditionalExpression: Base UI reads an anchor of undefined as none, as it reads no anchor.\n          {...(anchor !== undefined ? { anchor } : {})}\n          // An anchored menu mounts open, and its first placement can come before the layer it renders in is laid out\n          // (WebKit): placed absolutely, it was drawn offset by as far as that layer is down the page, then jumped back a\n          // frame later. Placed fixed, as Base UI places a context menu, it is right from its first frame.\n          // Stryker disable next-line ConditionalExpression: a dropdown placed fixed is placed again as its page scrolls, where one placed absolutely moves with it, so no test can tell them apart.\n          {...(anchor !== undefined ? { positionMethod: \"fixed\" as const } : {})}\n          {...(side ? { side } : {})}\n          {...(align ? { align } : {})}\n        >\n          <BaseMenu.Popup\n            data-ouro=\"menu\"\n            data-ouro-presentation={sheet ? \"sheet\" : \"menu\"}\n            aria-label={label}\n            // Stryker disable next-line ConditionalExpression: Base UI reads a finalFocus of undefined as none, as it reads no finalFocus.\n            {...(finalFocus !== undefined ? { finalFocus } : {})}\n            className={cn(sheet ? menuSheetPopupClass : menuPopupClass, sheet ? undefined : className)}\n          >\n            <MenuContext.Provider value={{ sheet }}>{children}</MenuContext.Provider>\n            {sheet && closeLabel !== undefined && (\n              <>\n                <BaseMenu.Separator className={menuSeparatorClass} />\n                <BaseMenu.Item data-ouro-menu-close=\"\" data-ouro-control=\"menu\" data-ouro-part=\"close\" className={menuItemClass}>\n                  <span data-ouro-menu-label=\"\">{closeLabel}</span>\n                </BaseMenu.Item>\n              </>\n            )}\n          </BaseMenu.Popup>\n        </Positioner>\n      </PortalScope>\n    </BaseMenu.Portal>\n  );\n  if (!inside) return surface;\n  return (\n    <span ref={guards} data-ouro-menu-guards=\"\" className={menuGuardsClass}>\n      {surface}\n    </span>\n  );\n}\n\n/**\n * A list of actions that opens from a button, from a right-click or long press, or from a\n * menubar, with one API for all three. Items take a shortcut (shown with `Kbd`),\n * `tone=\"destructive\"` and `href`, and there are checkbox items, radio groups, labelled\n * groups, submenus and separators. Below 640px a dropdown is a bottom sheet; a context menu\n * opens at the pointer at every width.\n *\n * Pass `trigger` for a dropdown, `contextTrigger` for a context menu, `label` for a menu\n * in a `MenuBar`, or `anchor` with `open` for a menu the app opens itself, at an element or a\n * point, such as one menu shared by every row of a list. Give the entries as children or as `items` data. To give the trigger a\n * tooltip too, put the Tooltip inside `trigger`:\n * `trigger={<Tooltip content=\"More actions\"><Button aria-label=\"More\">…</Button></Tooltip>}`.\n *\n * Use `Select` instead to pick a value for a form, `Popover` for a panel with fields or\n * text, and `Command` for a searchable list of every action in the app.\n *\n * It stacks above the page at `--ouro-layer`, a z-index of 50 by default (from\n * ouro-base.css), like Dialog and Sheet.\n *\n * A dropdown closes when focus moves anywhere outside it, as it does on a click outside, so Tab\n * goes on from wherever focus went.\n * In a right-to-left page (`dir=\"rtl\"` on `<html>`) a submenu opens to the left, with ArrowLeft.\n *\n *\n * @group Menus\n * @claim \"In a right-to-left page\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu items > opens a submenu with ArrowLeft in a right-to-left page, where it opens to the left, and closes it with ArrowRight)\n * @see https://ui.ouroboros.bot/docs/menu\n *\n * @example\n * <Menu trigger={<Button variant=\"outline\">Actions</Button>}>\n *   <MenuItem onClick={edit} shortcut={[\"mod\", \"e\"]}>Edit</MenuItem>\n *   <MenuItem href=\"/recipes/1/print\">Print</MenuItem>\n *   <MenuSeparator />\n *   <MenuItem tone=\"destructive\" onClick={remove}>Delete</MenuItem>\n * </Menu>\n * <Menu contextTrigger={<RecipeCard recipe={recipe} />} items={[{ label: \"Copy link\", onClick: copy }]} />\n * <Menu anchor={{ x: event.clientX, y: event.clientY }} open={open} onOpenChange={setOpen} aria-label=\"Actions for Ana's message\" returnFocus={row} items={entries} />\n * @claim \"Below 640px a dropdown is a\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu presentation > is a bottom sheet below 640px, with a backdrop, and its submenu is a sheet with a Back item)\n * @claim \"a context menu opens at the pointer at every width\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu context trigger > stays a menu at the pointer on a phone, not a sheet)\n * @claim \"A dropdown closes when focus moves\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu focus > closes when focus moves outside it, so a forward Tab from before its trigger goes on to the trigger)\n * @claim \"It stacks above the page at\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu stacking > puts the portal on the --ouro-layer level, as its own stacking context)\n * @claim \"It stacks above the page at\" registry/ouro/theme/ouro-base.css verify:fileLine(registry/ouro/theme/ouro-base.css, /^\\s+--ouro-layer:\\s50;/)\n * @claim \"A list of actions that opens\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu dropdown > opens a menu below its trigger, aligned to its start, named by the trigger)\n * @claim \"A list of actions that opens\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu context trigger > opens at the pointer on right-click)\n * @claim \"A list of actions that opens\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::MenuBar > is a menubar of menus that the arrow keys move between)\n */\nexport function Menu(props: MenuProps): JSX.Element {\n  const {\n    trigger,\n    contextTrigger,\n    label,\n    anchor,\n    \"aria-label\": ariaLabel,\n    returnFocus,\n    items,\n    children,\n    side: sideProp,\n    align: alignProp,\n    className,\n    closeLabel = \"Close\",\n    modal,\n    open,\n    onOpenChange,\n    // Guard props (hint types), dropped here so they never reach the DOM.\n    isOpen,\n    onClose,\n    placement,\n    asChild,\n    options,\n  } = props as MenuBaseProps &\n    MenuPlacementProps & {\n      trigger?: ReactElement;\n      contextTrigger?: ReactElement;\n      label?: string;\n      modal?: boolean | undefined;\n      anchor?: MenuAnchor;\n      \"aria-label\"?: string;\n      returnFocus?: HTMLElement | null | undefined;\n    };\n  const inBar = useContext(MenuBarContext);\n  const fix = (code: string) => (process.env.NODE_ENV !== \"production\" ? code : /* istanbul ignore next @preserve -- production only */ \"\");\n\n  const modes = [trigger, contextTrigger, label, anchor].filter((mode) => mode !== undefined).length;\n  if (modes === 0) devThrow(\"Menu\", \"needs trigger, contextTrigger, label or anchor\", fix(openFix));\n  if (modes > 1) devThrow(\"Menu\", \"takes one of trigger, contextTrigger, label and anchor\", fix(openFix));\n  if (anchor !== undefined && open === undefined) devThrow(\"Menu\", \"anchor needs open: the app opens a menu it anchors\", fix('<Menu anchor={row} open={open} onOpenChange={setOpen} aria-label=\"Actions for Ana\\'s message\">'));\n  if (anchor !== undefined && !ariaLabel) devThrow(\"Menu\", \"anchor needs aria-label: no button names the menu\", fix('<Menu anchor={row} open={open} onOpenChange={setOpen} aria-label=\"Actions for Ana\\'s message\">'));\n  if (inBar && label === undefined) {\n    devThrow(\"Menu\", \"a Menu inside <MenuBar> takes label, not trigger or contextTrigger\", fix('<MenuBar><Menu label=\"File\">…</Menu></MenuBar>'));\n  }\n  if (!inBar && label !== undefined) {\n    devThrow(\n      \"Menu\",\n      \"label is for a Menu inside <MenuBar>\",\n      fix(`<MenuBar><Menu label=\"${label}\">…</Menu></MenuBar>, or trigger={<Button>${label}</Button>} for a dropdown`),\n    );\n  }\n  if (items === undefined && children === undefined) devThrow(\"Menu\", \"needs items or children\", fix(itemsFix));\n  if (items !== undefined && children !== undefined) {\n    devThrow(\"Menu\", \"takes items or children, not both\", fix(\"move the children into items, or the items into <MenuItem> children\"));\n  }\n  if (open !== undefined && typeof onOpenChange !== \"function\") devThrow(\"Menu\", \"open needs onOpenChange\", fix(controlFix));\n\n  const context = contextTrigger !== undefined;\n  // At a point, a menu at every width, as a context menu is; beside an element, a sheet on a phone, as a dropdown is.\n  const point = anchor !== undefined && !(\"getBoundingClientRect\" in anchor) ? anchor : undefined;\n  // A side or alignment that is not one of Ouro UI's (a type error) warns and renders the default.\n  const side = floatingSide(sideProp, \"bottom\");\n  const align = floatingAligns.includes(alignProp as FloatingAlign) ? (alignProp as FloatingAlign) : \"start\";\n\n  useAppearanceClassNameCheck(\n    \"Menu\",\n    className,\n    process.env.NODE_ENV !== \"production\" ? floatingHint(\"<Menu trigger={…}>\", \"</Menu>\") : /* istanbul ignore next @preserve -- production only */ \"\",\n  );\n  useDevWarnings(\n    \"Menu\",\n    process.env.NODE_ENV !== \"production\"\n      ? () => [\n          ...(context\n            ? [\n                sideProp !== undefined && ([\"side is not used by a context menu, which opens at the pointer\", \"remove side\"] as const),\n                alignProp !== undefined && ([\"align is not used by a context menu, which opens at the pointer\", \"remove align\"] as const),\n                modal !== undefined && ([\"modal is not used by a context menu, which holds the page while open\", \"remove modal\"] as const),\n              ]\n            : floatingPlacementWarnings(\"<Menu\", sideProp, \"bottom\", alignProp, placement)),\n          label !== undefined && modal !== undefined && [\"modal is not used by a menu in <MenuBar>; the bar decides\", \"remove modal\"],\n          isOpen !== undefined && [\"isOpen is not a prop\", controlFix],\n          onClose !== undefined && [\"onClose is not a prop\", controlFix],\n          asChild !== undefined && [\"asChild is not a prop; the trigger element is the button\", \"trigger={<Button>Actions</Button>}\"],\n          options !== undefined && [\"options is not a prop; the entries are items\", itemsFix],\n        ]\n      : /* istanbul ignore next @preserve -- production only */ undefined,\n  );\n\n  // A dropdown (and a menubar's menu) is a bottom sheet on a phone; a context menu opens at\n  // the pointer, where the finger is, at every width.\n  const sheet = useSheetPresentation(\n    context || point !== undefined\n      ? // Stryker disable next-line StringLiteral: useSheetPresentation is a sheet for \"sheet\" or \"auto\" alone, so any other word here is the same popup.\n        \"menu\"\n      : \"auto\",\n  );\n  const body = items !== undefined ? renderEntries(items) : children;\n  // Focus that moves anywhere else closes a dropdown (a menubar's menus are the bar's). Left open, Base UI keeps its\n  // focus guards beside the trigger, and the one before it, met by a forward Tab, sends focus back to what Tab was\n  // leaving.\n  // Stryker disable next-line BooleanLiteral: a menu's close() before it first opens does nothing, so the listener that starts with it changes nothing.\n  const [shown, setShown] = useState(false);\n  const isShown = open ?? shown;\n  const actions = useRef<BaseMenu.Root.Actions | null>(null);\n  // Where focus went outside the open menu, as a chosen item moving it does; Base UI then focuses the item again.\n  const movedTo = useRef<HTMLElement | null>(null);\n  const triggerRef = useRef<HTMLButtonElement | null>(null);\n  const contextRef = useRef<HTMLDivElement | null>(null);\n  useEffect(() => {\n    // An anchored menu has no trigger: its page is the one it runs in.\n    const doc = anchor !== undefined ? document : triggerRef.current?.ownerDocument;\n    // Stryker disable next-line ConditionalExpression,LogicalOperator: a closed menu's close() does nothing; this only spares a listener.\n    if (!isShown || doc === undefined) return;\n    movedTo.current = null;\n    const away = (event: FocusEvent) => {\n      const target = event.target as Element;\n      if (triggerRef.current?.contains(target) || target.closest('[data-ouro=\"menu-positioner\"], [data-base-ui-focus-guard]')) return;\n      movedTo.current = target as HTMLElement;\n      actions.current!.close();\n    };\n    doc.addEventListener(\"focusin\", away);\n    // Stryker disable next-line ArrowFunction: a listener left on a closed menu's page only calls close(), which does nothing.\n    return () => doc.removeEventListener(\"focusin\", away);\n  }, [isShown, anchor]);\n  const returnTo = useRef(returnFocus);\n  useLayoutEffect(() => {\n    returnTo.current = returnFocus;\n  });\n  const changed = (next: boolean) => {\n    setShown(next);\n    onOpenChange?.(next);\n    // An anchored menu puts focus back on returnFocus, unless the chosen item (or the press that closed it) put it somewhere else.\n    // Stryker disable next-line ConditionalExpression,LogicalOperator: Base UI opens through here only at a trigger, which an anchored menu has none of, and a dropdown has no returnFocus, so past this line either finds nothing of theirs to focus.\n    if (anchor === undefined || next) return;\n    setTimeout(() => {\n      // The body when nothing has focus: null only in a document with no body, which a menu's page always has.\n      const active = document.activeElement as Element;\n      if (active !== document.body && active.closest('[data-ouro=\"menu-positioner\"]') === null) return;\n      (movedTo.current?.isConnected ? movedTo.current : returnTo.current)?.focus({ preventScroll: true });\n    });\n  };\n  // Stryker disable next-line ConditionalExpression: Base UI reads an `open` of undefined as uncontrolled, as it reads none.\n  const control = open !== undefined ? { open, onOpenChange: changed } : { onOpenChange: changed };\n\n  if (anchor !== undefined) {\n    const place = point === undefined ? (anchor as Exclude<MenuAnchor, { x: number }>) : { getBoundingClientRect: () => new DOMRect(point.x, point.y, 0, 0) };\n    // Focus goes back in `changed`, once the closing event is over and any chosen item has run.\n    // Stryker disable next-line ArrowFunction: with no trigger, Base UI has no focus of its own to give back, so a finalFocus that says nothing does as false does.\n    const finalFocus = () => false;\n    const directed = (\n      <BaseMenu.Root {...control} actionsRef={actions} modal={sheet}>\n        <MenuSurface\n          sheet={sheet}\n          context={false}\n          side={side}\n          align={point === undefined ? align : \"start\"}\n          className={className}\n          closeLabel={closeLabel}\n          anchor={place}\n          point={point !== undefined}\n          label={ariaLabel}\n          finalFocus={finalFocus}\n        >\n          {body}\n        </MenuSurface>\n      </BaseMenu.Root>\n    );\n    // An element the menu opens beside decides its direction; a point or a box measured once, the page.\n    return <PageDirection of={anchor instanceof Element ? anchor : null}>{directed}</PageDirection>;\n  }\n\n  if (context) {\n    const directed = (\n      <ContextMenu.Root {...control}>\n        <ContextMenu.Trigger\n          ref={contextRef}\n          render={contextTrigger}\n          className={menuContextTriggerClass}\n          {...holdPageAtPress.contextMenu}\n          // Base UI turns the callout off for good; Ouro UI turns it off only while pressing.\n          style={{ WebkitTouchCallout: undefined }}\n          onTouchStart={pressing(true)}\n          onTouchEnd={pressing(false)}\n          onTouchCancel={pressing(false)}\n        />\n        <MenuSurface sheet={false} context className={className}>\n          {body}\n        </MenuSurface>\n      </ContextMenu.Root>\n    );\n    return <PageDirection of={contextRef}>{directed}</PageDirection>;\n  }\n\n  // A MenuBar's menu takes no `modal` (Base UI warns): the bar decides. It takes the bar's direction too.\n  const menu = (\n    <BaseMenu.Root {...control} actionsRef={actions} modal={label === undefined ? sheet || modal : undefined}>\n      {label !== undefined ? (\n        <BaseMenu.Trigger data-ouro-control=\"menu\" data-ouro-part=\"bar-trigger\" className={menuBarTriggerClass} {...holdPageAtPress.listButton}>\n          {label}\n        </BaseMenu.Trigger>\n      ) : (\n        <BaseMenu.Trigger ref={triggerRef} render={trigger} {...holdPageAtPress.listButton} />\n      )}\n      <MenuSurface\n        sheet={sheet}\n        context={false}\n        side={side}\n        align={align}\n        className={className}\n        closeLabel={closeLabel}\n        finalFocus={backToTrigger}\n      >\n        {body}\n      </MenuSurface>\n    </BaseMenu.Root>\n  );\n  return label !== undefined ? menu : <PageDirection of={triggerRef}>{menu}</PageDirection>;\n}\n\n/**\n * Where a dropdown, or a menubar's menu, gives focus as it leaves the page: back to its trigger, as Base UI does, unless\n * focus has gone on elsewhere or another menu has opened while it closed. That menu closes when\n * focus lands outside it, so a press on its trigger, which takes no focus in Safari, would open it\n * only for this one's focus return to close it again.\n *\n * @claim \"That menu closes when focus lands outside it, so a press on its trigger, which takes no focus in Safari, would open it only for this one's focus return to close it again.\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu modal > leaves a menu that opened while another closed open, when the closing one would give focus back to its trigger)\n * @claim \"back to its trigger, as Base UI does, unless focus has gone on elsewhere\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu modal > gives focus back to its trigger when a press on the page's blank space closes it, and leaves focus that moved on)\n */\nfunction backToTrigger(): boolean {\n  if (document.querySelector('[data-ouro=\"menu\"][data-open]') !== null) return false;\n  // The body when nothing has focus: null only in a document with no body, which a menu's page always has.\n  const active = document.activeElement!;\n  // Stryker disable next-line ConditionalExpression: React takes the popup out of the page before Base UI asks, so focus that was in it is on the body by then; this keeps a popup still in the page returning focus too.\n  return active === document.body || active.closest('[data-ouro=\"menu\"]') !== null;\n}\n\n/**\n * The items for `items`, as `MenuItem`s and the rest, for a menu that puts more before them.\n *\n * @internal\n */\nexport function MenuEntries({ entries }: { entries: readonly MenuEntry[] }): JSX.Element {\n  return <>{renderEntries(entries)}</>;\n}\n\n/** Props for {@link MenuBar}. */\nexport interface MenuBarProps extends Omit<HTMLAttributes<HTMLDivElement>, \"className\" | \"children\"> {\n  /**\n   * The menus, each `<Menu label=\"File\">…</Menu>`.\n   *\n   * @claim \"The menus, each `<Menu label=\" registry/ouro/components/ouro/menu/menu.test-d.ts verify:fileLine(registry/ouro/components/ouro/menu/menu.test-d.ts, /\\{\\strigger:\\sReactElement;\\slabel:\\s\"File\";\\schildren:\\s\"Items\"\\s\\}>\\(\\)\\.not\\.toExtend<MenuProps>/)\n   * @claim \"The menus, each `<Menu label=\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu dev messages > throws the exact fix for label outside a MenuBar, and for a trigger inside one)\n   */\n  children: ReactNode;\n  /** Layout only: margins and width. Appearance classes warn in development. */\n  className?: string | undefined;\n}\n\n/**\n * A row of menus, as at the top of a desktop app: File, Edit, View. The arrow keys move\n * between the menus, and once one is open, hovering another switches to it instantly.\n * Each child is a `Menu` with a `label`. Below 640px each menu opens as a bottom sheet.\n *\n * Use `Menu` with `trigger` instead for a single menu button, and `Tabs` or navigation\n * links to move between pages.\n *\n * @group Menus\n *\n * @example\n * <MenuBar aria-label=\"Recipe editor\">\n *   <Menu label=\"File\">\n *     <MenuItem onClick={save} shortcut={[\"mod\", \"s\"]}>Save</MenuItem>\n *   </Menu>\n *   <Menu label=\"Edit\">\n *     <MenuItem onClick={undo} shortcut={[\"mod\", \"z\"]}>Undo</MenuItem>\n *   </Menu>\n * </MenuBar>\n * @claim \"The arrow keys move between the menus\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::MenuBar > is a menubar of menus that the arrow keys move between)\n * @claim \"hovering another switches to it instantly\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::MenuBar > switches instantly to the next menu on hover once one is open)\n * @claim \"Below 640px each menu opens as a bottom sheet\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::MenuBar > opens each menu as a bottom sheet below 640px)\n * @claim \"Each child is a `Menu` with\" registry/ouro/components/ouro/menu/menu.test.tsx verify:testExists(registry/ouro/components/ouro/menu/menu.test.tsx::Menu dev messages > throws the exact fix for label outside a MenuBar, and for a trigger inside one)\n */\nexport function MenuBar({ children, className, ...rest }: MenuBarProps): JSX.Element {\n  const bar = useRef<HTMLDivElement>(null);\n  useAppearanceClassNameCheck(\n    \"MenuBar\",\n    className,\n    process.env.NODE_ENV !== \"production\" ? \"wrap the MenuBar in an element with that class\" : /* istanbul ignore next @preserve -- production only */ \"\",\n  );\n  const directed = (\n    <Menubar {...rest} ref={bar} data-ouro=\"menu-bar\" className={cn(menuBarClass, className)}>\n      <MenuBarContext.Provider value>{children}</MenuBarContext.Provider>\n    </Menubar>\n  );\n  return <PageDirection of={bar}>{directed}</PageDirection>;\n}\n\n/** Props for {@link MenuItem}. */\nexport interface MenuItemProps {\n  /** The item's text, or text with an icon. */\n  children: ReactNode;\n  /** Runs when the item is chosen, by click, tap or Enter. The menu then closes. */\n  onClick?: ((event: MouseEvent<HTMLElement>) => void) | undefined;\n  /**\n   * Makes the item a link: an internal path goes through `OuroProvider`'s router link, an\n   * absolute URL is a plain `<a>`. The menu closes when it is followed.\n   */\n  href?: string | undefined;\n  /**\n   * Marks a link item as the page being shown (`aria-current=\"page\"`, a medium-weight label\n   * with a bar at the start edge, which the highlight does not have), for a menu of pages. It does nothing on an item without `href`.\n   */\n  current?: boolean | undefined;\n  /**\n   * The item's keyboard shortcut, as `Kbd` shows it: `[\"mod\", \"e\"]` is ⌘E on Apple platforms\n   * and Ctrl+E elsewhere. It only shows the keys; bind them in your app.\n   */\n  shortcut?: MenuShortcut | undefined;\n  /** `\"destructive\"` for an action that deletes or cannot be undone. */\n  tone?: \"destructive\" | (string & { 'Only \"destructive\": danger is \"destructive\"': never }) | undefined;\n  /** Shown, but cannot be chosen. */\n  disabled?: boolean | undefined;\n  /**\n   * The id of the agent action the item performs, set as `data-ax-action` on it, so the component\n   * that declares the action finds its control: `<MenuItem axAction=\"mute\">`.\n   */\n  axAction?: string | undefined;\n\n  /** Not a prop. The handler is `onClick`: `<MenuItem onClick={edit}>`. (A `Command` item is the one that takes `onSelect`.) */\n  onSelect?: { \"Use <MenuItem onClick={edit}>\": never };\n  /** Not a prop. A menu item takes `tone`: `<MenuItem tone=\"destructive\">`. */\n  variant?: { 'Use <MenuItem tone=\"destructive\">': never };\n  /** Not a prop. For a link, pass `href`: `<MenuItem href=\"/recipes/1\">`. */\n  asChild?: { 'Use <MenuItem href=\"/recipes/1\">': never };\n  /** Not a prop. A checkable item is a `MenuCheckboxItem`: `<MenuCheckboxItem checked={pinned} onCheckedChange={setPinned}>`. */\n  checked?: { \"Use <MenuCheckboxItem checked={pinned} onCheckedChange={setPinned}>\": never };\n}\n\n/** The shortcut's keys, and the dev message when they came as a string. */\nfunction shortcutKeys(shortcut: MenuShortcut | undefined): readonly string[] | undefined {\n  return typeof shortcut === \"string\" ? shortcut.split(\"+\") : shortcut;\n}\n\nfunction shortcutWarning(component: string, shortcut: unknown): readonly [string, string] | false {\n  return (\n    typeof shortcut === \"string\" && [`shortcut=\"${shortcut}\" is a string; shortcut takes an array`, `<${component} shortcut={[\"mod\", \"k\"]}>`]\n  );\n}\n\n/** The `aria-keyshortcuts` attribute for an item's shortcut, in the platform's form, which its `Kbd` (hidden from the accessible name) shows. */\nfunction keyShortcutProps(shortcut: MenuShortcut | undefined, platform: Platform): { \"aria-keyshortcuts\"?: string } {\n  const keys = shortcutKeys(shortcut);\n  return keys ? { \"aria-keyshortcuts\": ariaKeyShortcuts(keys, platform) } : {};\n}\n\n/** The item's text, then its shortcut at the end. */\nfunction ItemBody({ children, shortcut }: { children: ReactNode; shortcut: MenuShortcut | undefined }): JSX.Element {\n  const keys = shortcutKeys(shortcut);\n  return (\n    <>\n      <span data-ouro-menu-label=\"\" className=\"flex min-w-0 flex-1 items-center gap-2\">\n        {children}\n      </span>\n      {keys && <Kbd keys={keys} aria-hidden=\"true\" className=\"ms-auto\" />}\n    </>\n  );\n}\n\n/**\n * One action in a `Menu`: `onClick` runs it, `href` makes it a link, `shortcut` shows its\n * keys and `tone=\"destructive\"` marks an action that cannot be undone.\n *\n * Use `MenuCheckboxItem` instead for an on/off setting, and `MenuRadioItem` for one choice\n * of several.\n *\n * @group Menus\n *\n * @example\n * <MenuItem onClick={edit} shortcut={[\"mod\", \"e\"]}>Edit</MenuItem>\n * <MenuItem href=\"/recipes/1/print\">Print</MenuItem>\n * <MenuItem tone=\"destructive\" onClick={remove}>Delete</MenuItem>\n */\nexport function MenuItem(props: MenuItemProps): JSX.Element {\n  const { children, onClick, href, current, shortcut, tone: toneProp, disabled, axAction, onSelect, variant, asChild, checked } = props;\n  const platform = usePlatform();\n  useMenuPart(\"MenuItem\", \"<MenuItem>Edit</MenuItem>\");\n  const tone = toneProp === \"destructive\" ? \"destructive\" : undefined;\n  useDevWarnings(\n    \"MenuItem\",\n    process.env.NODE_ENV !== \"production\"\n      ? () => [\n          onSelect !== undefined && [\"onSelect is not a prop\", \"<MenuItem onClick={edit}>\"],\n          variant !== undefined && [\"variant is not a prop; a menu item takes tone\", '<MenuItem tone=\"destructive\">'],\n          asChild !== undefined && [\"asChild is not a prop\", '<MenuItem href=\"/recipes/1\"> for a link'],\n          checked !== undefined && [\n            \"checked is not a prop; a checkable item is a MenuCheckboxItem\",\n            \"<MenuCheckboxItem checked={pinned} onCheckedChange={setPinned}>\",\n          ],\n          toneProp !== undefined && tone === undefined && toneWarning(\"MenuItem\", String(toneProp), [\"destructive\"]),\n          shortcutWarning(\"MenuItem\", shortcut),\n        ]\n      : /* istanbul ignore next @preserve -- production only */ undefined,\n  );\n  const shared = { className: menuItemClass, \"data-ouro-control\": \"menu\", \"data-ouro-part\": \"item\", \"data-tone\": tone, \"data-ax-action\": axAction, ...keyShortcutProps(shortcut, platform), ...(onClick ? { onClick: (event: MouseEvent<HTMLElement>) => onClick(event) } : {}) };\n  const body = <ItemBody shortcut={shortcut}>{children}</ItemBody>;\n  // A disabled link is a disabled item: nothing to follow.\n  if (href !== undefined && !disabled) {\n    return (\n      <BaseMenu.LinkItem {...shared} aria-current={current ? \"page\" : undefined} closeOnClick render={<RouterLink href={href} />}>\n        {body}\n      </BaseMenu.LinkItem>\n    );\n  }\n  return (\n    <BaseMenu.Item {...shared} disabled={disabled}>\n      {body}\n    </BaseMenu.Item>\n  );\n}\n\n/** A check mark, for checkbox and radio items. */\nfunction CheckIcon(): JSX.Element {\n  return (\n    <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\">\n      <path d=\"M3.5 8.5 6.5 11.5 12.5 4.5\" stroke=\"currentColor\" strokeWidth=\"1.75\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n    </svg>\n  );\n}\n\n/** Props for {@link MenuCheckboxItem}. */\nexport interface MenuCheckboxItemProps {\n  /** The setting's text. */\n  children: ReactNode;\n  /** Whether it is on, to control it; pass `onCheckedChange` with it. */\n  checked?: boolean | undefined;\n  /** Whether it starts on, uncontrolled. */\n  defaultChecked?: boolean | undefined;\n  /** Called with the new state when it is toggled. */\n  onCheckedChange?: ((checked: boolean) => void) | undefined;\n  /** The keys of its shortcut, shown at its end: `[\"mod\", \"b\"]`. */\n  shortcut?: MenuShortcut | undefined;\n  /** Shown, but cannot be toggled. */\n  disabled?: boolean | undefined;\n  /** The id of the agent action it performs, set as `data-ax-action` on it, as on a `MenuItem`. */\n  axAction?: string | undefined;\n}\n\n/**\n * An on/off setting in a `Menu`, with a check mark when it is on. Toggling it keeps the menu\n * open, so several settings can change in one go.\n *\n * Use `MenuRadioItem` instead for one choice of several, and `Switch` for a setting on the page.\n *\n * @group Menus\n *\n * @example\n * <MenuCheckboxItem checked={showNotes} onCheckedChange={setShowNotes}>Show notes</MenuCheckboxItem>\n */\nexport function MenuCheckboxItem({ children, shortcut, onCheckedChange, axAction, ...rest }: MenuCheckboxItemProps): JSX.Element {\n  const platform = usePlatform();\n  useMenuPart(\"MenuCheckboxItem\", \"<MenuCheckboxItem>Pin</MenuCheckboxItem>\");\n  useDevWarnings(\n    \"MenuCheckboxItem\",\n    process.env.NODE_ENV !== \"production\" ? () => [shortcutWarning(\"MenuCheckboxItem\", shortcut)] : /* istanbul ignore next @preserve -- production only */ undefined,\n  );\n  return (\n    <BaseMenu.CheckboxItem data-ouro-control=\"menu\" data-ouro-part=\"checkbox-item\" data-ax-action={axAction} {...rest} {...keyShortcutProps(shortcut, platform)} {...(onCheckedChange ? { onCheckedChange: (next: boolean) => onCheckedChange(next) } : {})} className={menuItemClass}>\n      <span data-ouro-menu-indicator=\"\" className={menuIndicatorClass}>\n        <BaseMenu.CheckboxItemIndicator className=\"flex\">\n          <CheckIcon />\n        </BaseMenu.CheckboxItemIndicator>\n      </span>\n      <ItemBody shortcut={shortcut}>{children}</ItemBody>\n    </BaseMenu.CheckboxItem>\n  );\n}\n\n/** Props for {@link MenuRadioGroup}. */\nexport interface MenuRadioGroupProps {\n  /** The `MenuRadioItem`s. */\n  children: ReactNode;\n  /** Names the group, shown above it: \"Sort by\". */\n  label?: string | undefined;\n  /** The chosen value, to control it; pass `onValueChange` with it. */\n  value?: string | undefined;\n  /** The value chosen at first, uncontrolled. */\n  defaultValue?: string | undefined;\n  /** Called with the value of the item chosen. */\n  onValueChange?: ((value: string) => void) | undefined;\n}\n\n/**\n * One choice of several in a `Menu`, such as a sort order: its `MenuRadioItem`s show a mark\n * on the chosen one, and choosing keeps the menu open.\n *\n * Use `MenuCheckboxItem` instead for settings that are each on or off, and `RadioGroup` for a\n * choice on the page.\n *\n * @group Menus\n *\n * @example\n * <MenuRadioGroup label=\"Sort by\" value={sort} onValueChange={setSort}>\n *   <MenuRadioItem value=\"name\">Name</MenuRadioItem>\n *   <MenuRadioItem value=\"date\">Date added</MenuRadioItem>\n * </MenuRadioGroup>\n */\nexport function MenuRadioGroup({ children, label, onValueChange, ...rest }: MenuRadioGroupProps): JSX.Element {\n  useMenuPart(\"MenuRadioGroup\", '<MenuRadioGroup><MenuRadioItem value=\"a\">A</MenuRadioItem></MenuRadioGroup>');\n  return (\n    <BaseMenu.RadioGroup {...rest} {...(onValueChange ? { onValueChange: (next: string) => onValueChange(next) } : {})}>\n      {label !== undefined && <BaseMenu.GroupLabel className={menuGroupLabelClass}>{label}</BaseMenu.GroupLabel>}\n      <RadioGroupContext.Provider value>{children}</RadioGroupContext.Provider>\n    </BaseMenu.RadioGroup>\n  );\n}\n\n/** Props for {@link MenuRadioItem}. */\nexport interface MenuRadioItemProps {\n  /** The choice's text. */\n  children: ReactNode;\n  /** The value the group reports when this item is chosen. */\n  value: string;\n  /** The keys of its shortcut, shown at its end. */\n  shortcut?: MenuShortcut | undefined;\n  /** Shown, but cannot be chosen. */\n  disabled?: boolean | undefined;\n}\n\n/**\n * One choice in a `MenuRadioGroup`, marked when it is the group's value.\n *\n * Use `MenuItem` instead for an action.\n *\n * @group Menus\n *\n * @example\n * <MenuRadioItem value=\"name\">Name</MenuRadioItem>\n */\nexport function MenuRadioItem({ children, shortcut, ...rest }: MenuRadioItemProps): JSX.Element {\n  const platform = usePlatform();\n  if (!useContext(RadioGroupContext)) {\n    devThrow(\n      \"MenuRadioItem\",\n      \"must be rendered inside <MenuRadioGroup>\",\n      process.env.NODE_ENV !== \"production\"\n        ? '<MenuRadioGroup value={sort} onValueChange={setSort}><MenuRadioItem value=\"name\">Name</MenuRadioItem></MenuRadioGroup>'\n        : /* istanbul ignore next @preserve -- production only */ \"\",\n    );\n  }\n  useDevWarnings(\n    \"MenuRadioItem\",\n    process.env.NODE_ENV !== \"production\" ? () => [shortcutWarning(\"MenuRadioItem\", shortcut)] : /* istanbul ignore next @preserve -- production only */ undefined,\n  );\n  return (\n    <BaseMenu.RadioItem data-ouro-control=\"menu\" data-ouro-part=\"radio-item\" {...rest} {...keyShortcutProps(shortcut, platform)} className={menuItemClass}>\n      <span data-ouro-menu-indicator=\"\" className={menuIndicatorClass}>\n        <BaseMenu.RadioItemIndicator className=\"flex\">\n          <CheckIcon />\n        </BaseMenu.RadioItemIndicator>\n      </span>\n      <ItemBody shortcut={shortcut}>{children}</ItemBody>\n    </BaseMenu.RadioItem>\n  );\n}\n\n/** Props for {@link MenuGroup}. */\nexport interface MenuGroupProps {\n  /**\n   * Names the group, shown above its items. It is always required.\n   *\n   * @claim \"It is always required\" registry/ouro/components/ouro/menu/menu.test-d.ts verify:fileLine(registry/ouro/components/ouro/menu/menu.test-d.ts, /\\{\\stype:\\s\"radio\";\\slabel:\\s\"Sort\"\\s\\}>\\(\\)\\.not\\.toExtend<MenuEntry>/)\n   */\n  label: string;\n  /** The group's items. */\n  children: ReactNode;\n}\n\n/**\n * Items under a label in a `Menu`, such as \"Recipe\" and \"Account\" sections.\n *\n * Use `MenuSeparator` instead to divide items without a label, and `MenuRadioGroup` for\n * one choice of several.\n *\n * @group Menus\n *\n * @example\n * <MenuGroup label=\"Recipe\">\n *   <MenuItem onClick={edit}>Edit</MenuItem>\n *   <MenuItem onClick={duplicate}>Duplicate</MenuItem>\n * </MenuGroup>\n */\nexport function MenuGroup({ label, children }: MenuGroupProps): JSX.Element {\n  useMenuPart(\"MenuGroup\", '<MenuGroup label=\"Recipe\">…</MenuGroup>');\n  useDevWarnings(\n    \"MenuGroup\",\n    process.env.NODE_ENV !== \"production\"\n      ? () => [!label && [\"label is required; it names the group for screen readers\", '<MenuGroup label=\"Recipe\">']]\n      : /* istanbul ignore next @preserve -- production only */ undefined,\n  );\n  return (\n    <BaseMenu.Group>\n      <BaseMenu.GroupLabel className={menuGroupLabelClass}>{label}</BaseMenu.GroupLabel>\n      {children}\n    </BaseMenu.Group>\n  );\n}\n\n/** A chevron pointing to the inline end, for a submenu's item; and back, for its Back item. */\nfunction ChevronIcon({ back }: { back?: boolean }): JSX.Element {\n  return (\n    <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" fill=\"none\" className={back ? \"rotate-180 rtl:rotate-0\" : \"ms-auto rtl:rotate-180\"}>\n      <path d=\"M6 3.5 10.5 8 6 12.5\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n    </svg>\n  );\n}\n\n/** Props for {@link MenuSub}. */\nexport interface MenuSubProps {\n  /** The text of the item that opens the submenu. */\n  label: string;\n  /** The submenu's items. */\n  children: ReactNode;\n  /** The item cannot open the submenu. */\n  disabled?: boolean | undefined;\n  /**\n   * The label of the item at the top of the submenu on a phone, where the submenu is a sheet\n   * over its menu, that goes back to it. @default \"Back\"\n   */\n  backLabel?: string | undefined;\n}\n\n/**\n * A nested menu in a `Menu`: an item that opens more items beside it, on hover, click or\n * the arrow key. On a phone it is a sheet over its menu, with a Back item at its top.\n *\n * Use `MenuGroup` instead when the items fit in the menu under a label: nested menus are\n * harder to reach.\n *\n * @group Menus\n *\n * @example\n * <MenuSub label=\"Share\">\n *   <MenuItem onClick={copyLink}>Copy link</MenuItem>\n *   <MenuItem href={mailto}>Email</MenuItem>\n * </MenuSub>\n */\nexport function MenuSub({ label, children, disabled, backLabel = \"Back\" }: MenuSubProps): JSX.Element {\n  const { sheet } = useMenuPart(\"MenuSub\", '<MenuSub label=\"Share\">…</MenuSub>');\n  // Owned here, so the Back item can close only this submenu.\n  const [open, setOpen] = useState(false);\n  return (\n    <BaseMenu.SubmenuRoot open={open} onOpenChange={setOpen} disabled={disabled}>\n      <BaseMenu.SubmenuTrigger data-ouro-control=\"menu\" data-ouro-part=\"submenu-trigger\" className={menuItemClass} disabled={disabled} openOnHover={!sheet}>\n        <span data-ouro-menu-label=\"\" className=\"flex min-w-0 flex-1 items-center gap-2\">\n          {label}\n        </span>\n        <ChevronIcon />\n      </BaseMenu.SubmenuTrigger>\n      <MenuSurface sheet={sheet} context={false}>\n        {sheet && (\n          <BaseMenu.Item data-ouro-menu-back=\"\" data-ouro-control=\"menu\" data-ouro-part=\"back\" className={menuItemClass} closeOnClick={false} onClick={() => setOpen(false)}>\n            <ChevronIcon back />\n            <span data-ouro-menu-label=\"\">{backLabel}</span>\n          </BaseMenu.Item>\n        )}\n        {children}\n      </MenuSurface>\n    </BaseMenu.SubmenuRoot>\n  );\n}\n\n/**\n * A line between items in a `Menu`, to set apart a group of actions such as the\n * destructive ones at the end.\n *\n * Use `MenuGroup` instead when the items need a label.\n *\n * @group Menus\n *\n * @example\n * <MenuItem onClick={edit}>Edit</MenuItem>\n * <MenuSeparator />\n * <MenuItem tone=\"destructive\" onClick={remove}>Delete</MenuItem>\n */\nexport function MenuSeparator(): JSX.Element {\n  useMenuPart(\"MenuSeparator\", \"<MenuSeparator />\");\n  return <BaseMenu.Separator className={menuSeparatorClass} />;\n}\n",
      "type": "registry:ui",
      "target": "@components/ouro/menu/menu.tsx"
    }
  ],
  "docs": "A list of actions that opens from a button, from a right-click or long press, or from a menubar, with one API for all three. Import: import { Menu } from \"@/components/ouro/menu/menu\", with @/components replaced by your components alias (aliases.components in components.json, such as ~/components). Also installed: kbd, the helpers they import in lib/ouro. Needs ouro-base in your stylesheet: add that item once per app, from the same place as this one, if you have not. Docs: https://ui.ouroboros.bot/docs/menu.md Ouro UI v1.3.257.",
  "type": "registry:ui"
}