boring-router-react
Advanced tools
Comparing version 0.5.9 to 0.5.11
import { RouteBuilder, RouteMatch, RouteMatchSharedToParamDict } from 'boring-router'; | ||
import { HTMLAttributes, ReactNode } from 'react'; | ||
import React, { HTMLAttributes, ReactNode, RefObject } from 'react'; | ||
export interface LinkProps<T extends RouteMatch | RouteBuilder> extends HTMLAttributes<HTMLAnchorElement> { | ||
@@ -13,4 +13,4 @@ className?: string; | ||
} | ||
export declare const Link: (<T extends RouteMatch<import("boring-router").GeneralParamDict, import("boring-router").NextRouteMatch<import("boring-router").GeneralParamDict, string | undefined, string>, string | undefined, string, object> | RouteBuilder<string>>(props: LinkProps<T>) => JSX.Element) & { | ||
displayName: string; | ||
export declare const Link: (<T extends RouteMatch<import("boring-router").GeneralParamDict, import("boring-router").NextRouteMatch<import("boring-router").GeneralParamDict, string | undefined, string>, string | undefined, string, object> | RouteBuilder<string>>(props: LinkProps<T>, ref: RefObject<HTMLAnchorElement>) => JSX.Element) & React.NamedExoticComponent<LinkProps<RouteMatch<import("boring-router").GeneralParamDict, import("boring-router").NextRouteMatch<import("boring-router").GeneralParamDict, string | undefined, string>, string | undefined, string, object> | RouteBuilder<string>> & React.RefAttributes<HTMLAnchorElement>> & { | ||
readonly type: React.ForwardRefExoticComponent<LinkProps<RouteMatch<import("boring-router").GeneralParamDict, import("boring-router").NextRouteMatch<import("boring-router").GeneralParamDict, string | undefined, string>, string | undefined, string, object> | RouteBuilder<string>> & React.RefAttributes<HTMLAnchorElement>>; | ||
}; |
@@ -9,3 +9,3 @@ "use strict"; | ||
const _utils_1 = require("./@utils"); | ||
exports.Link = (0, mobx_react_lite_1.observer)((props) => { | ||
exports.Link = (0, mobx_react_lite_1.observer)((props, ref) => { | ||
let { to, params, replace = false, toggle = false, | ||
@@ -58,4 +58,4 @@ // Do not provide `leave` option default value, check out its references. | ||
], true); | ||
return react_1.default.createElement("a", { ...restProps, href: href, onClick: composedOnClick }); | ||
}); | ||
return react_1.default.createElement("a", { ref: ref, ...restProps, href: href, onClick: composedOnClick }); | ||
}, { forwardRef: true }); | ||
//# sourceMappingURL=link.js.map |
@@ -1,3 +0,3 @@ | ||
/// <reference types="react" /> | ||
import { RouteBuilder, RouteMatch } from 'boring-router'; | ||
import React, { RefObject } from 'react'; | ||
import { LinkProps } from './link'; | ||
@@ -8,4 +8,4 @@ export interface NavLinkProps<T extends RouteMatch | RouteBuilder> extends LinkProps<T> { | ||
} | ||
export declare const NavLink: (<T extends RouteMatch<import("boring-router").GeneralParamDict, import("boring-router").NextRouteMatch<import("boring-router").GeneralParamDict, string | undefined, string>, string | undefined, string, object> | RouteBuilder<string>>(props: NavLinkProps<T>) => JSX.Element) & { | ||
displayName: string; | ||
export declare const NavLink: (<T extends RouteMatch<import("boring-router").GeneralParamDict, import("boring-router").NextRouteMatch<import("boring-router").GeneralParamDict, string | undefined, string>, string | undefined, string, object> | RouteBuilder<string>>(props: NavLinkProps<T>, ref: RefObject<HTMLAnchorElement>) => JSX.Element) & React.NamedExoticComponent<NavLinkProps<RouteMatch<import("boring-router").GeneralParamDict, import("boring-router").NextRouteMatch<import("boring-router").GeneralParamDict, string | undefined, string>, string | undefined, string, object> | RouteBuilder<string>> & React.RefAttributes<HTMLAnchorElement>> & { | ||
readonly type: React.ForwardRefExoticComponent<NavLinkProps<RouteMatch<import("boring-router").GeneralParamDict, import("boring-router").NextRouteMatch<import("boring-router").GeneralParamDict, string | undefined, string>, string | undefined, string, object> | RouteBuilder<string>> & React.RefAttributes<HTMLAnchorElement>>; | ||
}; |
@@ -10,3 +10,3 @@ "use strict"; | ||
const link_1 = require("./link"); | ||
exports.NavLink = (0, mobx_react_lite_1.observer)((props) => { | ||
exports.NavLink = (0, mobx_react_lite_1.observer)((props, ref) => { | ||
let { to, exact = false } = props; | ||
@@ -28,4 +28,4 @@ let route = (() => { | ||
let { className, activeClassName = 'active', exact: _exact, ...restProps } = props; | ||
return (react_1.default.createElement(link_1.Link, { className: (0, classnames_1.default)(className, matched && activeClassName), ...restProps })); | ||
}); | ||
return (react_1.default.createElement(link_1.Link, { ref: ref, className: (0, classnames_1.default)(className, matched && activeClassName), ...restProps })); | ||
}, { forwardRef: true }); | ||
//# sourceMappingURL=nav-link.js.map |
{ | ||
"name": "boring-router-react", | ||
"version": "0.5.9", | ||
"version": "0.5.11", | ||
"description": "A type-safe MobX router with parallel routing support.", | ||
@@ -37,3 +37,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "6a982590f61786532ae3733f16bb7e4052e52146" | ||
"gitHead": "f88c88ef48ba20d0650d4c211aa202070ce5cd73" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
79872
1194