import type { ReactNode } from "react"; export type NavItem = { /** * Where it goes. Routed through the injected `RouterLink` when it * is this app's own path, and left to the platform when it is not. */ href: string; /** Decoration beside the label. Never the accessible name. */ icon?: ReactNode; /** * A destination outside this app. It renders a plain anchor with * `target="_blank"` and `rel="noopener noreferrer"`, and it is * never current — pushing `https://…` onto a router's history * navigates the app to a route it does not have. */ isExternal?: boolean; /** Defaults to `href`, which is already unique in a nav. */ key?: string; /** The visible text, and the accessible name. */ label: string; }; /** * What the rail layouts take. `icon` stops being optional, because * `railIcons` takes the **label** away: an item with no glyph is a * blank square that still navigates, and there is no visual defect * to notice because the row reads as padding. * * Optional would move that failure out of the type checker and into * the first time somebody drags a window narrow. The library still * ships no icons — a glyph in a default renders as nothing where the * font lacks it, so the app brings its own. */ export type NavRailItem = NavItem & { icon: ReactNode; }; export declare const getNavItemKey: (item: NavItem) => string; export declare const getIsCurrentHref: ({ currentHref, href, }: { /** Where the reader is. `undefined` means "nothing is current". */ currentHref: string | undefined; /** Where this destination goes. */ href: string; }) => boolean; /** * The current destination's key, or `null` — the whole-list answer, * and the one `Nav` marks with `aria-current="page"`. * * ## Exactly one, because the deepest match wins * * `getIsCurrentHref` is asked per item, so a nav holding both * `/settings` and `/settings/labels` gets `true` twice while the * reader is on the deeper one. Two current items is a nav that has * stopped saying anything — the same thing react-router's `` footgun produces — so the longest matching path wins and * the shallower section stands down. * * Longest by **path**, not by array position: an app must be able to * list its destinations in the order the product reads (Docket's is * the pipeline) without that order deciding which one lights up. * * ## An external item is never current * * It is not a place inside this app, so no address the app is at can * be it. Without this, an item pointing at `https://example.com/board` * matches the app's own `/board` on a plain string compare. */ export declare const resolveActiveKey: (items: readonly NavItem[], activeHref?: string) => string | null; //# sourceMappingURL=navItems.d.ts.map