storybook-addon-remix-react-router
Version:
Use Remix React Router in your stories. (Formerly storybook-addon-react-router-v6)
60 lines (49 loc) • 3.16 kB
TypeScript
import { a as RouterParameters, L as LocationParameters, N as NavigationHistoryEntry, b as NonIndexRouteDefinitionObject, c as RouteDefinition, R as RouterRoute, d as RouteDefinitionObject, e as NonIndexRouteDefinition } from './types-Bcw-dfl1.js';
export { f as RoutingHelper } from './types-Bcw-dfl1.js';
import 'react-router';
import 'react';
declare const withRouter: () => any;
type ReactRouterAddonStoryParameters = (RouterParameters & {
location?: LocationParameters;
navigationHistory?: never;
}) | (RouterParameters & {
location?: never;
navigationHistory: [NavigationHistoryEntry, ...NavigationHistoryEntry[]];
});
declare function reactRouterParameters(params: ReactRouterAddonStoryParameters): ReactRouterAddonStoryParameters;
type StoryRouteDefinition = string | Omit<NonIndexRouteDefinitionObject, 'element'>;
/**
* Render the story with a single outlet
* @see withOutlets
* @see withNestedOutlets
*/
declare function reactRouterOutlet(outlet: RouteDefinition): [RouterRoute];
declare function reactRouterOutlet(story: StoryRouteDefinition, outlet: RouteDefinition): [RouterRoute];
/**
* Render the story with multiple possible outlets.
* Use this function when your story component can navigate and you want a different outlet depending on the path.
* @see withOutlet
* @see withNestedOutlets
*/
declare function reactRouterOutlets(outlets: RouteDefinitionObject[]): [RouterRoute];
declare function reactRouterOutlets(story: string | Omit<NonIndexRouteDefinitionObject, 'element'>, outlets: RouteDefinitionObject[]): [RouterRoute];
/**
* Render the story with multiple outlets nested one into the previous.
* Use this function when your story component renders an outlet that itself can have outlet and so forth.
* Outlets are nested in a visual/JSX order : the first element of the array will be the root, the last will be
* the direct parent of the story
* @see withOutlet
* @see withOutlets
*/
declare function reactRouterNestedOutlets(outlets: [...RouteDefinition[], NonIndexRouteDefinition]): [RouterRoute];
declare function reactRouterNestedOutlets(story: StoryRouteDefinition, outlets: [...RouteDefinition[], NonIndexRouteDefinition]): [RouterRoute];
/**
* Render the story as the outlet of an ancestor.
* You can specify multiple ancestors to create a deep nesting.
* Outlets are nested in a visual/JSX order : the first element of the array will be the root, the last will be
* the direct parent of the story
*/
declare function reactRouterNestedAncestors(ancestors: NonIndexRouteDefinition | NonIndexRouteDefinition[]): [RouterRoute];
declare function reactRouterNestedAncestors(story: Omit<RouteDefinitionObject, 'element'>, ancestors: NonIndexRouteDefinition | NonIndexRouteDefinition[]): [RouterRoute];
declare function castRouterRoute(definition: RouteDefinition): RouterRoute;
export { NonIndexRouteDefinition, NonIndexRouteDefinitionObject, type ReactRouterAddonStoryParameters, RouteDefinition, RouteDefinitionObject, RouterRoute, castRouterRoute, reactRouterNestedAncestors, reactRouterNestedOutlets, reactRouterOutlet, reactRouterOutlets, reactRouterParameters, withRouter };