/** * NOTE: If you refactor this to split up the modules into separate files, * you'll need to update the rollup config for react-router-dom-v5-compat. */ import * as React from "react"; import type { FutureConfig, NavigateOptions, RelativeRoutingType, RouteObject, To } from "react-router"; import type { Fetcher, FormEncType, FormMethod, FutureConfig as RouterFutureConfig, GetScrollRestorationKeyFunction, History, HTMLFormMethod, HydrationState, Router as RemixRouter, V7_FormMethod } from "@remix-run/router"; import type { SubmitOptions, ParamKeyValuePair, URLSearchParamsInit, SubmitTarget } from "./dom"; import { createSearchParams } from "./dom"; export type { FormEncType, FormMethod, GetScrollRestorationKeyFunction, ParamKeyValuePair, SubmitOptions, URLSearchParamsInit, V7_FormMethod, }; export { createSearchParams }; export type { ActionFunction, ActionFunctionArgs, AwaitProps, unstable_Blocker, unstable_BlockerFunction, DataRouteMatch, DataRouteObject, ErrorResponse, Fetcher, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LazyRouteFunction, LayoutRouteProps, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, Params, ParamParseKey, Path, PathMatch, Pathname, PathPattern, PathRouteProps, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch, } from "react-router"; export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, RouterProvider, Routes, createMemoryRouter, createPath, createRoutesFromChildren, createRoutesFromElements, defer, isRouteErrorResponse, generatePath, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, resolvePath, useActionData, useAsyncError, useAsyncValue, unstable_useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, } from "react-router"; /** @internal */ export { UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_NavigationContext, UNSAFE_LocationContext, UNSAFE_RouteContext, UNSAFE_useRouteId, } from "react-router"; declare global { var __staticRouterHydrationData: HydrationState | undefined; } interface DOMRouterOpts { basename?: string; future?: Partial>; hydrationData?: HydrationState; window?: Window; } export declare function createBrowserRouter(routes: RouteObject[], opts?: DOMRouterOpts): RemixRouter; export declare function createHashRouter(routes: RouteObject[], opts?: DOMRouterOpts): RemixRouter; export interface BrowserRouterProps { basename?: string; children?: React.ReactNode; future?: FutureConfig; window?: Window; } /** * A `` for use in web browsers. Provides the cleanest URLs. */ export declare function BrowserRouter({ basename, children, future, window, }: BrowserRouterProps): React.JSX.Element; export interface HashRouterProps { basename?: string; children?: React.ReactNode; future?: FutureConfig; window?: Window; } /** * A `` for use in web browsers. Stores the location in the hash * portion of the URL so it is not sent to the server. */ export declare function HashRouter({ basename, children, future, window, }: HashRouterProps): React.JSX.Element; export interface HistoryRouterProps { basename?: string; children?: React.ReactNode; future?: FutureConfig; history: History; } /** * A `` that accepts a pre-instantiated history object. It's important * to note that using your own history object is highly discouraged and may add * two versions of the history library to your bundles unless you use the same * version of the history library that React Router uses internally. */ declare function HistoryRouter({ basename, children, future, history, }: HistoryRouterProps): React.JSX.Element; declare namespace HistoryRouter { var displayName: string; } export { HistoryRouter as unstable_HistoryRouter }; export interface LinkProps extends Omit, "href"> { reloadDocument?: boolean; replace?: boolean; state?: any; preventScrollReset?: boolean; relative?: RelativeRoutingType; to: To; } /** * The public API for rendering a history-aware . */ export declare const Link: React.ForwardRefExoticComponent>; export interface NavLinkProps extends Omit { children?: React.ReactNode | ((props: { isActive: boolean; isPending: boolean; }) => React.ReactNode); caseSensitive?: boolean; className?: string | ((props: { isActive: boolean; isPending: boolean; }) => string | undefined); end?: boolean; style?: React.CSSProperties | ((props: { isActive: boolean; isPending: boolean; }) => React.CSSProperties | undefined); } /** * A wrapper that knows if it's "active" or not. */ export declare const NavLink: React.ForwardRefExoticComponent>; export interface FetcherFormProps extends React.FormHTMLAttributes { /** * The HTTP verb to use when the form is submit. Supports "get", "post", * "put", "delete", "patch". */ method?: HTMLFormMethod; /** * `
` - enhancing beyond the normal string type and limiting * to the built-in browser supported values */ encType?: "application/x-www-form-urlencoded" | "multipart/form-data" | "text/plain"; /** * Normal `` but supports React Router's relative paths. */ action?: string; /** * Determines whether the form action is relative to the route hierarchy or * the pathname. Use this if you want to opt out of navigating the route * hierarchy and want to instead route based on /-delimited URL segments */ relative?: RelativeRoutingType; /** * Prevent the scroll position from resetting to the top of the viewport on * completion of the navigation when using the component */ preventScrollReset?: boolean; /** * A function to call when the form is submitted. If you call * `event.preventDefault()` then this form will not do anything. */ onSubmit?: React.FormEventHandler; } export interface FormProps extends FetcherFormProps { /** * Forces a full document navigation instead of a fetch. */ reloadDocument?: boolean; /** * Replaces the current entry in the browser history stack when the form * navigates. Use this if you don't want the user to be able to click "back" * to the page with the form on it. */ replace?: boolean; /** * State object to add to the history stack entry for this navigation */ state?: any; } /** * A `@remix-run/router`-aware ``. It behaves like a normal form except * that the interaction with the server is with `fetch` instead of new document * requests, allowing components to add nicer UX to the page as the form is * submitted and returns with data. */ export declare const Form: React.ForwardRefExoticComponent>; export interface ScrollRestorationProps { getKey?: GetScrollRestorationKeyFunction; storageKey?: string; } /** * This component will emulate the browser's scroll restoration on location * changes. */ export declare function ScrollRestoration({ getKey, storageKey, }: ScrollRestorationProps): null; export declare namespace ScrollRestoration { var displayName: string; } /** * Handles the click behavior for router `` components. This is useful if * you need to create custom `` components with the same click behavior we * use in our exported ``. */ export declare function useLinkClickHandler(to: To, { target, replace: replaceProp, state, preventScrollReset, relative, }?: { target?: React.HTMLAttributeAnchorTarget; replace?: boolean; state?: any; preventScrollReset?: boolean; relative?: RelativeRoutingType; }): (event: React.MouseEvent) => void; /** * A convenient wrapper for reading and writing search parameters via the * URLSearchParams interface. */ export declare function useSearchParams(defaultInit?: URLSearchParamsInit): [URLSearchParams, SetURLSearchParams]; export type SetURLSearchParams = (nextInit?: URLSearchParamsInit | ((prev: URLSearchParams) => URLSearchParamsInit), navigateOpts?: NavigateOptions) => void; /** * Submits a HTML `` to the server without reloading the page. */ export interface SubmitFunction { ( /** * Specifies the `` to be submitted to the server, a specific * `