import { useVisibility } from "@charcuterie/logic" import type { ControlSize } from "@charcuterie/tokens" import type { Placement } from "@floating-ui/react" import type { ReactElement, ReactNode } from "react" import { Button } from "../Button/Button.tsx" import { IconButton } from "../IconButton/IconButton.tsx" import { usePanelItemSize } from "../Overlay/usePanelItemSize.ts" import { Popover } from "../Popover/Popover.tsx" import { useToolbarOverflow } from "../Toolbar/useToolbarOverflow.ts" import { toClassName } from "../toClassName.ts" import { NavLink } from "./NavLink.tsx" import type { NavItem } from "./navItems.ts" import { getNavItemKey, resolveActiveKey, } from "./navItems.ts" /** * Where the destinations are drawn. Not *whether* — see * `useNavLayout`, which answers that from the width. */ export type NavLayout = | "bar" | "bottom" | "menu" | "rail" | "railIcons" type NavCommonProps = { /** * The destinations, in the order the product reads. * * Annotate the array as `NavRailItem[]` when the app uses a rail: * it is the same shape with `icon` made **required**, because * `railIcons` takes the label away and an item with no glyph is a * blank square that still navigates. `NavItem` keeps `icon` * optional so that a `bar`, where the label never goes anywhere, * does not have to invent one. */ items: readonly NavItem[] /** * The address the app is at — usually `location.pathname`. The * item that matches wears `aria-current="page"`. * * Omitted means nothing is current, which is honest on a screen * the nav does not contain (a modal route, an error page) and is * better than marking the closest thing. */ activeHref?: string className?: string /** * The `