UNPKG

1.56 kBTypeScriptView Raw
1import { ReactNode } from 'react';
2import { LocationProvider, LocationContext, NavigateFn, History } from '@reach/router';
3import { StoryData } from './utils';
4interface Other extends StoryData {
5 path: string;
6}
7export declare type RenderData = Pick<LocationContext, 'location'> & Partial<Pick<LocationContext, 'navigate'>> & Other;
8interface MatchingData {
9 match: null | {
10 path: string;
11 };
12}
13interface QueryLocationProps {
14 children: (renderData: RenderData) => ReactNode;
15}
16interface QueryMatchProps {
17 path: string;
18 startsWith: boolean;
19 children: (matchingData: MatchingData) => ReactNode;
20}
21interface RouteProps {
22 path: string;
23 startsWith?: boolean;
24 hideOnly?: boolean;
25 children: ReactNode;
26}
27export interface QueryLinkProps {
28 to: string;
29 children: ReactNode;
30}
31declare const queryNavigate: NavigateFn;
32declare const QueryLink: {
33 ({ to, children, ...rest }: QueryLinkProps): JSX.Element;
34 displayName: string;
35};
36declare const QueryLocation: {
37 ({ children }: QueryLocationProps): JSX.Element;
38 displayName: string;
39};
40declare const QueryMatch: {
41 ({ children, path: targetPath, startsWith }: QueryMatchProps): JSX.Element;
42 displayName: string;
43};
44declare const Route: {
45 ({ path, children, startsWith, hideOnly }: RouteProps): JSX.Element;
46 displayName: string;
47};
48export { QueryLink as Link };
49export { QueryMatch as Match };
50export { QueryLocation as Location };
51export { Route };
52export { queryNavigate as navigate };
53export { LocationProvider };
54export type { History };