All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.index.d.ts Maven / Gradle / Ivy

/**
 * 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, Location, NavigateOptions, RelativeRoutingType, RouteObject, RouterProviderProps, To, unstable_PatchRoutesOnNavigationFunction } from "react-router";
import type { unstable_DataStrategyFunction, unstable_DataStrategyFunctionArgs, unstable_DataStrategyMatch, Fetcher, FormEncType, FormMethod, FutureConfig as RouterFutureConfig, GetScrollRestorationKeyFunction, History, HTMLFormMethod, HydrationState, Router as RemixRouter, V7_FormMethod, BlockerFunction } from "@remix-run/router";
import { UNSAFE_ErrorResponseImpl as ErrorResponseImpl } from "@remix-run/router";
import type { SubmitOptions, ParamKeyValuePair, URLSearchParamsInit, SubmitTarget, FetcherSubmitOptions } from "./dom";
import { createSearchParams } from "./dom";
export type { unstable_DataStrategyFunction, unstable_DataStrategyFunctionArgs, unstable_DataStrategyMatch, FormEncType, FormMethod, GetScrollRestorationKeyFunction, ParamKeyValuePair, SubmitOptions, URLSearchParamsInit, V7_FormMethod, };
export { createSearchParams, ErrorResponseImpl as UNSAFE_ErrorResponseImpl };
export type { ActionFunction, ActionFunctionArgs, AwaitProps, Blocker, BlockerFunction, DataRouteMatch, DataRouteObject, ErrorResponse, Fetcher, FutureConfig, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LazyRouteFunction, LayoutRouteProps, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, Params, ParamParseKey, Path, PathMatch, Pathname, PathParam, PathPattern, PathRouteProps, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch, unstable_HandlerResult, unstable_PatchRoutesOnNavigationFunction, } from "react-router";
export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, createMemoryRouter, createPath, createRoutesFromChildren, createRoutesFromElements, defer, isRouteErrorResponse, generatePath, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, replace, renderMatches, resolvePath, useActionData, useAsyncError, useAsyncValue, 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;
    var __reactRouterVersion: string;
    interface Document {
        startViewTransition(cb: () => Promise | void): ViewTransition;
    }
}
interface DOMRouterOpts {
    basename?: string;
    future?: Partial>;
    hydrationData?: HydrationState;
    unstable_dataStrategy?: unstable_DataStrategyFunction;
    unstable_patchRoutesOnNavigation?: unstable_PatchRoutesOnNavigationFunction;
    window?: Window;
}
export declare function createBrowserRouter(routes: RouteObject[], opts?: DOMRouterOpts): RemixRouter;
export declare function createHashRouter(routes: RouteObject[], opts?: DOMRouterOpts): RemixRouter;
type ViewTransitionContextObject = {
    isTransitioning: false;
} | {
    isTransitioning: true;
    flushSync: boolean;
    currentLocation: Location;
    nextLocation: Location;
};
declare const ViewTransitionContext: React.Context;
export { ViewTransitionContext as UNSAFE_ViewTransitionContext };
type FetchersContextObject = Map;
declare const FetchersContext: React.Context;
export { FetchersContext as UNSAFE_FetchersContext };
interface ViewTransition {
    finished: Promise;
    ready: Promise;
    updateCallbackDone: Promise;
    skipTransition(): void;
}
/**
 * Given a Remix Router instance, render the appropriate UI
 */
export declare function RouterProvider({ fallbackElement, router, future, }: RouterProviderProps): React.ReactElement;
export interface BrowserRouterProps {
    basename?: string;
    children?: React.ReactNode;
    future?: Partial;
    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?: Partial;
    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;
    unstable_viewTransition?: boolean;
}
/**
 * The public API for rendering a history-aware ``.
 */
export declare const Link: React.ForwardRefExoticComponent>;
export type NavLinkRenderProps = {
    isActive: boolean;
    isPending: boolean;
    isTransitioning: boolean;
};
export interface NavLinkProps extends Omit {
    children?: React.ReactNode | ((props: NavLinkRenderProps) => React.ReactNode);
    caseSensitive?: boolean;
    className?: string | ((props: NavLinkRenderProps) => string | undefined);
    end?: boolean;
    style?: React.CSSProperties | ((props: NavLinkRenderProps) => React.CSSProperties | undefined);
}
/**
 * A `` wrapper that knows if it's "active" or not.
 */
export declare const NavLink: React.ForwardRefExoticComponent>;
/**
 * Form props shared by navigations and fetchers
 */
interface SharedFormProps 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; } /** * Form props available to fetchers */ export interface FetcherFormProps extends SharedFormProps { } /** * Form props available to navigations */ export interface FormProps extends SharedFormProps { /** * Indicate a specific fetcherKey to use when using navigate=false */ fetcherKey?: string; /** * navigate=false will use a fetcher instead of a navigation */ navigate?: boolean; /** * 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; /** * Enable view transitions on this Form navigation */ unstable_viewTransition?: boolean; } /** * 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, unstable_viewTransition, }?: { target?: React.HTMLAttributeAnchorTarget; replace?: boolean; state?: any; preventScrollReset?: boolean; relative?: RelativeRoutingType; unstable_viewTransition?: boolean; }): (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 * `




© 2015 - 2024 Weber Informatics LLC | Privacy Policy