react-router-dom-v5-compat 6.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "react-router-dom-v5-compat",
3
+ "version": "6.2.2",
4
+ "author": "Remix Software <hello@remix.run>",
5
+ "description": "Migration path to React Router v6 from v4/5",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/remix-run/react-router.git",
9
+ "directory": "packages/react-router-dom-v5-compat"
10
+ },
11
+ "license": "MIT",
12
+ "main": "./main.js",
13
+ "module": "./index.js",
14
+ "types": "./index.d.ts",
15
+ "unpkg": "./umd/react-router.production.min.js",
16
+ "peerDependencies": {
17
+ "react": ">=16.8",
18
+ "react-dom": ">=16.8",
19
+ "react-router-dom": "4 || 5"
20
+ },
21
+ "dependencies": {
22
+ "history": "^5.3.0",
23
+ "react-router": "6.2.2"
24
+ },
25
+ "sideEffects": false,
26
+ "keywords": [
27
+ "react",
28
+ "router",
29
+ "route",
30
+ "routing",
31
+ "history",
32
+ "link"
33
+ ]
34
+ }
@@ -0,0 +1,117 @@
1
+ /**
2
+ * NOTE: If you refactor this to split up the modules into separate files,
3
+ * you'll need to update the rollup config for react-router-dom-v5-compat.
4
+ */
5
+ import * as React from "react";
6
+ import type { History } from "history";
7
+ import { MemoryRouter, Navigate, Outlet, Route, Router, Routes, createRoutesFromChildren, generatePath, matchRoutes, matchPath, createPath, parsePath, resolvePath, renderMatches, useHref, useInRouterContext, useLocation, useMatch, useNavigate, useNavigationType, useOutlet, useParams, useResolvedPath, useRoutes, useOutletContext } from "react-router";
8
+ import type { To } from "react-router";
9
+ export { MemoryRouter, Navigate, Outlet, Route, Router, Routes, createRoutesFromChildren, generatePath, matchRoutes, matchPath, createPath, parsePath, renderMatches, resolvePath, useHref, useInRouterContext, useLocation, useMatch, useNavigate, useNavigationType, useOutlet, useParams, useResolvedPath, useRoutes, useOutletContext, };
10
+ export { NavigationType } from "react-router";
11
+ export type { Hash, Location, Path, To, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigator, OutletProps, Params, PathMatch, RouteMatch, RouteObject, RouteProps, PathRouteProps, LayoutRouteProps, IndexRouteProps, RouterProps, Pathname, Search, RoutesProps, } from "react-router";
12
+ /** @internal */
13
+ export { UNSAFE_NavigationContext, UNSAFE_LocationContext, UNSAFE_RouteContext, } from "react-router";
14
+ export interface BrowserRouterProps {
15
+ basename?: string;
16
+ children?: React.ReactNode;
17
+ window?: Window;
18
+ }
19
+ /**
20
+ * A `<Router>` for use in web browsers. Provides the cleanest URLs.
21
+ */
22
+ export declare function BrowserRouter({ basename, children, window, }: BrowserRouterProps): JSX.Element;
23
+ export interface HashRouterProps {
24
+ basename?: string;
25
+ children?: React.ReactNode;
26
+ window?: Window;
27
+ }
28
+ /**
29
+ * A `<Router>` for use in web browsers. Stores the location in the hash
30
+ * portion of the URL so it is not sent to the server.
31
+ */
32
+ export declare function HashRouter({ basename, children, window }: HashRouterProps): JSX.Element;
33
+ export interface HistoryRouterProps {
34
+ basename?: string;
35
+ children?: React.ReactNode;
36
+ history: History;
37
+ }
38
+ /**
39
+ * A `<Router>` that accepts a pre-instantiated history object. It's important
40
+ * to note that using your own history object is highly discouraged and may add
41
+ * two versions of the history library to your bundles unless you use the same
42
+ * version of the history library that React Router uses internally.
43
+ */
44
+ declare function HistoryRouter({ basename, children, history }: HistoryRouterProps): JSX.Element;
45
+ declare namespace HistoryRouter {
46
+ var displayName: string;
47
+ }
48
+ export { HistoryRouter as unstable_HistoryRouter };
49
+ export interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href"> {
50
+ reloadDocument?: boolean;
51
+ replace?: boolean;
52
+ state?: any;
53
+ to: To;
54
+ }
55
+ /**
56
+ * The public API for rendering a history-aware <a>.
57
+ */
58
+ export declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
59
+ export interface NavLinkProps extends Omit<LinkProps, "className" | "style" | "children"> {
60
+ children: React.ReactNode | ((props: {
61
+ isActive: boolean;
62
+ }) => React.ReactNode);
63
+ caseSensitive?: boolean;
64
+ className?: string | ((props: {
65
+ isActive: boolean;
66
+ }) => string | undefined);
67
+ end?: boolean;
68
+ style?: React.CSSProperties | ((props: {
69
+ isActive: boolean;
70
+ }) => React.CSSProperties);
71
+ }
72
+ /**
73
+ * A <Link> wrapper that knows if it's "active" or not.
74
+ */
75
+ export declare const NavLink: React.ForwardRefExoticComponent<NavLinkProps & React.RefAttributes<HTMLAnchorElement>>;
76
+ /**
77
+ * Handles the click behavior for router `<Link>` components. This is useful if
78
+ * you need to create custom `<Link>` components with the same click behavior we
79
+ * use in our exported `<Link>`.
80
+ */
81
+ export declare function useLinkClickHandler<E extends Element = HTMLAnchorElement>(to: To, { target, replace: replaceProp, state, }?: {
82
+ target?: React.HTMLAttributeAnchorTarget;
83
+ replace?: boolean;
84
+ state?: any;
85
+ }): (event: React.MouseEvent<E, MouseEvent>) => void;
86
+ /**
87
+ * A convenient wrapper for reading and writing search parameters via the
88
+ * URLSearchParams interface.
89
+ */
90
+ export declare function useSearchParams(defaultInit?: URLSearchParamsInit): readonly [URLSearchParams, (nextInit: URLSearchParamsInit, navigateOptions?: {
91
+ replace?: boolean | undefined;
92
+ state?: any;
93
+ } | undefined) => void];
94
+ export declare type ParamKeyValuePair = [string, string];
95
+ export declare type URLSearchParamsInit = string | ParamKeyValuePair[] | Record<string, string | string[]> | URLSearchParams;
96
+ /**
97
+ * Creates a URLSearchParams object using the given initializer.
98
+ *
99
+ * This is identical to `new URLSearchParams(init)` except it also
100
+ * supports arrays as values in the object form of the initializer
101
+ * instead of just strings. This is convenient when you need multiple
102
+ * values for a given key, but don't want to use an array initializer.
103
+ *
104
+ * For example, instead of:
105
+ *
106
+ * let searchParams = new URLSearchParams([
107
+ * ['sort', 'name'],
108
+ * ['sort', 'price']
109
+ * ]);
110
+ *
111
+ * you can do:
112
+ *
113
+ * let searchParams = createSearchParams({
114
+ * sort: ['name', 'price']
115
+ * });
116
+ */
117
+ export declare function createSearchParams(init?: URLSearchParamsInit): URLSearchParams;