1 | import { ReactNode } from 'react';
|
2 | import { BrowserRouter, useNavigate, NavigateOptions, Router } from 'react-router-dom';
|
3 | import { StoryData } from './utils';
|
4 | interface Other extends StoryData {
|
5 | path: string;
|
6 | singleStory?: boolean;
|
7 | }
|
8 | export declare type RouterData = {
|
9 | location: Partial<Location>;
|
10 | navigate: ReturnType<typeof useQueryNavigate>;
|
11 | } & Other;
|
12 | export declare type RenderData = Pick<RouterData, 'location'> & Other;
|
13 | interface MatchingData {
|
14 | match: null | {
|
15 | path: string;
|
16 | };
|
17 | }
|
18 | interface QueryLocationProps {
|
19 | children: (renderData: RenderData) => ReactNode;
|
20 | }
|
21 | interface QueryMatchProps {
|
22 | path: string;
|
23 | startsWith: boolean;
|
24 | children: (matchingData: MatchingData) => ReactNode;
|
25 | }
|
26 | interface RouteProps {
|
27 | path: string;
|
28 | startsWith?: boolean;
|
29 | hideOnly?: boolean;
|
30 | children: ReactNode;
|
31 | }
|
32 | export interface QueryLinkProps {
|
33 | to: string;
|
34 | children: ReactNode;
|
35 | }
|
36 | declare type ExpandedNavigateOptions = NavigateOptions & {
|
37 | plain?: boolean;
|
38 | };
|
39 | declare const useQueryNavigate: () => (to: string | number, options?: ExpandedNavigateOptions) => void;
|
40 | declare const QueryLink: {
|
41 | ({ to, children, ...rest }: QueryLinkProps): JSX.Element;
|
42 | displayName: string;
|
43 | };
|
44 | declare const QueryLocation: {
|
45 | ({ children }: QueryLocationProps): JSX.Element;
|
46 | displayName: string;
|
47 | };
|
48 | declare const QueryMatch: {
|
49 | ({ children, path: targetPath, startsWith }: QueryMatchProps): JSX.Element;
|
50 | displayName: string;
|
51 | };
|
52 | declare const Route: {
|
53 | ({ path, children, startsWith, hideOnly }: RouteProps): JSX.Element;
|
54 | displayName: string;
|
55 | };
|
56 | export { QueryLink as Link };
|
57 | export { QueryMatch as Match };
|
58 | export { QueryLocation as Location };
|
59 | export { Route };
|
60 | export { useQueryNavigate as useNavigate };
|
61 | export { BrowserRouter as LocationProvider };
|
62 | export { Router as BaseLocationProvider };
|
63 | export { useNavigate as usePlainNavigate };
|
64 | export type { ExpandedNavigateOptions as NavigateOptions };
|