react-router-dom 5.2.0 → 6.11.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.
Files changed (70) hide show
  1. package/CHANGELOG.md +345 -0
  2. package/{LICENSE → LICENSE.md} +3 -1
  3. package/README.md +4 -36
  4. package/dist/dom.d.ts +76 -0
  5. package/dist/index.d.ts +246 -0
  6. package/dist/index.js +1058 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/main.js +19 -0
  9. package/dist/react-router-dom.development.js +1005 -0
  10. package/dist/react-router-dom.development.js.map +1 -0
  11. package/dist/react-router-dom.production.min.js +12 -0
  12. package/dist/react-router-dom.production.min.js.map +1 -0
  13. package/dist/server.d.ts +28 -0
  14. package/dist/server.js +319 -0
  15. package/dist/server.mjs +291 -0
  16. package/dist/umd/react-router-dom.development.js +1306 -0
  17. package/dist/umd/react-router-dom.development.js.map +1 -0
  18. package/dist/umd/react-router-dom.production.min.js +12 -0
  19. package/dist/umd/react-router-dom.production.min.js.map +1 -0
  20. package/package.json +38 -54
  21. package/server.d.ts +28 -0
  22. package/server.js +319 -0
  23. package/server.mjs +291 -0
  24. package/BrowserRouter.js +0 -3
  25. package/HashRouter.js +0 -3
  26. package/Link.js +0 -3
  27. package/MemoryRouter.js +0 -3
  28. package/NavLink.js +0 -3
  29. package/Prompt.js +0 -3
  30. package/Redirect.js +0 -3
  31. package/Route.js +0 -3
  32. package/Router.js +0 -3
  33. package/StaticRouter.js +0 -3
  34. package/Switch.js +0 -3
  35. package/cjs/react-router-dom.js +0 -443
  36. package/cjs/react-router-dom.js.map +0 -1
  37. package/cjs/react-router-dom.min.js +0 -2
  38. package/cjs/react-router-dom.min.js.map +0 -1
  39. package/es/BrowserRouter.js +0 -5
  40. package/es/HashRouter.js +0 -5
  41. package/es/Link.js +0 -5
  42. package/es/MemoryRouter.js +0 -5
  43. package/es/NavLink.js +0 -5
  44. package/es/Prompt.js +0 -5
  45. package/es/Redirect.js +0 -5
  46. package/es/Route.js +0 -5
  47. package/es/Router.js +0 -5
  48. package/es/StaticRouter.js +0 -5
  49. package/es/Switch.js +0 -5
  50. package/es/generatePath.js +0 -5
  51. package/es/matchPath.js +0 -5
  52. package/es/warnAboutDeprecatedESMImport.js +0 -34
  53. package/es/withRouter.js +0 -5
  54. package/esm/react-router-dom.js +0 -317
  55. package/esm/react-router-dom.js.map +0 -1
  56. package/generatePath.js +0 -3
  57. package/index.js +0 -7
  58. package/matchPath.js +0 -3
  59. package/modules/BrowserRouter.js +0 -36
  60. package/modules/HashRouter.js +0 -35
  61. package/modules/Link.js +0 -146
  62. package/modules/NavLink.js +0 -125
  63. package/modules/index.js +0 -21
  64. package/modules/utils/locationUtils.js +0 -10
  65. package/umd/react-router-dom.js +0 -3969
  66. package/umd/react-router-dom.js.map +0 -1
  67. package/umd/react-router-dom.min.js +0 -2
  68. package/umd/react-router-dom.min.js.map +0 -1
  69. package/warnAboutDeprecatedCJSRequire.js +0 -36
  70. package/withRouter.js +0 -3
