Socket
Socket
Sign inDemoInstall

react-router-dom

Package Overview
Dependencies
4
Maintainers
3
Versions
331
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.0.0-beta.5 to 6.0.0-beta.6

LICENSE.md

4

index.d.ts

@@ -5,3 +5,5 @@ import * as React from "react";

export { MemoryRouter, Navigate, Outlet, Route, Router, Routes, createRoutesFromChildren, generatePath, matchRoutes, matchPath, renderMatches, resolvePath, useBlocker, useHref, useInRouterContext, useLocation, useMatch, useNavigate, useOutlet, useParams, useResolvedPath, useRoutes };
export type { MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigator, OutletProps, Params, PathMatch, RouteMatch, RouteObject, RouteProps, RouterProps, RoutesProps } from "react-router";
export type { MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigator, OutletProps, Params, PathMatch, RouteMatch, RouteObject, RouteProps, PathRouteProps, LayoutRouteProps, IndexRouteProps, RouterProps, RoutesProps } from "react-router";
/** @internal */
export { UNSAFE_NavigationContext, UNSAFE_LocationContext, UNSAFE_RouteContext } from "react-router";
export interface BrowserRouterProps {

@@ -8,0 +10,0 @@ basename?: string;

@@ -0,1 +1,11 @@

/**
* React Router DOM v6.0.0-beta.6
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
import { useRef, useState, useLayoutEffect, createElement, forwardRef, useCallback, useMemo } from 'react';

@@ -57,6 +67,8 @@ import { createBrowserHistory, createHashHistory, createPath } from 'history';

} ////////////////////////////////////////////////////////////////////////////////
// COMPONENTS
////////////////////////////////////////////////////////////////////////////////
/**
* A <Router> for use in web browsers. Provides the cleanest URLs.
*/
function BrowserRouter(_ref) {

@@ -90,2 +102,3 @@ let {

}
/**

@@ -95,3 +108,2 @@ * A <Router> for use in web browsers. Stores the location in the hash

*/
function HashRouter(_ref2) {

@@ -129,7 +141,6 @@ let {

}
/**
* The public API for rendering a history-aware <a>.
*/
const Link = /*#__PURE__*/forwardRef(function LinkWithRef(_ref3, ref) {

@@ -175,7 +186,6 @@ let {

}
/**
* A <Link> wrapper that knows if it's "active" or not.
*/
const NavLink = /*#__PURE__*/forwardRef(function NavLinkWithRef(_ref4, ref) {

@@ -202,3 +212,3 @@ let {

let isActive = end ? locationPathname === toPathname : locationPathname.startsWith(toPathname);
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(toPathname.length) === "/";
let ariaCurrent = isActive ? ariaCurrentProp : undefined;

@@ -235,2 +245,3 @@ let className;

}
/**

@@ -243,4 +254,2 @@ * A declarative interface for showing a window.confirm dialog with the given

*/
function Prompt(_ref5) {

@@ -331,2 +340,3 @@ let {

}
/**

@@ -353,3 +363,2 @@ * Creates a URLSearchParams object using the given initializer.

*/
function createSearchParams(init) {

@@ -356,0 +365,0 @@ if (init === void 0) {

@@ -0,1 +1,11 @@

/**
* React Router DOM v6.0.0-beta.6
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
'use strict';

@@ -2,0 +12,0 @@

{
"name": "react-router-dom",
"version": "6.0.0-beta.5",
"version": "6.0.0-beta.6",
"author": "Remix Software <hello@remix.run>",

@@ -12,8 +12,19 @@ "description": "Declarative routing for React web applications",

"license": "MIT",
"main": "main.js",
"module": "index.js",
"types": "index.d.ts",
"unpkg": "umd/react-router-dom.production.min.js",
"main": "./main.js",
"module": "./index.js",
"types": "./index.d.ts",
"unpkg": "./umd/react-router-dom.production.min.js",
"exports": {
"./package.json": "./package.json",
".": {
"import": "./index.js",
"require": "./main.js"
},
"./server": {
"import": "./server.mjs",
"require": "./server.js"
}
},
"dependencies": {
"react-router": "6.0.0-beta.5"
"react-router": "6.0.0-beta.6"
},

@@ -20,0 +31,0 @@ "peerDependencies": {

@@ -0,1 +1,11 @@

/**
* React Router DOM v6.0.0-beta.6
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
import { useRef, useState, useLayoutEffect, createElement, forwardRef, useCallback, useMemo } from 'react';

@@ -21,6 +31,8 @@ import { createBrowserHistory, createHashHistory, createPath } from 'history';

} ////////////////////////////////////////////////////////////////////////////////
// COMPONENTS
////////////////////////////////////////////////////////////////////////////////
/**
* A <Router> for use in web browsers. Provides the cleanest URLs.
*/
function BrowserRouter({

@@ -53,2 +65,3 @@ basename,

}
/**

@@ -58,3 +71,2 @@ * A <Router> for use in web browsers. Stores the location in the hash

*/
function HashRouter({

@@ -91,7 +103,6 @@ basename,

}
/**
* The public API for rendering a history-aware <a>.
*/
const Link = /*#__PURE__*/forwardRef(function LinkWithRef({

@@ -123,3 +134,3 @@ onClick,

// eslint-disable-next-line jsx-a11y/anchor-has-content
createElement("a", { ...rest,
createElement("a", Object.assign({}, rest, {
href: href,

@@ -129,3 +140,3 @@ onClick: handleClick,

target: target
})
}))
);

@@ -137,7 +148,6 @@ });

}
/**
* A <Link> wrapper that knows if it's "active" or not.
*/
const NavLink = /*#__PURE__*/forwardRef(function NavLinkWithRef({

@@ -162,3 +172,3 @@ "aria-current": ariaCurrentProp = "page",

let isActive = end ? locationPathname === toPathname : locationPathname.startsWith(toPathname);
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(toPathname.length) === "/";
let ariaCurrent = isActive ? ariaCurrentProp : undefined;

@@ -183,3 +193,3 @@ let className;

}) : styleProp;
return /*#__PURE__*/createElement(Link, { ...rest,
return /*#__PURE__*/createElement(Link, Object.assign({}, rest, {
"aria-current": ariaCurrent,

@@ -190,3 +200,3 @@ className: className,

to: to
});
}));
});

@@ -197,2 +207,3 @@

}
/**

@@ -205,4 +216,2 @@ * A declarative interface for showing a window.confirm dialog with the given

*/
function Prompt({

@@ -287,2 +296,3 @@ message,

}
/**

@@ -309,3 +319,2 @@ * Creates a URLSearchParams object using the given initializer.

*/
function createSearchParams(init = "") {

@@ -312,0 +321,0 @@ return new URLSearchParams(typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => {

@@ -1,2 +0,12 @@

import{useRef as e,useState as t,useLayoutEffect as r,createElement as n,forwardRef as a,useCallback as o,useMemo as c}from"react";import{createBrowserHistory as i,createHashHistory as u,createPath as l}from"history";import{Router as s,useHref as f,useLocation as h,useResolvedPath as m,useNavigate as p,useBlocker as d}from"react-router";export{MemoryRouter,Navigate,Outlet,Route,Router,Routes,UNSAFE_LocationContext,UNSAFE_NavigationContext,UNSAFE_RouteContext,createRoutesFromChildren,generatePath,matchPath,matchRoutes,renderMatches,resolvePath,useBlocker,useHref,useInRouterContext,useLocation,useMatch,useNavigate,useOutlet,useParams,useResolvedPath,useRoutes}from"react-router";function y({basename:a,children:o,window:c}){let u=e();null==u.current&&(u.current=i({window:c}));let l=u.current,[f,h]=t({action:l.action,location:l.location});return r(()=>l.listen(h),[l]),n(s,{basename:a,children:o,action:f.action,location:f.location,navigator:l})}function g({basename:a,children:o,window:c}){let i=e();null==i.current&&(i.current=u({window:c}));let l=i.current,[f,h]=t({action:l.action,location:l.location});return r(()=>l.listen(h),[l]),n(s,{basename:a,children:o,action:f.action,location:f.location,navigator:l})}const v=a((function({onClick:e,replace:t=!1,state:r,target:a,to:o,...c},i){let u=f(o),l=A(o,{replace:t,state:r,target:a});return n("a",{...c,href:u,onClick:function(t){e&&e(t),t.defaultPrevented||l(t)},ref:i,target:a})})),w=a((function({"aria-current":e="page",caseSensitive:t=!1,className:r="",end:a=!1,style:o,to:c,...i},u){let l=h(),s=m(c),f=l.pathname,p=s.pathname;t||(f=f.toLowerCase(),p=p.toLowerCase());let d,y=a?f===p:f.startsWith(p),g=y?e:void 0;d="function"==typeof r?r({isActive:y}):[r,y?"active":null].filter(Boolean).join(" ");let w="function"==typeof o?o({isActive:y}):o;return n(v,{...i,"aria-current":g,className:d,ref:u,style:w,to:c})}));function R({message:e,when:t}){return C(e,t),null}function A(e,{target:t,replace:r,state:n}={}){let a=p(),c=h(),i=m(e);return o(o=>{if(!(0!==o.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(o))){o.preventDefault();let t=!!r||l(c)===l(i);a(e,{replace:t,state:n})}},[c,a,i,r,n,t,e])}function C(e,t=!0){let r=o(t=>{window.confirm(e)&&t.retry()},[e]);d(r,t)}function N(t){let r=e(P(t)),n=h(),a=c(()=>{let e=P(n.search);for(let t of r.current.keys())e.has(t)||r.current.getAll(t).forEach(r=>{e.append(t,r)});return e},[n.search]),i=p();return[a,o((e,t)=>{i("?"+P(e),t)},[i])]}function P(e=""){return new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(e=>[r,e]):[[r,n]])},[]))}export{y as BrowserRouter,g as HashRouter,v as Link,w as NavLink,R as Prompt,P as createSearchParams,A as useLinkClickHandler,C as usePrompt,N as useSearchParams};
/**
* React Router DOM v6.0.0-beta.6
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
import{useRef as e,useState as t,useLayoutEffect as r,createElement as n,forwardRef as a,useCallback as o,useMemo as c}from"react";import{createBrowserHistory as i,createHashHistory as u,createPath as l}from"history";import{Router as s,useHref as f,useLocation as h,useResolvedPath as m,useNavigate as p,useBlocker as d}from"react-router";export{MemoryRouter,Navigate,Outlet,Route,Router,Routes,UNSAFE_LocationContext,UNSAFE_NavigationContext,UNSAFE_RouteContext,createRoutesFromChildren,generatePath,matchPath,matchRoutes,renderMatches,resolvePath,useBlocker,useHref,useInRouterContext,useLocation,useMatch,useNavigate,useOutlet,useParams,useResolvedPath,useRoutes}from"react-router";function y({basename:a,children:o,window:c}){let u=e();null==u.current&&(u.current=i({window:c}));let l=u.current,[f,h]=t({action:l.action,location:l.location});return r((()=>l.listen(h)),[l]),n(s,{basename:a,children:o,action:f.action,location:f.location,navigator:l})}function g({basename:a,children:o,window:c}){let i=e();null==i.current&&(i.current=u({window:c}));let l=i.current,[f,h]=t({action:l.action,location:l.location});return r((()=>l.listen(h)),[l]),n(s,{basename:a,children:o,action:f.action,location:f.location,navigator:l})}const v=a((function({onClick:e,replace:t=!1,state:r,target:a,to:o,...c},i){let u=f(o),l=A(o,{replace:t,state:r,target:a});return n("a",Object.assign({},c,{href:u,onClick:function(t){e&&e(t),t.defaultPrevented||l(t)},ref:i,target:a}))})),w=a((function({"aria-current":e="page",caseSensitive:t=!1,className:r="",end:a=!1,style:o,to:c,...i},u){let l=h(),s=m(c),f=l.pathname,p=s.pathname;t||(f=f.toLowerCase(),p=p.toLowerCase());let d,y=f===p||!a&&f.startsWith(p)&&"/"===f.charAt(p.length),g=y?e:void 0;d="function"==typeof r?r({isActive:y}):[r,y?"active":null].filter(Boolean).join(" ");let w="function"==typeof o?o({isActive:y}):o;return n(v,Object.assign({},i,{"aria-current":g,className:d,ref:u,style:w,to:c}))}));function R({message:e,when:t}){return C(e,t),null}function A(e,{target:t,replace:r,state:n}={}){let a=p(),c=h(),i=m(e);return o((o=>{if(!(0!==o.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(o))){o.preventDefault();let t=!!r||l(c)===l(i);a(e,{replace:t,state:n})}}),[c,a,i,r,n,t,e])}function C(e,t=!0){let r=o((t=>{window.confirm(e)&&t.retry()}),[e]);d(r,t)}function b(t){let r=e(N(t)),n=h(),a=c((()=>{let e=N(n.search);for(let t of r.current.keys())e.has(t)||r.current.getAll(t).forEach((r=>{e.append(t,r)}));return e}),[n.search]),i=p();return[a,o(((e,t)=>{i("?"+N(e),t)}),[i])]}function N(e=""){return new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map((e=>[r,e])):[[r,n]])}),[]))}export{y as BrowserRouter,g as HashRouter,v as Link,w as NavLink,R as Prompt,N as createSearchParams,A as useLinkClickHandler,C as usePrompt,b as useSearchParams};
//# sourceMappingURL=react-router-dom.production.min.js.map

@@ -13,3 +13,2 @@ 'use strict';

*/
function StaticRouter({

@@ -16,0 +15,0 @@ basename,

@@ -0,1 +1,11 @@

/**
* React Router DOM v6.0.0-beta.6
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
(function (global, factory) {

@@ -58,6 +68,8 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('history'), require('react-router')) :

} ////////////////////////////////////////////////////////////////////////////////
// COMPONENTS
////////////////////////////////////////////////////////////////////////////////
/**
* A <Router> for use in web browsers. Provides the cleanest URLs.
*/
function BrowserRouter(_ref) {

@@ -91,2 +103,3 @@ let {

}
/**

@@ -96,3 +109,2 @@ * A <Router> for use in web browsers. Stores the location in the hash

*/
function HashRouter(_ref2) {

@@ -130,7 +142,6 @@ let {

}
/**
* The public API for rendering a history-aware <a>.
*/
const Link = /*#__PURE__*/React.forwardRef(function LinkWithRef(_ref3, ref) {

@@ -176,7 +187,6 @@ let {

}
/**
* A <Link> wrapper that knows if it's "active" or not.
*/
const NavLink = /*#__PURE__*/React.forwardRef(function NavLinkWithRef(_ref4, ref) {

@@ -203,3 +213,3 @@ let {

let isActive = end ? locationPathname === toPathname : locationPathname.startsWith(toPathname);
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(toPathname.length) === "/";
let ariaCurrent = isActive ? ariaCurrentProp : undefined;

@@ -236,2 +246,3 @@ let className;

}
/**

@@ -244,4 +255,2 @@ * A declarative interface for showing a window.confirm dialog with the given

*/
function Prompt(_ref5) {

@@ -332,2 +341,3 @@ let {

}
/**

@@ -354,3 +364,2 @@ * Creates a URLSearchParams object using the given initializer.

*/
function createSearchParams(init) {

@@ -357,0 +366,0 @@ if (init === void 0) {

@@ -1,2 +0,12 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("history"),require("react-router")):"function"==typeof define&&define.amd?define(["exports","react","history","react-router"],t):t((e=e||self).ReactRouterDOM={},e.React,e.HistoryLibrary,e.ReactRouter)}(this,(function(e,t,r,n){"use strict";function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function a(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}const u=["onClick","replace","state","target","to"],c=["aria-current","caseSensitive","className","end","style","to"];const i=t.forwardRef((function(e,r){let{onClick:c,replace:i=!1,state:s,target:f,to:b}=e,d=a(e,u),m=n.useHref(b),y=l(b,{replace:i,state:s,target:f});return t.createElement("a",o({},d,{href:m,onClick:function(e){c&&c(e),e.defaultPrevented||y(e)},ref:r,target:f}))})),s=t.forwardRef((function(e,r){let{"aria-current":u="page",caseSensitive:s=!1,className:l="",end:f=!1,style:b,to:d}=e,m=a(e,c),y=n.useLocation(),p=n.useResolvedPath(d),g=y.pathname,h=p.pathname;s||(g=g.toLowerCase(),h=h.toLowerCase());let P,R=f?g===h:g.startsWith(h),O=R?u:void 0;P="function"==typeof l?l({isActive:R}):[l,R?"active":null].filter(Boolean).join(" ");let v="function"==typeof b?b({isActive:R}):b;return t.createElement(i,o({},m,{"aria-current":O,className:P,ref:r,style:v,to:d}))}));function l(e,o){let{target:a,replace:u,state:c}=void 0===o?{}:o,i=n.useNavigate(),s=n.useLocation(),l=n.useResolvedPath(e);return t.useCallback(t=>{if(!(0!==t.button||a&&"_self"!==a||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(t))){t.preventDefault();let n=!!u||r.createPath(s)===r.createPath(l);i(e,{replace:n,state:c})}},[s,i,l,u,c,a,e])}function f(e,r){void 0===r&&(r=!0);let o=t.useCallback(t=>{window.confirm(e)&&t.retry()},[e]);n.useBlocker(o,r)}function b(e){return void 0===e&&(e=""),new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(e=>[r,e]):[[r,n]])},[]))}Object.defineProperty(e,"MemoryRouter",{enumerable:!0,get:function(){return n.MemoryRouter}}),Object.defineProperty(e,"Navigate",{enumerable:!0,get:function(){return n.Navigate}}),Object.defineProperty(e,"Outlet",{enumerable:!0,get:function(){return n.Outlet}}),Object.defineProperty(e,"Route",{enumerable:!0,get:function(){return n.Route}}),Object.defineProperty(e,"Router",{enumerable:!0,get:function(){return n.Router}}),Object.defineProperty(e,"Routes",{enumerable:!0,get:function(){return n.Routes}}),Object.defineProperty(e,"UNSAFE_LocationContext",{enumerable:!0,get:function(){return n.UNSAFE_LocationContext}}),Object.defineProperty(e,"UNSAFE_NavigationContext",{enumerable:!0,get:function(){return n.UNSAFE_NavigationContext}}),Object.defineProperty(e,"UNSAFE_RouteContext",{enumerable:!0,get:function(){return n.UNSAFE_RouteContext}}),Object.defineProperty(e,"createRoutesFromChildren",{enumerable:!0,get:function(){return n.createRoutesFromChildren}}),Object.defineProperty(e,"generatePath",{enumerable:!0,get:function(){return n.generatePath}}),Object.defineProperty(e,"matchPath",{enumerable:!0,get:function(){return n.matchPath}}),Object.defineProperty(e,"matchRoutes",{enumerable:!0,get:function(){return n.matchRoutes}}),Object.defineProperty(e,"renderMatches",{enumerable:!0,get:function(){return n.renderMatches}}),Object.defineProperty(e,"resolvePath",{enumerable:!0,get:function(){return n.resolvePath}}),Object.defineProperty(e,"useBlocker",{enumerable:!0,get:function(){return n.useBlocker}}),Object.defineProperty(e,"useHref",{enumerable:!0,get:function(){return n.useHref}}),Object.defineProperty(e,"useInRouterContext",{enumerable:!0,get:function(){return n.useInRouterContext}}),Object.defineProperty(e,"useLocation",{enumerable:!0,get:function(){return n.useLocation}}),Object.defineProperty(e,"useMatch",{enumerable:!0,get:function(){return n.useMatch}}),Object.defineProperty(e,"useNavigate",{enumerable:!0,get:function(){return n.useNavigate}}),Object.defineProperty(e,"useOutlet",{enumerable:!0,get:function(){return n.useOutlet}}),Object.defineProperty(e,"useParams",{enumerable:!0,get:function(){return n.useParams}}),Object.defineProperty(e,"useResolvedPath",{enumerable:!0,get:function(){return n.useResolvedPath}}),Object.defineProperty(e,"useRoutes",{enumerable:!0,get:function(){return n.useRoutes}}),e.BrowserRouter=function(e){let{basename:o,children:a,window:u}=e,c=t.useRef();null==c.current&&(c.current=r.createBrowserHistory({window:u}));let i=c.current,[s,l]=t.useState({action:i.action,location:i.location});return t.useLayoutEffect(()=>i.listen(l),[i]),t.createElement(n.Router,{basename:o,children:a,action:s.action,location:s.location,navigator:i})},e.HashRouter=function(e){let{basename:o,children:a,window:u}=e,c=t.useRef();null==c.current&&(c.current=r.createHashHistory({window:u}));let i=c.current,[s,l]=t.useState({action:i.action,location:i.location});return t.useLayoutEffect(()=>i.listen(l),[i]),t.createElement(n.Router,{basename:o,children:a,action:s.action,location:s.location,navigator:i})},e.Link=i,e.NavLink=s,e.Prompt=function(e){let{message:t,when:r}=e;return f(t,r),null},e.createSearchParams=b,e.useLinkClickHandler=l,e.usePrompt=f,e.useSearchParams=function(e){let r=t.useRef(b(e)),o=n.useLocation(),a=t.useMemo(()=>{let e=b(o.search);for(let t of r.current.keys())e.has(t)||r.current.getAll(t).forEach(r=>{e.append(t,r)});return e},[o.search]),u=n.useNavigate();return[a,t.useCallback((e,t)=>{u("?"+b(e),t)},[u])]},Object.defineProperty(e,"__esModule",{value:!0})}));
/**
* React Router DOM v6.0.0-beta.6
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("history"),require("react-router")):"function"==typeof define&&define.amd?define(["exports","react","history","react-router"],t):t((e=e||self).ReactRouterDOM={},e.React,e.HistoryLibrary,e.ReactRouter)}(this,(function(e,t,r,n){"use strict";function o(){return o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o.apply(this,arguments)}function a(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}const u=["onClick","replace","state","target","to"],c=["aria-current","caseSensitive","className","end","style","to"];const i=t.forwardRef((function(e,r){let{onClick:c,replace:i=!1,state:s,target:f,to:b}=e,d=a(e,u),m=n.useHref(b),y=l(b,{replace:i,state:s,target:f});return t.createElement("a",o({},d,{href:m,onClick:function(e){c&&c(e),e.defaultPrevented||y(e)},ref:r,target:f}))})),s=t.forwardRef((function(e,r){let{"aria-current":u="page",caseSensitive:s=!1,className:l="",end:f=!1,style:b,to:d}=e,m=a(e,c),y=n.useLocation(),p=n.useResolvedPath(d),h=y.pathname,g=p.pathname;s||(h=h.toLowerCase(),g=g.toLowerCase());let P,R=h===g||!f&&h.startsWith(g)&&"/"===h.charAt(g.length),O=R?u:void 0;P="function"==typeof l?l({isActive:R}):[l,R?"active":null].filter(Boolean).join(" ");let v="function"==typeof b?b({isActive:R}):b;return t.createElement(i,o({},m,{"aria-current":O,className:P,ref:r,style:v,to:d}))}));function l(e,o){let{target:a,replace:u,state:c}=void 0===o?{}:o,i=n.useNavigate(),s=n.useLocation(),l=n.useResolvedPath(e);return t.useCallback((t=>{if(!(0!==t.button||a&&"_self"!==a||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(t))){t.preventDefault();let n=!!u||r.createPath(s)===r.createPath(l);i(e,{replace:n,state:c})}}),[s,i,l,u,c,a,e])}function f(e,r){void 0===r&&(r=!0);let o=t.useCallback((t=>{window.confirm(e)&&t.retry()}),[e]);n.useBlocker(o,r)}function b(e){return void 0===e&&(e=""),new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map((e=>[r,e])):[[r,n]])}),[]))}Object.defineProperty(e,"MemoryRouter",{enumerable:!0,get:function(){return n.MemoryRouter}}),Object.defineProperty(e,"Navigate",{enumerable:!0,get:function(){return n.Navigate}}),Object.defineProperty(e,"Outlet",{enumerable:!0,get:function(){return n.Outlet}}),Object.defineProperty(e,"Route",{enumerable:!0,get:function(){return n.Route}}),Object.defineProperty(e,"Router",{enumerable:!0,get:function(){return n.Router}}),Object.defineProperty(e,"Routes",{enumerable:!0,get:function(){return n.Routes}}),Object.defineProperty(e,"UNSAFE_LocationContext",{enumerable:!0,get:function(){return n.UNSAFE_LocationContext}}),Object.defineProperty(e,"UNSAFE_NavigationContext",{enumerable:!0,get:function(){return n.UNSAFE_NavigationContext}}),Object.defineProperty(e,"UNSAFE_RouteContext",{enumerable:!0,get:function(){return n.UNSAFE_RouteContext}}),Object.defineProperty(e,"createRoutesFromChildren",{enumerable:!0,get:function(){return n.createRoutesFromChildren}}),Object.defineProperty(e,"generatePath",{enumerable:!0,get:function(){return n.generatePath}}),Object.defineProperty(e,"matchPath",{enumerable:!0,get:function(){return n.matchPath}}),Object.defineProperty(e,"matchRoutes",{enumerable:!0,get:function(){return n.matchRoutes}}),Object.defineProperty(e,"renderMatches",{enumerable:!0,get:function(){return n.renderMatches}}),Object.defineProperty(e,"resolvePath",{enumerable:!0,get:function(){return n.resolvePath}}),Object.defineProperty(e,"useBlocker",{enumerable:!0,get:function(){return n.useBlocker}}),Object.defineProperty(e,"useHref",{enumerable:!0,get:function(){return n.useHref}}),Object.defineProperty(e,"useInRouterContext",{enumerable:!0,get:function(){return n.useInRouterContext}}),Object.defineProperty(e,"useLocation",{enumerable:!0,get:function(){return n.useLocation}}),Object.defineProperty(e,"useMatch",{enumerable:!0,get:function(){return n.useMatch}}),Object.defineProperty(e,"useNavigate",{enumerable:!0,get:function(){return n.useNavigate}}),Object.defineProperty(e,"useOutlet",{enumerable:!0,get:function(){return n.useOutlet}}),Object.defineProperty(e,"useParams",{enumerable:!0,get:function(){return n.useParams}}),Object.defineProperty(e,"useResolvedPath",{enumerable:!0,get:function(){return n.useResolvedPath}}),Object.defineProperty(e,"useRoutes",{enumerable:!0,get:function(){return n.useRoutes}}),e.BrowserRouter=function(e){let{basename:o,children:a,window:u}=e,c=t.useRef();null==c.current&&(c.current=r.createBrowserHistory({window:u}));let i=c.current,[s,l]=t.useState({action:i.action,location:i.location});return t.useLayoutEffect((()=>i.listen(l)),[i]),t.createElement(n.Router,{basename:o,children:a,action:s.action,location:s.location,navigator:i})},e.HashRouter=function(e){let{basename:o,children:a,window:u}=e,c=t.useRef();null==c.current&&(c.current=r.createHashHistory({window:u}));let i=c.current,[s,l]=t.useState({action:i.action,location:i.location});return t.useLayoutEffect((()=>i.listen(l)),[i]),t.createElement(n.Router,{basename:o,children:a,action:s.action,location:s.location,navigator:i})},e.Link=i,e.NavLink=s,e.Prompt=function(e){let{message:t,when:r}=e;return f(t,r),null},e.createSearchParams=b,e.useLinkClickHandler=l,e.usePrompt=f,e.useSearchParams=function(e){let r=t.useRef(b(e)),o=n.useLocation(),a=t.useMemo((()=>{let e=b(o.search);for(let t of r.current.keys())e.has(t)||r.current.getAll(t).forEach((r=>{e.append(t,r)}));return e}),[o.search]),u=n.useNavigate();return[a,t.useCallback(((e,t)=>{u("?"+b(e),t)}),[u])]},Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=react-router-dom.production.min.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc