import { ComponentType, ReactNode } from 'react'; export interface NavItemState { isSelected: boolean; isSectionActive: boolean; } export interface NavSectionDescriptor { id: string; label: string; icon: ComponentType<{ className?: string; }>; items: T[]; itemKey: (item: T) => string; /** DOM id to scroll into view when this item is chosen, e.g. `operation-${key}`. */ targetId: (item: T) => string; /** False for sections with no switchable tab of their own (e.g. Servers, which is always on screen) — only their items support scroll-to-select. Defaults to true. */ isTab?: boolean; /** False to keep a section out of the expanded popover list while still tracking it for the spine's ticks and scroll-spy (e.g. Info: worth a tick, not worth a whole popover entry). Defaults to true. */ showInPopover?: boolean; /** Content rendered for the item — just the badge/label, no button/list chrome, which this component owns so styling stays consistent across specs. */ renderItem: (item: T, state: NavItemState) => ReactNode; } /** A section whose item type has been erased, so sections with different item shapes (a server URL, a `FlatEndpoint`, a plain schema name, ...) can sit in one array. Build one from a concrete `NavSectionDescriptor` via `defineNavSection`. */ export type ErasedNavSection = NavSectionDescriptor; /** * The single cast that erases a section's item type. Safe because * `Navigation` only ever feeds a section's own `items` back into that * same section's `itemKey`/`targetId`/`renderItem` — it never mixes items * across sections — so the erased `unknown` is always the original `T` by * construction, even though the type system can't see that through the array. */ export declare function defineNavSection(section: NavSectionDescriptor): ErasedNavSection; interface NavigationProps { sections: ErasedNavSection[]; activeSection: string | null; onTabChange: (sectionId: string) => void; onItemSelect: (sectionId: string, key: string) => void; selectedItem?: { section: string; key: string; } | null; } /** * The sidebar navigation shared by AsyncAPI and OpenAPI, styled after Medium's * table-of-contents. On wide layouts a bare tick "spine" (a parent tick per * section plus a child tick per item, scroll-spy highlighted) sits fixed in * the left gutter at the viewport's vertical center; hovering or clicking it * opens a floating popover of sections (icon + label + count) with their * items indented beneath. On narrow layouts (no gutter) the trigger is a * floating bottom-right button that opens the same popover on click. * Each spec supplies its own data as section descriptors (see * `NavSectionDescriptor`) via a thin adapter — `AsyncAPINavigation` / * `OpenAPINavigation`, both in this same directory — so spec-specific * concerns (channel addresses, action badges, method badges, ...) stay in the * adapter while the mechanics below are written once. */ export default function Navigation({ sections, activeSection, onTabChange, onItemSelect, selectedItem, }: NavigationProps): import("react").JSX.Element; export {};