UNPKG

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