import "./screen_router.css"; import React from "react"; import { useRender } from "@base-ui/react/use-render"; import { type StyleProps } from "./style_props"; /** Consumer-facing navigation state. Provided by Dialog, MDD, or standalone ScreenRouter. */ export interface ScreenRouterContextValue { currentPath: string; navigate: (path: string, options?: { replace?: boolean; }) => void; goBack: () => void; canGoBack: boolean; params: Record; } export declare const ScreenRouterContext: React.Context; /** Internal state for Screen component — route registry and stack paths. Not for consumers. */ export interface ScreenRouterInternalContextValue { stackPaths: string[]; routePatterns: string[]; registerRoute: (pattern: string) => void; unregisterRoute: (pattern: string) => void; } export declare const ScreenRouterInternalContext: React.Context; export declare function useScreenRouter(): ScreenRouterContextValue; interface RouteRegistry { routePatterns: string[]; registerRoute: (pattern: string) => void; unregisterRoute: (pattern: string) => void; } /** Manages the set of registered route patterns. Shared by all routers. */ export declare function useRouteRegistry(): RouteRegistry; interface NavigationStackResult { routerValue: ScreenRouterContextValue; internalValue: ScreenRouterInternalContextValue; /** Reset stack to empty (back to initialRoute). Called when container closes. */ resetStack: () => void; } /** * Flat-stack navigation state machine. Used by Dialog and standalone ScreenRouter. * MDD has its own section-based stack logic and does not use this hook. */ export declare function useNavigationStack(initialRoute: string, routeRegistry: RouteRegistry): NavigationStackResult; /** @see ScreenActiveContext */ export declare function useScreenActive(): boolean; export interface ScreenProps extends StyleProps { /** Route pattern to match. Use empty string "" for the default/initial screen. */ route: string; /** Content to render. Can be ReactNode or render function receiving params. */ children: React.ReactNode | ((params: Record) => React.ReactNode); testID?: string; ref?: React.Ref; render?: useRender.RenderProp; } /** * Universal route-matched screen component. * * Registers its route pattern on mount, unregisters on unmount. Renders when * the route matches a path in the navigation stack. Active screen is * `display: flex`, stacked screens behind it are `display: none` (preserving * scroll position). Unmounted when not in the stack at all. * * Works inside Dialog, MasterDetailDialog, or standalone ScreenRouter. */ export declare function Screen(props: ScreenProps): React.JSX.Element | null; export interface ScreenRouterProps { /** Initial route when the router mounts. Defaults to empty string. */ initialRoute?: string; children: React.ReactNode; } /** * Standalone flat-stack router. Use inside any container that needs * state-backed navigation without Dialog or MDD chrome. */ export declare function ScreenRouter(props: ScreenRouterProps): React.JSX.Element; export {};