UNPKG

1.63 kBTypeScriptView Raw
1import { ComponentProps, JSXElementConstructor } from 'react';
2import type { StoryFn, StoryObj, Story, Meta } from './types-6-0';
3export * from './types-6-0';
4/**
5 * For the common case where a component's stories are simple components that receives args as props:
6 *
7 * ```tsx
8 * export default { ... } as ComponentMeta<typeof Button>;
9 * ```
10 */
11export declare type ComponentMeta<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = Meta<ComponentProps<T>>;
12/**
13 * For the common case where a (CSFv2) story is a simple component that receives args as props:
14 *
15 * ```tsx
16 * const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />
17 * ```
18 */
19export declare type ComponentStoryFn<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = StoryFn<ComponentProps<T>>;
20/**
21 * For the common case where a (CSFv3) story is a simple component that receives args as props:
22 *
23 * ```tsx
24 * const MyStory: ComponentStory<typeof Button> = {
25 * args: { buttonArg1: 'val' },
26 * }
27 * ```
28 */
29export declare type ComponentStoryObj<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = StoryObj<ComponentProps<T>>;
30/**
31 * For the common case where a (CSFv2) story is a simple component that receives args as props:
32 *
33 * ```tsx
34 * const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />
35 * ```
36 *
37 * NOTE: this is an alias for `ComponentStoryFn`.
38 * In Storybook v7, `ComponentStory` will alias `ComponentStoryObj`
39 */
40export declare type ComponentStory<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = Story<ComponentProps<T>>;