react-router-dom 5.2.1 → 5.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +3 -3
- package/cjs/react-router-dom.js +9 -4
- package/cjs/react-router-dom.js.map +1 -1
- package/cjs/react-router-dom.min.js +1 -1
- package/cjs/react-router-dom.min.js.map +1 -1
- package/esm/react-router-dom.js +9 -4
- package/esm/react-router-dom.js.map +1 -1
- package/modules/NavLink.js +16 -8
- package/package.json +11 -4
- package/umd/react-router-dom.js +28 -11
- package/umd/react-router-dom.js.map +1 -1
- package/umd/react-router-dom.min.js +1 -1
- package/umd/react-router-dom.min.js.map +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) React Training 2015-2019
|
|
4
|
+
Copyright (c) Remix Software 2020-2022
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# react-router-dom
|
|
2
2
|
|
|
3
|
-
DOM bindings for [React Router](https://
|
|
3
|
+
DOM bindings for [React Router](https://reactrouter.com).
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -30,8 +30,8 @@ You can find the library on `window.ReactRouterDOM`.
|
|
|
30
30
|
|
|
31
31
|
## Issues
|
|
32
32
|
|
|
33
|
-
If you find a bug, please file an issue on [our issue tracker on GitHub](https://github.com/
|
|
33
|
+
If you find a bug, please file an issue on [our issue tracker on GitHub](https://github.com/remix-run/react-router/issues).
|
|
34
34
|
|
|
35
35
|
## Credits
|
|
36
36
|
|
|
37
|
-
React Router is built and maintained by [
|
|
37
|
+
React Router is built and maintained by [Remix Software](https://remix.run).
|
package/cjs/react-router-dom.js
CHANGED
|
@@ -321,8 +321,13 @@ var NavLink = forwardRef$1(function (_ref, forwardedRef) {
|
|
|
321
321
|
strict: strict
|
|
322
322
|
}) : null;
|
|
323
323
|
var isActive = !!(isActiveProp ? isActiveProp(match, currentLocation) : match);
|
|
324
|
-
var className =
|
|
325
|
-
var style =
|
|
324
|
+
var className = typeof classNameProp === "function" ? classNameProp(isActive) : classNameProp;
|
|
325
|
+
var style = typeof styleProp === "function" ? styleProp(isActive) : styleProp;
|
|
326
|
+
|
|
327
|
+
if (isActive) {
|
|
328
|
+
className = joinClassnames(className, activeClassName);
|
|
329
|
+
style = _extends({}, style, activeStyle);
|
|
330
|
+
}
|
|
326
331
|
|
|
327
332
|
var props = _extends({
|
|
328
333
|
"aria-current": isActive && ariaCurrent || null,
|
|
@@ -349,13 +354,13 @@ var NavLink = forwardRef$1(function (_ref, forwardedRef) {
|
|
|
349
354
|
"aria-current": ariaCurrentType,
|
|
350
355
|
activeClassName: PropTypes.string,
|
|
351
356
|
activeStyle: PropTypes.object,
|
|
352
|
-
className: PropTypes.string,
|
|
357
|
+
className: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
353
358
|
exact: PropTypes.bool,
|
|
354
359
|
isActive: PropTypes.func,
|
|
355
360
|
location: PropTypes.object,
|
|
356
361
|
sensitive: PropTypes.bool,
|
|
357
362
|
strict: PropTypes.bool,
|
|
358
|
-
style: PropTypes.object
|
|
363
|
+
style: PropTypes.oneOfType([PropTypes.object, PropTypes.func])
|
|
359
364
|
});
|
|
360
365
|
}
|
|
361
366
|
|
|
@@ -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 { 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","Router","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,4BAAa,CAAC,MAAKC,KAAN;;;;;;SAEvBC,SAAA,kBAAS;wBACA,oBAACC,kBAAD;MAAQ,OAAO,EAAE,KAAKJ,OAAtB;MAA+B,QAAQ,EAAE,KAAKE,KAAL,CAAWG;MAA3D;;;;EAJwBC,KAAK,CAACC;;AAQlC,AAAa;EACXR,aAAa,CAACS,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;;EAQAnB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nBsB,CAA1B;;AAyEA,AAAa;EACX6E,OAAO,CAAC5B,WAAR,GAAsB,SAAtB;MAEMgD,eAAe,GAAGzF,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
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\", // TODO: deprecate\n activeStyle, // TODO: deprecate\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 let className =\n typeof classNameProp === \"function\"\n ? classNameProp(isActive)\n : classNameProp;\n\n let style =\n typeof styleProp === \"function\" ? styleProp(isActive) : styleProp;\n\n if (isActive) {\n className = joinClassnames(className, activeClassName);\n style = { ...style, ...activeStyle };\n }\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.oneOfType([PropTypes.string, PropTypes.func]),\n exact: PropTypes.bool,\n isActive: PropTypes.func,\n location: PropTypes.object,\n sensitive: PropTypes.bool,\n strict: PropTypes.bool,\n style: PropTypes.oneOfType([PropTypes.object, PropTypes.func])\n };\n}\n\nexport default NavLink;\n"],"names":["BrowserRouter","history","createHistory","props","render","Router","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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PtB;IAQE0C,QAAQ,EAAEhD,SAAS,CAAC0D,MARtB;IASEqB,SAAS,EAAE/E,SAAS,CAACI,IATvB;IAUE4E,MAAM,EAAEhF,SAAS,CAACI,IAVpB;IAWE8E,KAAK,EAAElF,SAAS,CAACyD,SAAV,CAAoB,CAACzD,SAAS,CAAC0D,MAAX,EAAmB1D,SAAS,CAACM,IAA7B,CAApB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var reactRouter=require("react-router"),React=_interopDefault(require("react")),history=require("history");require("prop-types"),require("tiny-warning");var invariant=_interopDefault(require("tiny-invariant"));function _extends(){return(_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}function _inheritsLoose(e,t){e.prototype=Object.create(t.prototype),_setPrototypeOf(e.prototype.constructor=e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||(n[r]=e[r]);return n}var BrowserRouter=function(n){function e(){for(var e,t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return(e=n.call.apply(n,[this].concat(r))||this).history=history.createBrowserHistory(e.props),e}return _inheritsLoose(e,n),e.prototype.render=function(){return React.createElement(reactRouter.Router,{history:this.history,children:this.props.children})},e}(React.Component),HashRouter=function(n){function e(){for(var e,t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return(e=n.call.apply(n,[this].concat(r))||this).history=history.createHashHistory(e.props),e}return _inheritsLoose(e,n),e.prototype.render=function(){return React.createElement(reactRouter.Router,{history:this.history,children:this.props.children})},e}(React.Component),resolveToLocation=function(e,t){return"function"==typeof e?e(t):e},normalizeToLocation=function(e,t){return"string"==typeof e?history.createLocation(e,null,null,t):e},forwardRefShim=function(e){return e},forwardRef=React.forwardRef;function isModifiedEvent(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}void 0===forwardRef&&(forwardRef=forwardRefShim);var LinkAnchor=forwardRef(function(e,t){var r=e.innerRef,o=e.navigate,n=e.onClick,a=_objectWithoutPropertiesLoose(e,["innerRef","navigate","onClick"]),i=a.target,c=_extends({},a,{onClick:function(t){try{n&&n(t)}catch(e){throw t.preventDefault(),e}t.defaultPrevented||0!==t.button||i&&"_self"!==i||isModifiedEvent(t)||(t.preventDefault(),o())}});return c.ref=forwardRefShim!==forwardRef&&t||r,React.createElement("a",c)}),Link=forwardRef(function(e,a){var t=e.component,i=void 0===t?LinkAnchor:t,c=e.replace,u=e.to,
|
|
1
|
+
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var reactRouter=require("react-router"),React=_interopDefault(require("react")),history=require("history");require("prop-types"),require("tiny-warning");var invariant=_interopDefault(require("tiny-invariant"));function _extends(){return(_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}function _inheritsLoose(e,t){e.prototype=Object.create(t.prototype),_setPrototypeOf(e.prototype.constructor=e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],0<=t.indexOf(r)||(n[r]=e[r]);return n}var BrowserRouter=function(n){function e(){for(var e,t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return(e=n.call.apply(n,[this].concat(r))||this).history=history.createBrowserHistory(e.props),e}return _inheritsLoose(e,n),e.prototype.render=function(){return React.createElement(reactRouter.Router,{history:this.history,children:this.props.children})},e}(React.Component),HashRouter=function(n){function e(){for(var e,t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return(e=n.call.apply(n,[this].concat(r))||this).history=history.createHashHistory(e.props),e}return _inheritsLoose(e,n),e.prototype.render=function(){return React.createElement(reactRouter.Router,{history:this.history,children:this.props.children})},e}(React.Component),resolveToLocation=function(e,t){return"function"==typeof e?e(t):e},normalizeToLocation=function(e,t){return"string"==typeof e?history.createLocation(e,null,null,t):e},forwardRefShim=function(e){return e},forwardRef=React.forwardRef;function isModifiedEvent(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}void 0===forwardRef&&(forwardRef=forwardRefShim);var LinkAnchor=forwardRef(function(e,t){var r=e.innerRef,o=e.navigate,n=e.onClick,a=_objectWithoutPropertiesLoose(e,["innerRef","navigate","onClick"]),i=a.target,c=_extends({},a,{onClick:function(t){try{n&&n(t)}catch(e){throw t.preventDefault(),e}t.defaultPrevented||0!==t.button||i&&"_self"!==i||isModifiedEvent(t)||(t.preventDefault(),o())}});return c.ref=forwardRefShim!==forwardRef&&t||r,React.createElement("a",c)}),Link=forwardRef(function(e,a){var t=e.component,i=void 0===t?LinkAnchor:t,c=e.replace,u=e.to,f=e.innerRef,s=_objectWithoutPropertiesLoose(e,["component","replace","to","innerRef"]);return React.createElement(reactRouter.__RouterContext.Consumer,null,function(r){r||invariant(!1);var o=r.history,e=normalizeToLocation(resolveToLocation(u,r.location),r.location),t=e?o.createHref(e):"",n=_extends({},s,{href:t,navigate:function(){var e=resolveToLocation(u,r.location),t=history.createPath(r.location)===history.createPath(normalizeToLocation(e));(c||t?o.replace:o.push)(e)}});return forwardRefShim!==forwardRef?n.ref=a||f:n.innerRef=f,React.createElement(i,n)})}),forwardRefShim$1=function(e){return e},forwardRef$1=React.forwardRef;function joinClassnames(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter(function(e){return e}).join(" ")}void 0===forwardRef$1&&(forwardRef$1=forwardRefShim$1);var NavLink=forwardRef$1(function(e,s){var t=e["aria-current"],l=void 0===t?"page":t,r=e.activeClassName,p=void 0===r?"active":r,R=e.activeStyle,h=e.className,y=e.exact,d=e.isActive,m=e.location,v=e.sensitive,b=e.strict,P=e.style,w=e.to,x=e.innerRef,g=_objectWithoutPropertiesLoose(e,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return React.createElement(reactRouter.__RouterContext.Consumer,null,function(e){e||invariant(!1);var t=m||e.location,r=normalizeToLocation(resolveToLocation(w,t),t),o=r.pathname,n=o&&o.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),a=n?reactRouter.matchPath(t.pathname,{path:n,exact:y,sensitive:v,strict:b}):null,i=!!(d?d(a,t):a),c="function"==typeof h?h(i):h,u="function"==typeof P?P(i):P;i&&(c=joinClassnames(c,p),u=_extends({},u,R));var f=_extends({"aria-current":i&&l||null,className:c,style:u,to:r},g);return forwardRefShim$1!==forwardRef$1?f.ref=s||x:f.innerRef=x,React.createElement(Link,f)})});Object.defineProperty(exports,"MemoryRouter",{enumerable:!0,get:function(){return reactRouter.MemoryRouter}}),Object.defineProperty(exports,"Prompt",{enumerable:!0,get:function(){return reactRouter.Prompt}}),Object.defineProperty(exports,"Redirect",{enumerable:!0,get:function(){return reactRouter.Redirect}}),Object.defineProperty(exports,"Route",{enumerable:!0,get:function(){return reactRouter.Route}}),Object.defineProperty(exports,"Router",{enumerable:!0,get:function(){return reactRouter.Router}}),Object.defineProperty(exports,"StaticRouter",{enumerable:!0,get:function(){return reactRouter.StaticRouter}}),Object.defineProperty(exports,"Switch",{enumerable:!0,get:function(){return reactRouter.Switch}}),Object.defineProperty(exports,"generatePath",{enumerable:!0,get:function(){return reactRouter.generatePath}}),Object.defineProperty(exports,"matchPath",{enumerable:!0,get:function(){return reactRouter.matchPath}}),Object.defineProperty(exports,"useHistory",{enumerable:!0,get:function(){return reactRouter.useHistory}}),Object.defineProperty(exports,"useLocation",{enumerable:!0,get:function(){return reactRouter.useLocation}}),Object.defineProperty(exports,"useParams",{enumerable:!0,get:function(){return reactRouter.useParams}}),Object.defineProperty(exports,"useRouteMatch",{enumerable:!0,get:function(){return reactRouter.useRouteMatch}}),Object.defineProperty(exports,"withRouter",{enumerable:!0,get:function(){return reactRouter.withRouter}}),exports.BrowserRouter=BrowserRouter,exports.HashRouter=HashRouter,exports.Link=Link,exports.NavLink=NavLink;
|
|
2
2
|
//# sourceMappingURL=react-router-dom.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-router-dom.min.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","_this","props","render","React","Router","this","children","Component","HashRouter","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","Link","component","replace","RouterContext","Consumer","context","invariant","location","href","createHref","isDuplicateNavigation","createPath","push","createElement","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"],"mappings":"s9BASMA,kKACJC,QAAUC,6BAAcC,EAAKC,gDAE7BC,OAAA,kBACSC,oBAACC,oBAAON,QAASO,KAAKP,QAASQ,SAAUD,KAAKJ,MAAMK,eAJnCH,MAAMI,WCA5BC,+JACJV,QAAUC,0BAAcC,EAAKC,gDAE7BC,OAAA,kBACSC,oBAACC,oBAAON,QAASO,KAAKP,QAASQ,SAAUD,KAAKJ,MAAMK,eAJtCH,MAAMI,WCPlBE,kBAAoB,SAACC,EAAIC,SACtB,mBAAPD,EAAoBA,EAAGC,GAAmBD,GAEtCE,oBAAsB,SAACF,EAAIC,SACjB,iBAAPD,EACVG,uBAAeH,EAAI,KAAM,KAAMC,GAC/BD,GCGAI,eAAiB,SAAAC,UAAKA,GACtBC,WAAeb,MAAfa,WAKN,SAASC,gBAAgBC,YACbA,EAAMC,SAAWD,EAAME,QAAUF,EAAMG,SAAWH,EAAMI,eAL1C,IAAfN,aACTA,WAAaF,g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C,IAAAA,MACUC,IAAVC,SACUC,IAAVrB,SACAsB,IAAAA,UACAC,IAAAA,OACOC,IAAPC,MACAzD,IAAAA,GACAe,IAAAA,SACGG,kLAKHzB,oBAACmC,4BAAcC,cACZ,SAAAC,GACWA,GAAVC,kBAEM9B,EAAkBoD,GAAgBvB,EAAQE,SAC1C0B,EAAaxD,oBACjBH,kBAAkBC,EAAIC,GACtBA,GAEgB0D,EAASD,EAAnBE,SAEFC,EACJF,GAAQA,EAAKhC,QAAQ,4BAA6B,QAE9CmC,EAAQD,EACVE,sBAAU9D,EAAgB2D,SAAU,CAClCD,KAAME,EACNX,MAAAA,EACAI,UAAAA,EACAC,OAAAA,IAEF,KACEH,KAAcD,EAChBA,EAAaW,EAAO7D,GACpB6D,GAEEb,EAAYG,EACdb,eAAeS,EAAeF,GAC9BE,EACES,EAAQL,cAAgBI,EAAcT,GAAgBS,EAEtDjE,2BACa6D,GAAYP,GAAgB,KAC7CI,UAAAA,EACAQ,MAAAA,EACAzD,GAAI0D,GACDxC,UAIDd,mBAAmBE,aACrBf,EAAMiC,IAAMV,GAAgBC,EAE5BxB,EAAMwB,SAAWA,EAGZtB,oBAACgC,KAASlC"}
|
|
1
|
+
{"version":3,"file":"react-router-dom.min.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\", // TODO: deprecate\n activeStyle, // TODO: deprecate\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 let className =\n typeof classNameProp === \"function\"\n ? classNameProp(isActive)\n : classNameProp;\n\n let style =\n typeof styleProp === \"function\" ? styleProp(isActive) : styleProp;\n\n if (isActive) {\n className = joinClassnames(className, activeClassName);\n style = { ...style, ...activeStyle };\n }\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.oneOfType([PropTypes.string, PropTypes.func]),\n exact: PropTypes.bool,\n isActive: PropTypes.func,\n location: PropTypes.object,\n sensitive: PropTypes.bool,\n strict: PropTypes.bool,\n style: PropTypes.oneOfType([PropTypes.object, PropTypes.func])\n };\n}\n\nexport default NavLink;\n"],"names":["BrowserRouter","history","createHistory","_this","props","render","React","Router","this","children","Component","HashRouter","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","Link","component","replace","RouterContext","Consumer","context","invariant","location","href","createHref","isDuplicateNavigation","createPath","push","createElement","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"],"mappings":"s9BASMA,kKACJC,QAAUC,6BAAcC,EAAKC,gDAE7BC,OAAA,kBACSC,oBAACC,oBAAON,QAASO,KAAKP,QAASQ,SAAUD,KAAKJ,MAAMK,eAJnCH,MAAMI,WCA5BC,+JACJV,QAAUC,0BAAcC,EAAKC,gDAE7BC,OAAA,kBACSC,oBAACC,oBAAON,QAASO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$1(function (_ref, forwardedRef) {
|
|
|
272
272
|
strict: strict
|
|
273
273
|
}) : null;
|
|
274
274
|
var isActive = !!(isActiveProp ? isActiveProp(match, currentLocation) : match);
|
|
275
|
-
var className =
|
|
276
|
-
var style =
|
|
275
|
+
var className = typeof classNameProp === "function" ? classNameProp(isActive) : classNameProp;
|
|
276
|
+
var style = typeof styleProp === "function" ? styleProp(isActive) : styleProp;
|
|
277
|
+
|
|
278
|
+
if (isActive) {
|
|
279
|
+
className = joinClassnames(className, activeClassName);
|
|
280
|
+
style = _extends({}, style, activeStyle);
|
|
281
|
+
}
|
|
277
282
|
|
|
278
283
|
var props = _extends({
|
|
279
284
|
"aria-current": isActive && ariaCurrent || null,
|
|
@@ -300,13 +305,13 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
300
305
|
"aria-current": ariaCurrentType,
|
|
301
306
|
activeClassName: PropTypes.string,
|
|
302
307
|
activeStyle: PropTypes.object,
|
|
303
|
-
className: PropTypes.string,
|
|
308
|
+
className: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
304
309
|
exact: PropTypes.bool,
|
|
305
310
|
isActive: PropTypes.func,
|
|
306
311
|
location: PropTypes.object,
|
|
307
312
|
sensitive: PropTypes.bool,
|
|
308
313
|
strict: PropTypes.bool,
|
|
309
|
-
style: PropTypes.object
|
|
314
|
+
style: PropTypes.oneOfType([PropTypes.object, PropTypes.func])
|
|
310
315
|
});
|
|
311
316
|
}
|
|
312
317
|
|
|
@@ -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 { 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,UAA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BF,eAAhB,CADQ,GAEtBE,aAFJ;QAGMS,KAAK,GAAGL,QAAQ,gBAAQI,SAAR,EAAsBT,WAAtB,IAAsCS,SAA5D;;QAEMxF,KAAK;sBACQoF,QAAQ,IAAIP,WAAb,IAA6B,IADpC;MAETI,SAAS,EAATA,SAFS;MAGTQ,KAAK,EAALA,KAHS;MAITlE,EAAE,EAAEmE;OACDjD,IALM,CAAX,CA9BU;;;QAuCNd,gBAAc,KAAKE,YAAvB,EAAmC;MACjC7B,KAAK,CAAC+C,GAAN,GAAYV,YAAY,IAAIC,QAA5B;KADF,MAEO;MACLtC,KAAK,CAACsC,QAAN,GAAiBA,QAAjB;;;wBAGK,oBAAC,IAAD,EAAUtC,KAAV,CAAP;GA9CJ,CADF;CAnBsB,CAA1B;;AAyEA,2CAAa;EACX4E,OAAO,CAAC5B,WAAR,GAAsB,SAAtB;MAEMgD,eAAe,GAAGzF,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;;;;;;"}
|
|
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\", // TODO: deprecate\n activeStyle, // TODO: deprecate\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 let className =\n typeof classNameProp === \"function\"\n ? classNameProp(isActive)\n : classNameProp;\n\n let style =\n typeof styleProp === \"function\" ? styleProp(isActive) : styleProp;\n\n if (isActive) {\n className = joinClassnames(className, activeClassName);\n style = { ...style, ...activeStyle };\n }\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.oneOfType([PropTypes.string, PropTypes.func]),\n exact: PropTypes.bool,\n isActive: PropTypes.func,\n location: PropTypes.object,\n sensitive: PropTypes.bool,\n strict: PropTypes.bool,\n style: PropTypes.oneOfType([PropTypes.object, PropTypes.func])\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,CAAP;GADF;;;ACpBF;;;;IAGMqB;;;;;;;;;;;UACJrB,UAAUC,iBAAa,CAAC,MAAKC,KAAN;;;;;;SAEvBC,SAAA,kBAAS;wBACA,oBAAC,MAAD;MAAQ,OAAO,EAAE,KAAKH,OAAtB;MAA+B,QAAQ,EAAE,KAAKE,KAAL,CAAWE;MAA3D;;;;EAJqBC,KAAK,CAACC;;AAQ/B,2CAAa;EACXe,UAAU,CAACd,SAAX,GAAuB;IACrBC,QAAQ,EAAE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ACvE,SAAR,gBACK4C,IAAI,CAAC5C,SADV;oBAEkB2F,eAFlB;IAGElB,eAAe,EAAEvE,SAAS,CAACC,MAH7B;IAIEuE,WAAW,EAAExE,SAAS,CAAC0D,MAJzB;IAKEgB,SAAS,EAAE1E,SAAS,CAACyD,SAAV,CAAoB,CAACzD,SAAS,CAACC,MAAX,EAAmBD,SAAS,CAACM,IAA7B,CAApB,CALb;IAMEqE,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,CAACyD,SAAV,CAAoB,CAACzD,SAAS,CAAC0D,MAAX,EAAmB1D,SAAS,CAACM,IAA7B,CAApB;;;;;;"}
|
package/modules/NavLink.js
CHANGED
|
@@ -26,8 +26,8 @@ const NavLink = forwardRef(
|
|
|
26
26
|
(
|
|
27
27
|
{
|
|
28
28
|
"aria-current": ariaCurrent = "page",
|
|
29
|
-
activeClassName = "active",
|
|
30
|
-
activeStyle,
|
|
29
|
+
activeClassName = "active", // TODO: deprecate
|
|
30
|
+
activeStyle, // TODO: deprecate
|
|
31
31
|
className: classNameProp,
|
|
32
32
|
exact,
|
|
33
33
|
isActive: isActiveProp,
|
|
@@ -68,10 +68,18 @@ const NavLink = forwardRef(
|
|
|
68
68
|
? isActiveProp(match, currentLocation)
|
|
69
69
|
: match);
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
let className =
|
|
72
|
+
typeof classNameProp === "function"
|
|
73
|
+
? classNameProp(isActive)
|
|
74
|
+
: classNameProp;
|
|
75
|
+
|
|
76
|
+
let style =
|
|
77
|
+
typeof styleProp === "function" ? styleProp(isActive) : styleProp;
|
|
78
|
+
|
|
79
|
+
if (isActive) {
|
|
80
|
+
className = joinClassnames(className, activeClassName);
|
|
81
|
+
style = { ...style, ...activeStyle };
|
|
82
|
+
}
|
|
75
83
|
|
|
76
84
|
const props = {
|
|
77
85
|
"aria-current": (isActive && ariaCurrent) || null,
|
|
@@ -113,13 +121,13 @@ if (__DEV__) {
|
|
|
113
121
|
"aria-current": ariaCurrentType,
|
|
114
122
|
activeClassName: PropTypes.string,
|
|
115
123
|
activeStyle: PropTypes.object,
|
|
116
|
-
className: PropTypes.string,
|
|
124
|
+
className: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
|
117
125
|
exact: PropTypes.bool,
|
|
118
126
|
isActive: PropTypes.func,
|
|
119
127
|
location: PropTypes.object,
|
|
120
128
|
sensitive: PropTypes.bool,
|
|
121
129
|
strict: PropTypes.bool,
|
|
122
|
-
style: PropTypes.object
|
|
130
|
+
style: PropTypes.oneOfType([PropTypes.object, PropTypes.func])
|
|
123
131
|
};
|
|
124
132
|
}
|
|
125
133
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-router-dom",
|
|
3
|
-
"version": "5.2
|
|
3
|
+
"version": "5.3.2",
|
|
4
4
|
"description": "DOM bindings for React Router",
|
|
5
|
-
"
|
|
5
|
+
"homepage": "https://reactrouter.com/",
|
|
6
|
+
"repository": {
|
|
7
|
+
"url": "https://github.com/remix-run/react-router.git",
|
|
8
|
+
"type": "git",
|
|
9
|
+
"directory": "packages/react-router-dom"
|
|
10
|
+
},
|
|
6
11
|
"license": "MIT",
|
|
7
|
-
"author": "
|
|
12
|
+
"author": "Remix Software <hello@remix.run>",
|
|
8
13
|
"files": [
|
|
14
|
+
"LICENSE",
|
|
15
|
+
"README.md",
|
|
9
16
|
"BrowserRouter.js",
|
|
10
17
|
"HashRouter.js",
|
|
11
18
|
"Link.js",
|
|
@@ -44,7 +51,7 @@
|
|
|
44
51
|
"history": "^4.9.0",
|
|
45
52
|
"loose-envify": "^1.3.1",
|
|
46
53
|
"prop-types": "^15.6.2",
|
|
47
|
-
"react-router": "5.2
|
|
54
|
+
"react-router": "5.3.2",
|
|
48
55
|
"tiny-invariant": "^1.0.2",
|
|
49
56
|
"tiny-warning": "^1.0.0"
|
|
50
57
|
},
|
package/umd/react-router-dom.js
CHANGED
|
@@ -2930,13 +2930,7 @@
|
|
|
2930
2930
|
|
|
2931
2931
|
if (!props.staticContext) {
|
|
2932
2932
|
_this.unlisten = props.history.listen(function (location) {
|
|
2933
|
-
|
|
2934
|
-
_this.setState({
|
|
2935
|
-
location: location
|
|
2936
|
-
});
|
|
2937
|
-
} else {
|
|
2938
|
-
_this._pendingLocation = location;
|
|
2939
|
-
}
|
|
2933
|
+
_this._pendingLocation = location;
|
|
2940
2934
|
});
|
|
2941
2935
|
}
|
|
2942
2936
|
|
|
@@ -2946,8 +2940,26 @@
|
|
|
2946
2940
|
var _proto = Router.prototype;
|
|
2947
2941
|
|
|
2948
2942
|
_proto.componentDidMount = function componentDidMount() {
|
|
2943
|
+
var _this2 = this;
|
|
2944
|
+
|
|
2949
2945
|
this._isMounted = true;
|
|
2950
2946
|
|
|
2947
|
+
if (this.unlisten) {
|
|
2948
|
+
// Any pre-mount location changes have been captured at
|
|
2949
|
+
// this point, so unregister the listener.
|
|
2950
|
+
this.unlisten();
|
|
2951
|
+
}
|
|
2952
|
+
|
|
2953
|
+
if (!this.props.staticContext) {
|
|
2954
|
+
this.unlisten = this.props.history.listen(function (location) {
|
|
2955
|
+
if (_this2._isMounted) {
|
|
2956
|
+
_this2.setState({
|
|
2957
|
+
location: location
|
|
2958
|
+
});
|
|
2959
|
+
}
|
|
2960
|
+
});
|
|
2961
|
+
}
|
|
2962
|
+
|
|
2951
2963
|
if (this._pendingLocation) {
|
|
2952
2964
|
this.setState({
|
|
2953
2965
|
location: this._pendingLocation
|
|
@@ -3887,8 +3899,13 @@
|
|
|
3887
3899
|
strict: strict
|
|
3888
3900
|
}) : null;
|
|
3889
3901
|
var isActive = !!(isActiveProp ? isActiveProp(match, currentLocation) : match);
|
|
3890
|
-
var className =
|
|
3891
|
-
var style =
|
|
3902
|
+
var className = typeof classNameProp === "function" ? classNameProp(isActive) : classNameProp;
|
|
3903
|
+
var style = typeof styleProp === "function" ? styleProp(isActive) : styleProp;
|
|
3904
|
+
|
|
3905
|
+
if (isActive) {
|
|
3906
|
+
className = joinClassnames(className, activeClassName);
|
|
3907
|
+
style = _extends({}, style, activeStyle);
|
|
3908
|
+
}
|
|
3892
3909
|
|
|
3893
3910
|
var props = _extends({
|
|
3894
3911
|
"aria-current": isActive && ariaCurrent || null,
|
|
@@ -3915,13 +3932,13 @@
|
|
|
3915
3932
|
"aria-current": ariaCurrentType,
|
|
3916
3933
|
activeClassName: propTypes.string,
|
|
3917
3934
|
activeStyle: propTypes.object,
|
|
3918
|
-
className: propTypes.string,
|
|
3935
|
+
className: propTypes.oneOfType([propTypes.string, propTypes.func]),
|
|
3919
3936
|
exact: propTypes.bool,
|
|
3920
3937
|
isActive: propTypes.func,
|
|
3921
3938
|
location: propTypes.object,
|
|
3922
3939
|
sensitive: propTypes.bool,
|
|
3923
3940
|
strict: propTypes.bool,
|
|
3924
|
-
style: propTypes.object
|
|
3941
|
+
style: propTypes.oneOfType([propTypes.object, propTypes.func])
|
|
3925
3942
|
});
|
|
3926
3943
|
}
|
|
3927
3944
|
|