@@ -1,317 +0,0 @@
1
- import { Router, __RouterContext, matchPath } from 'react-router';
2
- export { MemoryRouter, Prompt, Redirect, Route, Router, StaticRouter, Switch, generatePath, matchPath, useHistory, useLocation, useParams, useRouteMatch, withRouter } from 'react-router';
3
- import _inheritsLoose from '@babel/runtime/helpers/esm/inheritsLoose';
4
- import React from 'react';
5
- import { createBrowserHistory, createHashHistory, createLocation } from 'history';
6
- import PropTypes from 'prop-types';
7
- import warning from 'tiny-warning';
8
- import _extends from '@babel/runtime/helpers/esm/extends';
9
- import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/esm/objectWithoutPropertiesLoose';
10
- import invariant from 'tiny-invariant';
11
-
12
- /**
13
- * The public API for a <Router> that uses HTML5 history.
14
- */
15
-
16
- var BrowserRouter =
17
- /*#__PURE__*/
18
- function (_React$Component) {
19
- _inheritsLoose(BrowserRouter, _React$Component);
20
-
21
- function BrowserRouter() {
22
- var _this;
23
-
24
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
25
- args[_key] = arguments[_key];
26
- }
27
-
28
- _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
29
- _this.history = createBrowserHistory(_this.props);
30
- return _this;
31
- }
32
-
33
- var _proto = BrowserRouter.prototype;
34
-
35
- _proto.render = function render() {
36
- return React.createElement(Router, {
37
- history: this.history,
38
- children: this.props.children
39
- });
40
- };
41
-
42
- return BrowserRouter;
43
- }(React.Component);
44
-
45
- if (process.env.NODE_ENV !== "production") {
46
- BrowserRouter.propTypes = {
47
- basename: PropTypes.string,
48
- children: PropTypes.node,
49
- forceRefresh: PropTypes.bool,
50
- getUserConfirmation: PropTypes.func,
51
- keyLength: PropTypes.number
52
- };
53
-
54
- BrowserRouter.prototype.componentDidMount = function () {
55
- process.env.NODE_ENV !== "production" ? warning(!this.props.history, "<BrowserRouter> ignores the history prop. To use a custom history, " + "use `import { Router }` instead of `import { BrowserRouter as Router }`.") : void 0;
56
- };
57
- }
58
-
59
- /**
60
- * The public API for a <Router> that uses window.location.hash.
61
- */
62
-
63
- var HashRouter =
64
- /*#__PURE__*/
65
- function (_React$Component) {
66
- _inheritsLoose(HashRouter, _React$Component);
67
-
68
- function HashRouter() {
69
- var _this;
70
-
71
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
72
- args[_key] = arguments[_key];
73
- }
74
-
75
- _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
76
- _this.history = createHashHistory(_this.props);
77
- return _this;
78
- }
79
-
80
- var _proto = HashRouter.prototype;
81
-
82
- _proto.render = function render() {
83
- return React.createElement(Router, {
84
- history: this.history,
85
- children: this.props.children
86
- });
87
- };
88
-
89
- return HashRouter;
90
- }(React.Component);
91
-
92
- if (process.env.NODE_ENV !== "production") {
93
- HashRouter.propTypes = {
94
- basename: PropTypes.string,
95
- children: PropTypes.node,
96
- getUserConfirmation: PropTypes.func,
97
- hashType: PropTypes.oneOf(["hashbang", "noslash", "slash"])
98
- };
99
-
100
- HashRouter.prototype.componentDidMount = function () {
101
- process.env.NODE_ENV !== "production" ? warning(!this.props.history, "<HashRouter> ignores the history prop. To use a custom history, " + "use `import { Router }` instead of `import { HashRouter as Router }`.") : void 0;
102
- };
103
- }
104
-
105
- var resolveToLocation = function resolveToLocation(to, currentLocation) {
106
- return typeof to === "function" ? to(currentLocation) : to;
107
- };
108
- var normalizeToLocation = function normalizeToLocation(to, currentLocation) {
109
- return typeof to === "string" ? createLocation(to, null, null, currentLocation) : to;
110
- };
111
-
112
- var forwardRefShim = function forwardRefShim(C) {
113
- return C;
114
- };
115
-
116
- var forwardRef = React.forwardRef;
117
-
118
- if (typeof forwardRef === "undefined") {
119
- forwardRef = forwardRefShim;
120
- }
121
-
122
- function isModifiedEvent(event) {
123
- return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
124
- }
125
-
126
- var LinkAnchor = forwardRef(function (_ref, forwardedRef) {
127
- var innerRef = _ref.innerRef,
128
- navigate = _ref.navigate,
129
- _onClick = _ref.onClick,
130
- rest = _objectWithoutPropertiesLoose(_ref, ["innerRef", "navigate", "onClick"]);
131
-
132
- var target = rest.target;
133
-
134
- var props = _extends({}, rest, {
135
- onClick: function onClick(event) {
136
- try {
137
- if (_onClick) _onClick(event);
138
- } catch (ex) {
139
- event.preventDefault();
140
- throw ex;
141
- }
142
-
143
- if (!event.defaultPrevented && // onClick prevented default
144
- event.button === 0 && ( // ignore everything but left clicks
145
- !target || target === "_self") && // let browser handle "target=_blank" etc.
146
- !isModifiedEvent(event) // ignore clicks with modifier keys
147
- ) {
148
- event.preventDefault();
149
- navigate();
150
- }
151
- }
152
- }); // React 15 compat
153
-
154
-
155
- if (forwardRefShim !== forwardRef) {
156
- props.ref = forwardedRef || innerRef;
157
- } else {
158
- props.ref = innerRef;
159
- }
160
- /* eslint-disable-next-line jsx-a11y/anchor-has-content */
161
-
162
-
163
- return React.createElement("a", props);
164
- });
165
-
166
- if (process.env.NODE_ENV !== "production") {
167
- LinkAnchor.displayName = "LinkAnchor";
168
- }
169
- /**
170
- * The public API for rendering a history-aware <a>.
171
- */
172
-
173
-
174
- var Link = forwardRef(function (_ref2, forwardedRef) {
175
- var _ref2$component = _ref2.component,
176
- component = _ref2$component === void 0 ? LinkAnchor : _ref2$component,
177
- replace = _ref2.replace,
178
- to = _ref2.to,
179
- innerRef = _ref2.innerRef,
180
- rest = _objectWithoutPropertiesLoose(_ref2, ["component", "replace", "to", "innerRef"]);
181
-
182
- return React.createElement(__RouterContext.Consumer, null, function (context) {
183
- !context ? process.env.NODE_ENV !== "production" ? invariant(false, "You should not use <Link> outside a <Router>") : invariant(false) : void 0;
184
- var history = context.history;
185
- var location = normalizeToLocation(resolveToLocation(to, context.location), context.location);
186
- var href = location ? history.createHref(location) : "";
187
-
188
- var props = _extends({}, rest, {
189
- href: href,
190
- navigate: function navigate() {
191
- var location = resolveToLocation(to, context.location);
192
- var method = replace ? history.replace : history.push;
193
- method(location);
194
- }
195
- }); // React 15 compat
196
-
197
-
198
- if (forwardRefShim !== forwardRef) {
199
- props.ref = forwardedRef || innerRef;
200
- } else {
201
- props.innerRef = innerRef;
202
- }
203
-
204
- return React.createElement(component, props);
205
- });
206
- });
207
-
208
- if (process.env.NODE_ENV !== "production") {
209
- var toType = PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]);
210
- var refType = PropTypes.oneOfType([PropTypes.string, PropTypes.func, PropTypes.shape({
211
- current: PropTypes.any
212
- })]);
213
- Link.displayName = "Link";
214
- Link.propTypes = {
215
- innerRef: refType,
216
- onClick: PropTypes.func,
217
- replace: PropTypes.bool,
218
- target: PropTypes.string,
219
- to: toType.isRequired
220
- };
221
- }
222
-
223
- var forwardRefShim$1 = function forwardRefShim(C) {
224
- return C;
225
- };
226
-
227
- var forwardRef$1 = React.forwardRef;
228
-
229
- if (typeof forwardRef$1 === "undefined") {
230
- forwardRef$1 = forwardRefShim$1;
231
- }
232
-
233
- function joinClassnames() {
234
- for (var _len = arguments.length, classnames = new Array(_len), _key = 0; _key < _len; _key++) {
235
- classnames[_key] = arguments[_key];
236
- }
237
-
238
- return classnames.filter(function (i) {
239
- return i;
240
- }).join(" ");
241
- }
242
- /**
243
- * A <Link> wrapper that knows if it's "active" or not.
244
- */
245
-
246
-
247
- var NavLink = forwardRef$1(function (_ref, forwardedRef) {
248
- var _ref$ariaCurrent = _ref["aria-current"],
249
- ariaCurrent = _ref$ariaCurrent === void 0 ? "page" : _ref$ariaCurrent,
250
- _ref$activeClassName = _ref.activeClassName,
251
- activeClassName = _ref$activeClassName === void 0 ? "active" : _ref$activeClassName,
252
- activeStyle = _ref.activeStyle,
253
- classNameProp = _ref.className,
254
- exact = _ref.exact,
255
- isActiveProp = _ref.isActive,
256
- locationProp = _ref.location,
257
- sensitive = _ref.sensitive,
258
- strict = _ref.strict,
259
- styleProp = _ref.style,
260
- to = _ref.to,
261
- innerRef = _ref.innerRef,
262
- rest = _objectWithoutPropertiesLoose(_ref, ["aria-current", "activeClassName", "activeStyle", "className", "exact", "isActive", "location", "sensitive", "strict", "style", "to", "innerRef"]);
263
-
264
- return React.createElement(__RouterContext.Consumer, null, function (context) {
265
- !context ? process.env.NODE_ENV !== "production" ? invariant(false, "You should not use <NavLink> outside a <Router>") : invariant(false) : void 0;
266
- var currentLocation = locationProp || context.location;
267
- var toLocation = normalizeToLocation(resolveToLocation(to, currentLocation), currentLocation);
268
- var path = toLocation.pathname; // Regex taken from: https://github.com/pillarjs/path-to-regexp/blob/master/index.js#L202
269
-
270
- var escapedPath = path && path.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
271
- var match = escapedPath ? matchPath(currentLocation.pathname, {
272
- path: escapedPath,
273
- exact: exact,
274
- sensitive: sensitive,
275
- strict: strict
276
- }) : null;
277
- var isActive = !!(isActiveProp ? isActiveProp(match, currentLocation) : match);
278
- var className = isActive ? joinClassnames(classNameProp, activeClassName) : classNameProp;
279
- var style = isActive ? _extends({}, styleProp, {}, activeStyle) : styleProp;
280
-
281
- var props = _extends({
282
- "aria-current": isActive && ariaCurrent || null,
283
- className: className,
284
- style: style,
285
- to: toLocation
286
- }, rest); // React 15 compat
287
-
288
-
289
- if (forwardRefShim$1 !== forwardRef$1) {
290
- props.ref = forwardedRef || innerRef;
291
- } else {
292
- props.innerRef = innerRef;
293
- }
294
-
295
- return React.createElement(Link, props);
296
- });
297
- });
298
-
299
- if (process.env.NODE_ENV !== "production") {
300
- NavLink.displayName = "NavLink";
301
- var ariaCurrentType = PropTypes.oneOf(["page", "step", "location", "date", "time", "true"]);
302
- NavLink.propTypes = _extends({}, Link.propTypes, {
303
- "aria-current": ariaCurrentType,
304
- activeClassName: PropTypes.string,
305
- activeStyle: PropTypes.object,
306
- className: PropTypes.string,
307
- exact: PropTypes.bool,
308
- isActive: PropTypes.func,
309
- location: PropTypes.object,
310
- sensitive: PropTypes.bool,
311
- strict: PropTypes.bool,
312
- style: PropTypes.object
313
- });
314
- }
315
-
316
- export { BrowserRouter, HashRouter, Link, NavLink };
317
- //# sourceMappingURL=react-router-dom.js.map
@@ -1 +0,0 @@
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 {\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 method = replace ? 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 ]);\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","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;WACA,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,SAA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1B,WAAR,GAAsB,SAAtB;MAEM8C,eAAe,GAAGvF,SAAS,CAACc,KAAV,CAAgB,CACtC,MADsC,EAEtC,MAFsC,EAGtC,UAHsC,EAItC,MAJsC,EAKtC,MALsC,EAMtC,MANsC,CAAhB,CAAxB;EASAqD,OAAO,CAACrE,SAAR,gBACK4C,IAAI,CAAC5C,SADV;oBAEkByF,eAFlB;IAGElB,eAAe,EAAErE,SAAS,CAACC,MAH7B;IAIEqE,WAAW,EAAEtE,SAAS,CAACwD,MAJzB;IAKEgB,SAAS,EAAExE,SAAS,CAACC,MALvB;IAMEwE,KAAK,EAAEzE,SAAS,CAACI,IANnB;IAOEuE,QAAQ,EAAE3E,SAAS,CAACM,IAPtB;IAQE0C,QAAQ,EAAEhD,SAAS,CAACwD,MARtB;IASEqB,SAAS,EAAE7E,SAAS,CAACI,IATvB;IAUE0E,MAAM,EAAE9E,SAAS,CAACI,IAVpB;IAWE4E,KAAK,EAAEhF,SAAS,CAACwD;;;;;;"}
package/generatePath.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- require("./warnAboutDeprecatedCJSRequire")("generatePath");
3
- module.exports = require("./index.js").generatePath;
package/index.js DELETED
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- if (process.env.NODE_ENV === "production") {
4
- module.exports = require("./cjs/react-router-dom.min.js");
5
- } else {
6
- module.exports = require("./cjs/react-router-dom.js");
7
- }
package/matchPath.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- require("./warnAboutDeprecatedCJSRequire")("matchPath");
3
- module.exports = require("./index.js").matchPath;
@@ -1,36 +0,0 @@
1
- import React from "react";
2
- import { Router } from "react-router";
3
- import { createBrowserHistory as createHistory } from "history";
4
- import PropTypes from "prop-types";
5
- import warning from "tiny-warning";
6
-
7
- /**
8
- * The public API for a <Router> that uses HTML5 history.
9
- */
10
- class BrowserRouter extends React.Component {
11
- history = createHistory(this.props);
12
-
13
- render() {
14
- return <Router history={this.history} children={this.props.children} />;
15
- }
16
- }
17
-
18
- if (__DEV__) {
19
- BrowserRouter.propTypes = {
20
- basename: PropTypes.string,
21
- children: PropTypes.node,
22
- forceRefresh: PropTypes.bool,
23
- getUserConfirmation: PropTypes.func,
24
- keyLength: PropTypes.number
25
- };
26
-
27
- BrowserRouter.prototype.componentDidMount = function() {
28
- warning(
29
- !this.props.history,
30
- "<BrowserRouter> ignores the history prop. To use a custom history, " +
31
- "use `import { Router }` instead of `import { BrowserRouter as Router }`."
32
- );
33
- };
34
- }
35
-
36
- export default BrowserRouter;
@@ -1,35 +0,0 @@
1
- import React from "react";
2
- import { Router } from "react-router";
3
- import { createHashHistory as createHistory } from "history";
4
- import PropTypes from "prop-types";
5
- import warning from "tiny-warning";
6
-
7
- /**
8
- * The public API for a <Router> that uses window.location.hash.
9
- */
10
- class HashRouter extends React.Component {
11
- history = createHistory(this.props);
12
-
13
- render() {
14
- return <Router history={this.history} children={this.props.children} />;
15
- }
16
- }
17
-
18
- if (__DEV__) {
19
- HashRouter.propTypes = {
20
- basename: PropTypes.string,
21
- children: PropTypes.node,
22
- getUserConfirmation: PropTypes.func,
23
- hashType: PropTypes.oneOf(["hashbang", "noslash", "slash"])
24
- };
25
-
26
- HashRouter.prototype.componentDidMount = function() {
27
- warning(
28
- !this.props.history,
29
- "<HashRouter> ignores the history prop. To use a custom history, " +
30
- "use `import { Router }` instead of `import { HashRouter as Router }`."
31
- );
32
- };
33
- }
34
-
35
- export default HashRouter;
package/modules/Link.js DELETED
@@ -1,146 +0,0 @@
1
- import React from "react";
2
- import { __RouterContext as RouterContext } from "react-router";
3
- import PropTypes from "prop-types";
4
- import invariant from "tiny-invariant";
5
- import {
6
- resolveToLocation,
7
- normalizeToLocation
8
- } from "./utils/locationUtils.js";
9
-
10
- // React 15 compat
11
- const forwardRefShim = C => C;
12
- let { forwardRef } = React;
13
- if (typeof forwardRef === "undefined") {
14
- forwardRef = forwardRefShim;
15
- }
16
-
17
- function isModifiedEvent(event) {
18
- return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
19
- }
20
-
21
- const LinkAnchor = forwardRef(
22
- (
23
- {
24
- innerRef, // TODO: deprecate
25
- navigate,
26
- onClick,
27
- ...rest
28
- },
29
- forwardedRef
30
- ) => {
31
- const { target } = rest;
32
-
33
- let props = {
34
- ...rest,
35
- onClick: event => {
36
- try {
37
- if (onClick) onClick(event);
38
- } catch (ex) {
39
- event.preventDefault();
40
- throw ex;
41
- }
42
-
43
- if (
44
- !event.defaultPrevented && // onClick prevented default
45
- event.button === 0 && // ignore everything but left clicks
46
- (!target || target === "_self") && // let browser handle "target=_blank" etc.
47
- !isModifiedEvent(event) // ignore clicks with modifier keys
48
- ) {
49
- event.preventDefault();
50
- navigate();
51
- }
52
- }
53
- };
54
-
55
- // React 15 compat
56
- if (forwardRefShim !== forwardRef) {
57
- props.ref = forwardedRef || innerRef;
58
- } else {
59
- props.ref = innerRef;
60
- }
61
-
62
- /* eslint-disable-next-line jsx-a11y/anchor-has-content */
63
- return <a {...props} />;
64
- }
65
- );
66
-
67
- if (__DEV__) {
68
- LinkAnchor.displayName = "LinkAnchor";
69
- }
70
-
71
- /**
72
- * The public API for rendering a history-aware <a>.
73
- */
74
- const Link = forwardRef(
75
- (
76
- {
77
- component = LinkAnchor,
78
- replace,
79
- to,
80
- innerRef, // TODO: deprecate
81
- ...rest
82
- },
83
- forwardedRef
84
- ) => {
85
- return (
86
- <RouterContext.Consumer>
87
- {context => {
88
- invariant(context, "You should not use <Link> outside a <Router>");
89
-
90
- const { history } = context;
91
-
92
- const location = normalizeToLocation(
93
- resolveToLocation(to, context.location),
94
- context.location
95
- );
96
-
97
- const href = location ? history.createHref(location) : "";
98
- const props = {
99
- ...rest,
100
- href,
101
- navigate() {
102
- const location = resolveToLocation(to, context.location);
103
- const method = replace ? history.replace : history.push;
104
-
105
- method(location);
106
- }
107
- };
108
-
109
- // React 15 compat
110
- if (forwardRefShim !== forwardRef) {
111
- props.ref = forwardedRef || innerRef;
112
- } else {
113
- props.innerRef = innerRef;
114
- }
115
-
116
- return React.createElement(component, props);
117
- }}
118
- </RouterContext.Consumer>
119
- );
120
- }
121
- );
122
-
123
- if (__DEV__) {
124
- const toType = PropTypes.oneOfType([
125
- PropTypes.string,
126
- PropTypes.object,
127
- PropTypes.func
128
- ]);
129
- const refType = PropTypes.oneOfType([
130
- PropTypes.string,
131
- PropTypes.func,
132
- PropTypes.shape({ current: PropTypes.any })
133
- ]);
134
-
135
- Link.displayName = "Link";
136
-
137
- Link.propTypes = {
138
- innerRef: refType,
139
- onClick: PropTypes.func,
140
- replace: PropTypes.bool,
141
- target: PropTypes.string,
142
- to: toType.isRequired
143
- };
144
- }
145
-
146
- export default Link;