react-router-dom 5.1.0 → 5.2.1

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.
@@ -1,8 +1,8 @@
1
1
  import { Router, __RouterContext, matchPath } from 'react-router';
2
- export * from 'react-router';
2
+ export { MemoryRouter, Prompt, Redirect, Route, Router, StaticRouter, Switch, generatePath, matchPath, useHistory, useLocation, useParams, useRouteMatch, withRouter } from 'react-router';
3
3
  import _inheritsLoose from '@babel/runtime/helpers/esm/inheritsLoose';
4
4
  import React from 'react';
5
- import { createBrowserHistory, createHashHistory, createLocation } from 'history';
5
+ import { createBrowserHistory, createHashHistory, createLocation, createPath } from 'history';
6
6
  import PropTypes from 'prop-types';
7
7
  import warning from 'tiny-warning';
8
8
  import _extends from '@babel/runtime/helpers/esm/extends';
@@ -13,9 +13,7 @@ import invariant from 'tiny-invariant';
13
13
  * The public API for a <Router> that uses HTML5 history.
14
14
  */
15
15
 
16
- var BrowserRouter =
17
- /*#__PURE__*/
18
- function (_React$Component) {
16
+ var BrowserRouter = /*#__PURE__*/function (_React$Component) {
19
17
  _inheritsLoose(BrowserRouter, _React$Component);
20
18
 
21
19
  function BrowserRouter() {
@@ -33,7 +31,7 @@ function (_React$Component) {
33
31
  var _proto = BrowserRouter.prototype;
34
32
 
35
33
  _proto.render = function render() {
36
- return React.createElement(Router, {
34
+ return /*#__PURE__*/React.createElement(Router, {
37
35
  history: this.history,
38
36
  children: this.props.children
39
37
  });
@@ -60,9 +58,7 @@ if (process.env.NODE_ENV !== "production") {
60
58
  * The public API for a <Router> that uses window.location.hash.
61
59
  */
62
60
 
63
- var HashRouter =
64
- /*#__PURE__*/
65
- function (_React$Component) {
61
+ var HashRouter = /*#__PURE__*/function (_React$Component) {
66
62
  _inheritsLoose(HashRouter, _React$Component);
67
63
 
68
64
  function HashRouter() {
@@ -80,7 +76,7 @@ function (_React$Component) {
80
76
  var _proto = HashRouter.prototype;
81
77
 
82
78
  _proto.render = function render() {
83
- return React.createElement(Router, {
79
+ return /*#__PURE__*/React.createElement(Router, {
84
80
  history: this.history,
85
81
  children: this.props.children
86
82
  });
@@ -109,12 +105,14 @@ var normalizeToLocation = function normalizeToLocation(to, currentLocation) {
109
105
  return typeof to === "string" ? createLocation(to, null, null, currentLocation) : to;
110
106
  };
111
107
 
108
+ var forwardRefShim = function forwardRefShim(C) {
109
+ return C;
110
+ };
111
+
112
112
  var forwardRef = React.forwardRef;
113
113
 
114
114
  if (typeof forwardRef === "undefined") {
115
- forwardRef = function forwardRef(C) {
116
- return C;
117
- };
115
+ forwardRef = forwardRefShim;
118
116
  }
119
117
 
120
118
  function isModifiedEvent(event) {
@@ -128,8 +126,8 @@ var LinkAnchor = forwardRef(function (_ref, forwardedRef) {
128
126
  rest = _objectWithoutPropertiesLoose(_ref, ["innerRef", "navigate", "onClick"]);
129
127
 
130
128
  var target = rest.target;
131
- return React.createElement("a", _extends({}, rest, {
132
- ref: forwardedRef || innerRef,
129
+
130
+ var props = _extends({}, rest, {
133
131
  onClick: function onClick(event) {
134
132
  try {
135
133
  if (_onClick) _onClick(event);
@@ -147,7 +145,18 @@ var LinkAnchor = forwardRef(function (_ref, forwardedRef) {
147
145
  navigate();
148
146
  }
149
147
  }
150
- }));
148
+ }); // React 15 compat
149
+
150
+
151
+ if (forwardRefShim !== forwardRef) {
152
+ props.ref = forwardedRef || innerRef;
153
+ } else {
154
+ props.ref = innerRef;
155
+ }
156
+ /* eslint-disable-next-line jsx-a11y/anchor-has-content */
157
+
158
+
159
+ return /*#__PURE__*/React.createElement("a", props);
151
160
  });
152
161
 
153
162
  if (process.env.NODE_ENV !== "production") {
@@ -166,20 +175,30 @@ var Link = forwardRef(function (_ref2, forwardedRef) {
166
175
  innerRef = _ref2.innerRef,
167
176
  rest = _objectWithoutPropertiesLoose(_ref2, ["component", "replace", "to", "innerRef"]);
168
177
 
169
- return React.createElement(__RouterContext.Consumer, null, function (context) {
178
+ return /*#__PURE__*/React.createElement(__RouterContext.Consumer, null, function (context) {
170
179
  !context ? process.env.NODE_ENV !== "production" ? invariant(false, "You should not use <Link> outside a <Router>") : invariant(false) : void 0;
171
180
  var history = context.history;
172
181
  var location = normalizeToLocation(resolveToLocation(to, context.location), context.location);
173
182
  var href = location ? history.createHref(location) : "";
174
- return React.createElement(component, _extends({}, rest, {
175
- ref: forwardedRef || innerRef,
183
+
184
+ var props = _extends({}, rest, {
176
185
  href: href,
177
186
  navigate: function navigate() {
178
187
  var location = resolveToLocation(to, context.location);
179
- var method = replace ? history.replace : history.push;
188
+ var isDuplicateNavigation = createPath(context.location) === createPath(normalizeToLocation(location));
189
+ var method = replace || isDuplicateNavigation ? history.replace : history.push;
180
190
  method(location);
181
191
  }
182
- }));
192
+ }); // React 15 compat
193
+
194
+
195
+ if (forwardRefShim !== forwardRef) {
196
+ props.ref = forwardedRef || innerRef;
197
+ } else {
198
+ props.innerRef = innerRef;
199
+ }
200
+
201
+ return /*#__PURE__*/React.createElement(component, props);
183
202
  });
184
203
  });
185
204
 
@@ -198,12 +217,14 @@ if (process.env.NODE_ENV !== "production") {
198
217
  };
199
218
  }
200
219
 
220
+ var forwardRefShim$1 = function forwardRefShim(C) {
221
+ return C;
222
+ };
223
+
201
224
  var forwardRef$1 = React.forwardRef;
202
225
 
203
226
  if (typeof forwardRef$1 === "undefined") {
204
- forwardRef$1 = function forwardRef(C) {
205
- return C;
206
- };
227
+ forwardRef$1 = forwardRefShim$1;
207
228
  }
208
229
 
209
230
  function joinClassnames() {
@@ -230,13 +251,14 @@ var NavLink = forwardRef$1(function (_ref, forwardedRef) {
230
251
  exact = _ref.exact,
231
252
  isActiveProp = _ref.isActive,
232
253
  locationProp = _ref.location,
254
+ sensitive = _ref.sensitive,
233
255
  strict = _ref.strict,
234
256
  styleProp = _ref.style,
235
257
  to = _ref.to,
236
258
  innerRef = _ref.innerRef,
237
- rest = _objectWithoutPropertiesLoose(_ref, ["aria-current", "activeClassName", "activeStyle", "className", "exact", "isActive", "location", "strict", "style", "to", "innerRef"]);
259
+ rest = _objectWithoutPropertiesLoose(_ref, ["aria-current", "activeClassName", "activeStyle", "className", "exact", "isActive", "location", "sensitive", "strict", "style", "to", "innerRef"]);
238
260
 
239
- return React.createElement(__RouterContext.Consumer, null, function (context) {
261
+ return /*#__PURE__*/React.createElement(__RouterContext.Consumer, null, function (context) {
240
262
  !context ? process.env.NODE_ENV !== "production" ? invariant(false, "You should not use <NavLink> outside a <Router>") : invariant(false) : void 0;
241
263
  var currentLocation = locationProp || context.location;
242
264
  var toLocation = normalizeToLocation(resolveToLocation(to, currentLocation), currentLocation);
@@ -246,24 +268,34 @@ var NavLink = forwardRef$1(function (_ref, forwardedRef) {
246
268
  var match = escapedPath ? matchPath(currentLocation.pathname, {
247
269
  path: escapedPath,
248
270
  exact: exact,
271
+ sensitive: sensitive,
249
272
  strict: strict
250
273
  }) : null;
251
274
  var isActive = !!(isActiveProp ? isActiveProp(match, currentLocation) : match);
252
275
  var className = isActive ? joinClassnames(classNameProp, activeClassName) : classNameProp;
253
- var style = isActive ? _extends({}, styleProp, {}, activeStyle) : styleProp;
254
- return React.createElement(Link, _extends({
255
- ref: forwardedRef || innerRef,
276
+ var style = isActive ? _extends({}, styleProp, activeStyle) : styleProp;
277
+
278
+ var props = _extends({
256
279
  "aria-current": isActive && ariaCurrent || null,
257
280
  className: className,
258
281
  style: style,
259
282
  to: toLocation
260
- }, rest));
283
+ }, rest); // React 15 compat
284
+
285
+
286
+ if (forwardRefShim$1 !== forwardRef$1) {
287
+ props.ref = forwardedRef || innerRef;
288
+ } else {
289
+ props.innerRef = innerRef;
290
+ }
291
+
292
+ return /*#__PURE__*/React.createElement(Link, props);
261
293
  });
262
294
  });
263
295
 
264
296
  if (process.env.NODE_ENV !== "production") {
265
297
  NavLink.displayName = "NavLink";
266
- var ariaCurrentType = PropTypes.oneOf(["page", "step", "location", "date", "time", "true"]);
298
+ var ariaCurrentType = PropTypes.oneOf(["page", "step", "location", "date", "time", "true", "false"]);
267
299
  NavLink.propTypes = _extends({}, Link.propTypes, {
268
300
  "aria-current": ariaCurrentType,
269
301
  activeClassName: PropTypes.string,
@@ -272,6 +304,7 @@ if (process.env.NODE_ENV !== "production") {
272
304
  exact: PropTypes.bool,
273
305
  isActive: PropTypes.func,
274
306
  location: PropTypes.object,
307
+ sensitive: PropTypes.bool,
275
308
  strict: PropTypes.bool,
276
309
  style: PropTypes.object
277
310
  });
@@ -1 +1 @@
1
- {"version":3,"file":"react-router-dom.js","sources":["../modules/BrowserRouter.js","../modules/HashRouter.js","../modules/utils/locationUtils.js","../modules/Link.js","../modules/NavLink.js"],"sourcesContent":["import React from \"react\";\nimport { Router } from \"react-router\";\nimport { createBrowserHistory as createHistory } from \"history\";\nimport PropTypes from \"prop-types\";\nimport warning from \"tiny-warning\";\n\n/**\n * The public API for a <Router> that uses HTML5 history.\n */\nclass BrowserRouter extends React.Component {\n history = createHistory(this.props);\n\n render() {\n return <Router history={this.history} children={this.props.children} />;\n }\n}\n\nif (__DEV__) {\n BrowserRouter.propTypes = {\n basename: PropTypes.string,\n children: PropTypes.node,\n forceRefresh: PropTypes.bool,\n getUserConfirmation: PropTypes.func,\n keyLength: PropTypes.number\n };\n\n BrowserRouter.prototype.componentDidMount = function() {\n warning(\n !this.props.history,\n \"<BrowserRouter> ignores the history prop. To use a custom history, \" +\n \"use `import { Router }` instead of `import { BrowserRouter as Router }`.\"\n );\n };\n}\n\nexport default BrowserRouter;\n","import React from \"react\";\nimport { Router } from \"react-router\";\nimport { createHashHistory as createHistory } from \"history\";\nimport PropTypes from \"prop-types\";\nimport warning from \"tiny-warning\";\n\n/**\n * The public API for a <Router> that uses window.location.hash.\n */\nclass HashRouter extends React.Component {\n history = createHistory(this.props);\n\n render() {\n return <Router history={this.history} children={this.props.children} />;\n }\n}\n\nif (__DEV__) {\n HashRouter.propTypes = {\n basename: PropTypes.string,\n children: PropTypes.node,\n getUserConfirmation: PropTypes.func,\n hashType: PropTypes.oneOf([\"hashbang\", \"noslash\", \"slash\"])\n };\n\n HashRouter.prototype.componentDidMount = function() {\n warning(\n !this.props.history,\n \"<HashRouter> ignores the history prop. To use a custom history, \" +\n \"use `import { Router }` instead of `import { HashRouter as Router }`.\"\n );\n };\n}\n\nexport default HashRouter;\n","import { createLocation } from \"history\";\n\nexport const resolveToLocation = (to, currentLocation) =>\n typeof to === \"function\" ? to(currentLocation) : to;\n\nexport const normalizeToLocation = (to, currentLocation) => {\n return typeof to === \"string\"\n ? createLocation(to, null, null, currentLocation)\n : to;\n};\n","import React from \"react\";\nimport { __RouterContext as RouterContext } from \"react-router\";\nimport PropTypes from \"prop-types\";\nimport invariant from \"tiny-invariant\";\nimport { resolveToLocation, normalizeToLocation } from \"./utils/locationUtils\";\n\n// React 15 compat\nlet { forwardRef } = React;\nif (typeof forwardRef === \"undefined\") {\n forwardRef = C => C;\n}\n\nfunction isModifiedEvent(event) {\n return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);\n}\n\nconst LinkAnchor = forwardRef(\n ({ innerRef, navigate, onClick, ...rest }, forwardedRef) => {\n const { target } = rest;\n\n return (\n <a\n {...rest}\n ref={forwardedRef || innerRef}\n onClick={event => {\n try {\n if (onClick) onClick(event);\n } catch (ex) {\n event.preventDefault();\n throw ex;\n }\n\n if (\n !event.defaultPrevented && // onClick prevented default\n event.button === 0 && // ignore everything but left clicks\n (!target || target === \"_self\") && // let browser handle \"target=_blank\" etc.\n !isModifiedEvent(event) // ignore clicks with modifier keys\n ) {\n event.preventDefault();\n navigate();\n }\n }}\n />\n );\n }\n);\n\nif (__DEV__) {\n LinkAnchor.displayName = \"LinkAnchor\";\n}\n\n/**\n * The public API for rendering a history-aware <a>.\n */\nconst Link = forwardRef(\n (\n { component = LinkAnchor, replace, to, innerRef, ...rest },\n forwardedRef\n ) => {\n return (\n <RouterContext.Consumer>\n {context => {\n invariant(context, \"You should not use <Link> outside a <Router>\");\n\n const { history } = context;\n\n const location = normalizeToLocation(\n resolveToLocation(to, context.location),\n context.location\n );\n\n const href = location ? history.createHref(location) : \"\";\n\n return React.createElement(component, {\n ...rest,\n ref: forwardedRef || innerRef,\n href,\n navigate() {\n const location = resolveToLocation(to, context.location);\n const method = replace ? history.replace : history.push;\n\n method(location);\n }\n });\n }}\n </RouterContext.Consumer>\n );\n }\n);\n\nif (__DEV__) {\n const toType = PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.object,\n PropTypes.func\n ]);\n const refType = PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.func,\n PropTypes.shape({ current: PropTypes.any })\n ]);\n\n Link.displayName = \"Link\";\n\n Link.propTypes = {\n innerRef: refType,\n onClick: PropTypes.func,\n replace: PropTypes.bool,\n target: PropTypes.string,\n to: toType.isRequired\n };\n}\n\nexport default Link;\n","import React from \"react\";\nimport { __RouterContext as RouterContext, matchPath } from \"react-router\";\nimport PropTypes from \"prop-types\";\nimport invariant from \"tiny-invariant\";\nimport Link from \"./Link\";\nimport { resolveToLocation, normalizeToLocation } from \"./utils/locationUtils\";\n\n// React 15 compat\nlet { forwardRef } = React;\nif (typeof forwardRef === \"undefined\") {\n forwardRef = C => C;\n}\n\nfunction joinClassnames(...classnames) {\n return classnames.filter(i => i).join(\" \");\n}\n\n/**\n * A <Link> wrapper that knows if it's \"active\" or not.\n */\nconst NavLink = forwardRef(\n (\n {\n \"aria-current\": ariaCurrent = \"page\",\n activeClassName = \"active\",\n activeStyle,\n className: classNameProp,\n exact,\n isActive: isActiveProp,\n location: locationProp,\n strict,\n style: styleProp,\n to,\n innerRef,\n ...rest\n },\n forwardedRef\n ) => {\n return (\n <RouterContext.Consumer>\n {context => {\n invariant(context, \"You should not use <NavLink> outside a <Router>\");\n\n const currentLocation = locationProp || context.location;\n const toLocation = normalizeToLocation(\n resolveToLocation(to, currentLocation),\n currentLocation\n );\n const { pathname: path } = toLocation;\n // Regex taken from: https://github.com/pillarjs/path-to-regexp/blob/master/index.js#L202\n const escapedPath =\n path && path.replace(/([.+*?=^!:${}()[\\]|/\\\\])/g, \"\\\\$1\");\n\n const match = escapedPath\n ? matchPath(currentLocation.pathname, {\n path: escapedPath,\n exact,\n strict\n })\n : null;\n const isActive = !!(isActiveProp\n ? isActiveProp(match, currentLocation)\n : match);\n\n const className = isActive\n ? joinClassnames(classNameProp, activeClassName)\n : classNameProp;\n const style = isActive ? { ...styleProp, ...activeStyle } : styleProp;\n\n return (\n <Link\n ref={forwardedRef || innerRef}\n aria-current={(isActive && ariaCurrent) || null}\n className={className}\n style={style}\n to={toLocation}\n {...rest}\n />\n );\n }}\n </RouterContext.Consumer>\n );\n }\n);\n\nif (__DEV__) {\n NavLink.displayName = \"NavLink\";\n\n const ariaCurrentType = PropTypes.oneOf([\n \"page\",\n \"step\",\n \"location\",\n \"date\",\n \"time\",\n \"true\"\n ]);\n\n NavLink.propTypes = {\n ...Link.propTypes,\n \"aria-current\": ariaCurrentType,\n activeClassName: PropTypes.string,\n activeStyle: PropTypes.object,\n className: PropTypes.string,\n exact: PropTypes.bool,\n isActive: PropTypes.func,\n location: PropTypes.object,\n strict: PropTypes.bool,\n style: PropTypes.object\n };\n}\n\nexport default NavLink;\n"],"names":["BrowserRouter","history","createHistory","props","render","children","React","Component","propTypes","basename","PropTypes","string","node","forceRefresh","bool","getUserConfirmation","func","keyLength","number","prototype","componentDidMount","warning","HashRouter","hashType","oneOf","resolveToLocation","to","currentLocation","normalizeToLocation","createLocation","forwardRef","C","isModifiedEvent","event","metaKey","altKey","ctrlKey","shiftKey","LinkAnchor","forwardedRef","innerRef","navigate","onClick","rest","target","ex","preventDefault","defaultPrevented","button","displayName","Link","component","replace","RouterContext","context","invariant","location","href","createHref","createElement","ref","method","push","toType","oneOfType","object","refType","shape","current","any","isRequired","joinClassnames","classnames","filter","i","join","NavLink","ariaCurrent","activeClassName","activeStyle","classNameProp","className","exact","isActiveProp","isActive","locationProp","strict","styleProp","style","toLocation","path","pathname","escapedPath","match","matchPath","ariaCurrentType"],"mappings":";;;;;;;;;;;AAMA;;;;IAGMA;;;;;;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K0C,IAAI,CAAC1C,SADV;oBAEkBuF,eAFlB;IAGEjB,eAAe,EAAEpE,SAAS,CAACC,MAH7B;IAIEoE,WAAW,EAAErE,SAAS,CAACuD,MAJzB;IAKEgB,SAAS,EAAEvE,SAAS,CAACC,MALvB;IAMEuE,KAAK,EAAExE,SAAS,CAACI,IANnB;IAOEsE,QAAQ,EAAE1E,SAAS,CAACM,IAPtB;IAQEwC,QAAQ,EAAE9C,SAAS,CAACuD,MARtB;IASEqB,MAAM,EAAE5E,SAAS,CAACI,IATpB;IAUE0E,KAAK,EAAE9E,SAAS,CAACuD;;;;;;"}
1
+ {"version":3,"file":"react-router-dom.js","sources":["../modules/BrowserRouter.js","../modules/HashRouter.js","../modules/utils/locationUtils.js","../modules/Link.js","../modules/NavLink.js"],"sourcesContent":["import React from \"react\";\nimport { Router } from \"react-router\";\nimport { createBrowserHistory as createHistory } from \"history\";\nimport PropTypes from \"prop-types\";\nimport warning from \"tiny-warning\";\n\n/**\n * The public API for a <Router> that uses HTML5 history.\n */\nclass BrowserRouter extends React.Component {\n history = createHistory(this.props);\n\n render() {\n return <Router history={this.history} children={this.props.children} />;\n }\n}\n\nif (__DEV__) {\n BrowserRouter.propTypes = {\n basename: PropTypes.string,\n children: PropTypes.node,\n forceRefresh: PropTypes.bool,\n getUserConfirmation: PropTypes.func,\n keyLength: PropTypes.number\n };\n\n BrowserRouter.prototype.componentDidMount = function() {\n warning(\n !this.props.history,\n \"<BrowserRouter> ignores the history prop. To use a custom history, \" +\n \"use `import { Router }` instead of `import { BrowserRouter as Router }`.\"\n );\n };\n}\n\nexport default BrowserRouter;\n","import React from \"react\";\nimport { Router } from \"react-router\";\nimport { createHashHistory as createHistory } from \"history\";\nimport PropTypes from \"prop-types\";\nimport warning from \"tiny-warning\";\n\n/**\n * The public API for a <Router> that uses window.location.hash.\n */\nclass HashRouter extends React.Component {\n history = createHistory(this.props);\n\n render() {\n return <Router history={this.history} children={this.props.children} />;\n }\n}\n\nif (__DEV__) {\n HashRouter.propTypes = {\n basename: PropTypes.string,\n children: PropTypes.node,\n getUserConfirmation: PropTypes.func,\n hashType: PropTypes.oneOf([\"hashbang\", \"noslash\", \"slash\"])\n };\n\n HashRouter.prototype.componentDidMount = function() {\n warning(\n !this.props.history,\n \"<HashRouter> ignores the history prop. To use a custom history, \" +\n \"use `import { Router }` instead of `import { HashRouter as Router }`.\"\n );\n };\n}\n\nexport default HashRouter;\n","import { createLocation } from \"history\";\n\nexport const resolveToLocation = (to, currentLocation) =>\n typeof to === \"function\" ? to(currentLocation) : to;\n\nexport const normalizeToLocation = (to, currentLocation) => {\n return typeof to === \"string\"\n ? createLocation(to, null, null, currentLocation)\n : to;\n};\n","import React from \"react\";\nimport { __RouterContext as RouterContext } from \"react-router\";\nimport { createPath } from 'history';\nimport PropTypes from \"prop-types\";\nimport invariant from \"tiny-invariant\";\nimport {\n resolveToLocation,\n normalizeToLocation\n} from \"./utils/locationUtils.js\";\n\n// React 15 compat\nconst forwardRefShim = C => C;\nlet { forwardRef } = React;\nif (typeof forwardRef === \"undefined\") {\n forwardRef = forwardRefShim;\n}\n\nfunction isModifiedEvent(event) {\n return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);\n}\n\nconst LinkAnchor = forwardRef(\n (\n {\n innerRef, // TODO: deprecate\n navigate,\n onClick,\n ...rest\n },\n forwardedRef\n ) => {\n const { target } = rest;\n\n let props = {\n ...rest,\n onClick: event => {\n try {\n if (onClick) onClick(event);\n } catch (ex) {\n event.preventDefault();\n throw ex;\n }\n\n if (\n !event.defaultPrevented && // onClick prevented default\n event.button === 0 && // ignore everything but left clicks\n (!target || target === \"_self\") && // let browser handle \"target=_blank\" etc.\n !isModifiedEvent(event) // ignore clicks with modifier keys\n ) {\n event.preventDefault();\n navigate();\n }\n }\n };\n\n // React 15 compat\n if (forwardRefShim !== forwardRef) {\n props.ref = forwardedRef || innerRef;\n } else {\n props.ref = innerRef;\n }\n\n /* eslint-disable-next-line jsx-a11y/anchor-has-content */\n return <a {...props} />;\n }\n);\n\nif (__DEV__) {\n LinkAnchor.displayName = \"LinkAnchor\";\n}\n\n/**\n * The public API for rendering a history-aware <a>.\n */\nconst Link = forwardRef(\n (\n {\n component = LinkAnchor,\n replace,\n to,\n innerRef, // TODO: deprecate\n ...rest\n },\n forwardedRef\n ) => {\n return (\n <RouterContext.Consumer>\n {context => {\n invariant(context, \"You should not use <Link> outside a <Router>\");\n\n const { history } = context;\n\n const location = normalizeToLocation(\n resolveToLocation(to, context.location),\n context.location\n );\n\n const href = location ? history.createHref(location) : \"\";\n const props = {\n ...rest,\n href,\n navigate() {\n const location = resolveToLocation(to, context.location);\n const isDuplicateNavigation = createPath(context.location) === createPath(normalizeToLocation(location));\n const method = (replace || isDuplicateNavigation) ? history.replace : history.push;\n\n method(location);\n }\n };\n\n // React 15 compat\n if (forwardRefShim !== forwardRef) {\n props.ref = forwardedRef || innerRef;\n } else {\n props.innerRef = innerRef;\n }\n\n return React.createElement(component, props);\n }}\n </RouterContext.Consumer>\n );\n }\n);\n\nif (__DEV__) {\n const toType = PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.object,\n PropTypes.func\n ]);\n const refType = PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.func,\n PropTypes.shape({ current: PropTypes.any })\n ]);\n\n Link.displayName = \"Link\";\n\n Link.propTypes = {\n innerRef: refType,\n onClick: PropTypes.func,\n replace: PropTypes.bool,\n target: PropTypes.string,\n to: toType.isRequired\n };\n}\n\nexport default Link;\n","import React from \"react\";\nimport { __RouterContext as RouterContext, matchPath } from \"react-router\";\nimport PropTypes from \"prop-types\";\nimport invariant from \"tiny-invariant\";\nimport Link from \"./Link.js\";\nimport {\n resolveToLocation,\n normalizeToLocation\n} from \"./utils/locationUtils.js\";\n\n// React 15 compat\nconst forwardRefShim = C => C;\nlet { forwardRef } = React;\nif (typeof forwardRef === \"undefined\") {\n forwardRef = forwardRefShim;\n}\n\nfunction joinClassnames(...classnames) {\n return classnames.filter(i => i).join(\" \");\n}\n\n/**\n * A <Link> wrapper that knows if it's \"active\" or not.\n */\nconst NavLink = forwardRef(\n (\n {\n \"aria-current\": ariaCurrent = \"page\",\n activeClassName = \"active\",\n activeStyle,\n className: classNameProp,\n exact,\n isActive: isActiveProp,\n location: locationProp,\n sensitive,\n strict,\n style: styleProp,\n to,\n innerRef, // TODO: deprecate\n ...rest\n },\n forwardedRef\n ) => {\n return (\n <RouterContext.Consumer>\n {context => {\n invariant(context, \"You should not use <NavLink> outside a <Router>\");\n\n const currentLocation = locationProp || context.location;\n const toLocation = normalizeToLocation(\n resolveToLocation(to, currentLocation),\n currentLocation\n );\n const { pathname: path } = toLocation;\n // Regex taken from: https://github.com/pillarjs/path-to-regexp/blob/master/index.js#L202\n const escapedPath =\n path && path.replace(/([.+*?=^!:${}()[\\]|/\\\\])/g, \"\\\\$1\");\n\n const match = escapedPath\n ? matchPath(currentLocation.pathname, {\n path: escapedPath,\n exact,\n sensitive,\n strict\n })\n : null;\n const isActive = !!(isActiveProp\n ? isActiveProp(match, currentLocation)\n : match);\n\n const className = isActive\n ? joinClassnames(classNameProp, activeClassName)\n : classNameProp;\n const style = isActive ? { ...styleProp, ...activeStyle } : styleProp;\n\n const props = {\n \"aria-current\": (isActive && ariaCurrent) || null,\n className,\n style,\n to: toLocation,\n ...rest\n };\n\n // React 15 compat\n if (forwardRefShim !== forwardRef) {\n props.ref = forwardedRef || innerRef;\n } else {\n props.innerRef = innerRef;\n }\n\n return <Link {...props} />;\n }}\n </RouterContext.Consumer>\n );\n }\n);\n\nif (__DEV__) {\n NavLink.displayName = \"NavLink\";\n\n const ariaCurrentType = PropTypes.oneOf([\n \"page\",\n \"step\",\n \"location\",\n \"date\",\n \"time\",\n \"true\",\n \"false\"\n ]);\n\n NavLink.propTypes = {\n ...Link.propTypes,\n \"aria-current\": ariaCurrentType,\n activeClassName: PropTypes.string,\n activeStyle: PropTypes.object,\n className: PropTypes.string,\n exact: PropTypes.bool,\n isActive: PropTypes.func,\n location: PropTypes.object,\n sensitive: PropTypes.bool,\n strict: PropTypes.bool,\n style: PropTypes.object\n };\n}\n\nexport default NavLink;\n"],"names":["BrowserRouter","history","createHistory","props","render","children","React","Component","propTypes","basename","PropTypes","string","node","forceRefresh","bool","getUserConfirmation","func","keyLength","number","prototype","componentDidMount","warning","HashRouter","hashType","oneOf","resolveToLocation","to","currentLocation","normalizeToLocation","createLocation","forwardRefShim","C","forwardRef","isModifiedEvent","event","metaKey","altKey","ctrlKey","shiftKey","LinkAnchor","forwardedRef","innerRef","navigate","onClick","rest","target","ex","preventDefault","defaultPrevented","button","ref","displayName","Link","component","replace","RouterContext","context","invariant","location","href","createHref","isDuplicateNavigation","createPath","method","push","createElement","toType","oneOfType","object","refType","shape","current","any","isRequired","joinClassnames","classnames","filter","i","join","NavLink","ariaCurrent","activeClassName","activeStyle","classNameProp","className","exact","isActiveProp","isActive","locationProp","sensitive","strict","styleProp","style","toLocation","path","pathname","escapedPath","match","matchPath","ariaCurrentType"],"mappings":";;;;;;;;;;;AAMA;;;;IAGMA;;;;;;;;;;;UACJC,UAAUC,oBAAa,CAAC,MAAKC,KAAN;;;;;;SAEvBC,SAAA,kBAAS;wBACA,oBAAC,MAAD;MAAQ,OAAO,EAAE,KAAKH,OAAtB;MAA+B,QAAQ,EAAE,KAAKE,KAAL,CAAWE;MAA3D;;;;EAJwBC,KAAK,CAACC;;AAQlC,2CAAa;EACXP,aAAa,CAACQ,SAAd,GAA0B;IACxBC,QAAQ,EAAEC,SAAS,CAACC,MADI;IAExBN,QAAQ,EAAEK,SAAS,CAACE,IAFI;IAGxBC,YAAY,EAAEH,SAAS,CAACI,IAHA;IAIxBC,mBAAmB,EAAEL,SAAS,CAACM,IAJP;IAKxBC,SAAS,EAAEP,SAAS,CAACQ;GALvB;;EAQAlB,aAAa,CAACmB,SAAd,CAAwBC,iBAAxB,GAA4C,YAAW;4CACrDC,OAAO,CACL,CAAC,KAAKlB,KAAL,CAAWF,OADP,EAEL,wEACE,0EAHG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F,SAAS,CAACc,KAAV,CAAgB,CACtC,MADsC,EAEtC,MAFsC,EAGtC,UAHsC,EAItC,MAJsC,EAKtC,MALsC,EAMtC,MANsC,EAOtC,OAPsC,CAAhB,CAAxB;EAUAuD,OAAO,CAACvE,SAAR,gBACK4C,IAAI,CAAC5C,SADV;oBAEkB2F,eAFlB;IAGElB,eAAe,EAAEvE,SAAS,CAACC,MAH7B;IAIEuE,WAAW,EAAExE,SAAS,CAAC0D,MAJzB;IAKEgB,SAAS,EAAE1E,SAAS,CAACC,MALvB;IAME0E,KAAK,EAAE3E,SAAS,CAACI,IANnB;IAOEyE,QAAQ,EAAE7E,SAAS,CAACM,IAPtB;IAQE0C,QAAQ,EAAEhD,SAAS,CAAC0D,MARtB;IASEqB,SAAS,EAAE/E,SAAS,CAACI,IATvB;IAUE4E,MAAM,EAAEhF,SAAS,CAACI,IAVpB;IAWE8E,KAAK,EAAElF,SAAS,CAAC0D;;;;;;"}
package/modules/Link.js CHANGED
@@ -1,13 +1,18 @@
1
1
  import React from "react";
2
2
  import { __RouterContext as RouterContext } from "react-router";
3
+ import { createPath } from 'history';
3
4
  import PropTypes from "prop-types";
4
5
  import invariant from "tiny-invariant";
5
- import { resolveToLocation, normalizeToLocation } from "./utils/locationUtils";
6
+ import {
7
+ resolveToLocation,
8
+ normalizeToLocation
9
+ } from "./utils/locationUtils.js";
6
10
 
7
11
  // React 15 compat
12
+ const forwardRefShim = C => C;
8
13
  let { forwardRef } = React;
9
14
  if (typeof forwardRef === "undefined") {
10
- forwardRef = C => C;
15
+ forwardRef = forwardRefShim;
11
16
  }
12
17
 
13
18
  function isModifiedEvent(event) {
@@ -15,33 +20,48 @@ function isModifiedEvent(event) {
15
20
  }
16
21
 
17
22
  const LinkAnchor = forwardRef(
18
- ({ innerRef, navigate, onClick, ...rest }, forwardedRef) => {
23
+ (
24
+ {
25
+ innerRef, // TODO: deprecate
26
+ navigate,
27
+ onClick,
28
+ ...rest
29
+ },
30
+ forwardedRef
31
+ ) => {
19
32
  const { target } = rest;
20
33
 
21
- return (
22
- <a
23
- {...rest}
24
- ref={forwardedRef || innerRef}
25
- onClick={event => {
26
- try {
27
- if (onClick) onClick(event);
28
- } catch (ex) {
29
- event.preventDefault();
30
- throw ex;
31
- }
32
-
33
- if (
34
- !event.defaultPrevented && // onClick prevented default
35
- event.button === 0 && // ignore everything but left clicks
36
- (!target || target === "_self") && // let browser handle "target=_blank" etc.
37
- !isModifiedEvent(event) // ignore clicks with modifier keys
38
- ) {
39
- event.preventDefault();
40
- navigate();
41
- }
42
- }}
43
- />
44
- );
34
+ let props = {
35
+ ...rest,
36
+ onClick: event => {
37
+ try {
38
+ if (onClick) onClick(event);
39
+ } catch (ex) {
40
+ event.preventDefault();
41
+ throw ex;
42
+ }
43
+
44
+ if (
45
+ !event.defaultPrevented && // onClick prevented default
46
+ event.button === 0 && // ignore everything but left clicks
47
+ (!target || target === "_self") && // let browser handle "target=_blank" etc.
48
+ !isModifiedEvent(event) // ignore clicks with modifier keys
49
+ ) {
50
+ event.preventDefault();
51
+ navigate();
52
+ }
53
+ }
54
+ };
55
+
56
+ // React 15 compat
57
+ if (forwardRefShim !== forwardRef) {
58
+ props.ref = forwardedRef || innerRef;
59
+ } else {
60
+ props.ref = innerRef;
61
+ }
62
+
63
+ /* eslint-disable-next-line jsx-a11y/anchor-has-content */
64
+ return <a {...props} />;
45
65
  }
46
66
  );
47
67
 
@@ -54,7 +74,13 @@ if (__DEV__) {
54
74
  */
55
75
  const Link = forwardRef(
56
76
  (
57
- { component = LinkAnchor, replace, to, innerRef, ...rest },
77
+ {
78
+ component = LinkAnchor,
79
+ replace,
80
+ to,
81
+ innerRef, // TODO: deprecate
82
+ ...rest
83
+ },
58
84
  forwardedRef
59
85
  ) => {
60
86
  return (
@@ -70,18 +96,26 @@ const Link = forwardRef(
70
96
  );
71
97
 
72
98
  const href = location ? history.createHref(location) : "";
73
-
74
- return React.createElement(component, {
99
+ const props = {
75
100
  ...rest,
76
- ref: forwardedRef || innerRef,
77
101
  href,
78
102
  navigate() {
79
103
  const location = resolveToLocation(to, context.location);
80
- const method = replace ? history.replace : history.push;
104
+ const isDuplicateNavigation = createPath(context.location) === createPath(normalizeToLocation(location));
105
+ const method = (replace || isDuplicateNavigation) ? history.replace : history.push;
81
106
 
82
107
  method(location);
83
108
  }
84
- });
109
+ };
110
+
111
+ // React 15 compat
112
+ if (forwardRefShim !== forwardRef) {
113
+ props.ref = forwardedRef || innerRef;
114
+ } else {
115
+ props.innerRef = innerRef;
116
+ }
117
+
118
+ return React.createElement(component, props);
85
119
  }}
86
120
  </RouterContext.Consumer>
87
121
  );
@@ -2,13 +2,17 @@ import React from "react";
2
2
  import { __RouterContext as RouterContext, matchPath } from "react-router";
3
3
  import PropTypes from "prop-types";
4
4
  import invariant from "tiny-invariant";
5
- import Link from "./Link";
6
- import { resolveToLocation, normalizeToLocation } from "./utils/locationUtils";
5
+ import Link from "./Link.js";
6
+ import {
7
+ resolveToLocation,
8
+ normalizeToLocation
9
+ } from "./utils/locationUtils.js";
7
10
 
8
11
  // React 15 compat
12
+ const forwardRefShim = C => C;
9
13
  let { forwardRef } = React;
10
14
  if (typeof forwardRef === "undefined") {
11
- forwardRef = C => C;
15
+ forwardRef = forwardRefShim;
12
16
  }
13
17
 
14
18
  function joinClassnames(...classnames) {
@@ -28,10 +32,11 @@ const NavLink = forwardRef(
28
32
  exact,
29
33
  isActive: isActiveProp,
30
34
  location: locationProp,
35
+ sensitive,
31
36
  strict,
32
37
  style: styleProp,
33
38
  to,
34
- innerRef,
39
+ innerRef, // TODO: deprecate
35
40
  ...rest
36
41
  },
37
42
  forwardedRef
@@ -55,6 +60,7 @@ const NavLink = forwardRef(
55
60
  ? matchPath(currentLocation.pathname, {
56
61
  path: escapedPath,
57
62
  exact,
63
+ sensitive,
58
64
  strict
59
65
  })
60
66
  : null;
@@ -67,16 +73,22 @@ const NavLink = forwardRef(
67
73
  : classNameProp;
68
74
  const style = isActive ? { ...styleProp, ...activeStyle } : styleProp;
69
75
 
70
- return (
71
- <Link
72
- ref={forwardedRef || innerRef}
73
- aria-current={(isActive && ariaCurrent) || null}
74
- className={className}
75
- style={style}
76
- to={toLocation}
77
- {...rest}
78
- />
79
- );
76
+ const props = {
77
+ "aria-current": (isActive && ariaCurrent) || null,
78
+ className,
79
+ style,
80
+ to: toLocation,
81
+ ...rest
82
+ };
83
+
84
+ // React 15 compat
85
+ if (forwardRefShim !== forwardRef) {
86
+ props.ref = forwardedRef || innerRef;
87
+ } else {
88
+ props.innerRef = innerRef;
89
+ }
90
+
91
+ return <Link {...props} />;
80
92
  }}
81
93
  </RouterContext.Consumer>
82
94
  );
@@ -92,7 +104,8 @@ if (__DEV__) {
92
104
  "location",
93
105
  "date",
94
106
  "time",
95
- "true"
107
+ "true",
108
+ "false"
96
109
  ]);
97
110
 
98
111
  NavLink.propTypes = {
@@ -104,6 +117,7 @@ if (__DEV__) {
104
117
  exact: PropTypes.bool,
105
118
  isActive: PropTypes.func,
106
119
  location: PropTypes.object,
120
+ sensitive: PropTypes.bool,
107
121
  strict: PropTypes.bool,
108
122
  style: PropTypes.object
109
123
  };
package/modules/index.js CHANGED
@@ -1,6 +1,21 @@
1
- export * from "react-router";
1
+ export {
2
+ MemoryRouter,
3
+ Prompt,
4
+ Redirect,
5
+ Route,
6
+ Router,
7
+ StaticRouter,
8
+ Switch,
9
+ generatePath,
10
+ matchPath,
11
+ withRouter,
12
+ useHistory,
13
+ useLocation,
14
+ useParams,
15
+ useRouteMatch
16
+ } from "react-router";
2
17
 
3
- export { default as BrowserRouter } from "./BrowserRouter";
4
- export { default as HashRouter } from "./HashRouter";
5
- export { default as Link } from "./Link";
6
- export { default as NavLink } from "./NavLink";
18
+ export { default as BrowserRouter } from "./BrowserRouter.js";
19
+ export { default as HashRouter } from "./HashRouter.js";
20
+ export { default as Link } from "./Link.js";
21
+ export { default as NavLink } from "./NavLink.js";
package/package.json CHANGED
@@ -1,13 +1,10 @@
1
1
  {
2
2
  "name": "react-router-dom",
3
- "version": "5.1.0",
3
+ "version": "5.2.1",
4
4
  "description": "DOM bindings for React Router",
5
5
  "repository": "ReactTraining/react-router",
6
6
  "license": "MIT",
7
- "authors": [
8
- "Michael Jackson",
9
- "Ryan Florence"
10
- ],
7
+ "author": "React Training <hello@reacttraining.com>",
11
8
  "files": [
12
9
  "BrowserRouter.js",
13
10
  "HashRouter.js",
@@ -37,19 +34,17 @@
37
34
  "sideEffects": false,
38
35
  "scripts": {
39
36
  "build": "rollup -c",
40
- "lint": "eslint modules",
41
- "prepublishOnly": "yarn build",
42
- "test": "jest"
37
+ "lint": "eslint modules"
43
38
  },
44
39
  "peerDependencies": {
45
40
  "react": ">=15"
46
41
  },
47
42
  "dependencies": {
48
- "@babel/runtime": "^7.1.2",
43
+ "@babel/runtime": "^7.12.13",
49
44
  "history": "^4.9.0",
50
45
  "loose-envify": "^1.3.1",
51
46
  "prop-types": "^15.6.2",
52
- "react-router": "5.1.0",
47
+ "react-router": "5.2.1",
53
48
  "tiny-invariant": "^1.0.2",
54
49
  "tiny-warning": "^1.0.0"
55
50
  },
@@ -65,6 +60,5 @@
65
60
  "routing",
66
61
  "history",
67
62
  "link"
68
- ],
69
- "gitHead": "0c058adc5b56c6d9b409af5e4d8330c645fac00c"
63
+ ]
70
64
  }