UNPKG

2.4 kBTypeScriptView Raw
1import { ReactNode } from 'react';
2import * as R from 'react-router-dom';
3
4export declare const BaseLocationProvider: typeof R.Router;
5export declare const DEEPLY_EQUAL: unique symbol;
6export declare const Link: {
7 ({ to, children, ...rest }: LinkProps): JSX.Element;
8 displayName: string;
9};
10export declare const Location: {
11 ({ children }: LocationProps): JSX.Element;
12 displayName: string;
13};
14export declare const LocationProvider: typeof R.BrowserRouter;
15export declare const Match: {
16 ({ children, path: targetPath, startsWith }: MatchProps): JSX.Element;
17 displayName: string;
18};
19export declare const Route: {
20 ({ path, children, startsWith, hideOnly }: RouteProps): JSX.Element;
21 displayName: string;
22};
23export declare const buildArgsParam: (initialArgs: Args, args: Args) => string;
24export declare const deepDiff: (value: any, update: any) => any;
25export declare const getMatch: (current: string, target: string, startsWith?: any) => Match | null;
26export declare const parsePath: (path: string | undefined) => StoryData;
27export declare const queryFromLocation: (location: Partial<Location>) => Query;
28export declare const queryFromString: (s: string) => Query;
29export declare const stringifyQuery: (query: Query) => string;
30export declare const useNavigate: () => (to: string | number, { plain, ...options }?: any) => void;
31export declare type Match = {
32 path: string;
33};
34export declare type NavigateOptions = ReturnType<typeof R.useNavigate> & {
35 plain?: boolean;
36};
37export declare type RenderData = Pick<RouterData, "location"> & Other;
38export declare type RouterData = {
39 location: Partial<Location>;
40 navigate: ReturnType<typeof useNavigate>;
41} & Other;
42export interface Args {
43 [key: string]: any;
44}
45export interface LinkProps {
46 to: string;
47 children: ReactNode;
48}
49export interface LocationProps {
50 children: (renderData: RenderData) => ReactNode;
51}
52export interface MatchProps {
53 path: string;
54 startsWith: boolean;
55 children: (matchingData: MatchingData) => ReactNode;
56}
57export interface MatchingData {
58 match: null | {
59 path: string;
60 };
61}
62export interface Other extends StoryData {
63 path: string;
64 singleStory?: boolean;
65}
66export interface Query {
67 [key: string]: any;
68}
69export interface RouteProps {
70 path: string;
71 startsWith?: boolean;
72 hideOnly?: boolean;
73 children: ReactNode;
74}
75export interface StoryData {
76 viewMode?: string;
77 storyId?: string;
78 refId?: string;
79}
80
81export {};