1 | import { DecoratorFunction, Parameters, StoryApi, StoryFn } from "@storybook/addons";
|
2 | import { StoryContext } from "@storybook/csf/dist/story";
|
3 | import { ComponentType, ReactElement } from "react";
|
4 |
|
5 | export interface WrapStoryProps {
|
6 | storyFn?: StoryFn | undefined;
|
7 | context?: object | undefined;
|
8 | options?: object | undefined;
|
9 | }
|
10 |
|
11 | export interface TableComponentOptionProps {
|
12 | propDefinitions: Array<{
|
13 | property: string;
|
14 | propType: object | string;
|
15 | required: boolean;
|
16 | description: string;
|
17 | defaultValue: any;
|
18 | }>;
|
19 | }
|
20 |
|
21 | export interface Options {
|
22 | text?: string | undefined;
|
23 | header?: boolean | undefined;
|
24 | inline?: boolean | undefined;
|
25 | source?: boolean | undefined;
|
26 | propTables?: Array<ComponentType<any>> | false | undefined;
|
27 | propTablesExclude?: Array<ComponentType<any>> | undefined;
|
28 | styles?: object | undefined;
|
29 | components?: {
|
30 | [key: string]: ComponentType<any>;
|
31 | } | undefined;
|
32 | |
33 |
|
34 |
|
35 | marksyConf?: object | undefined;
|
36 | maxPropsIntoLine?: number | undefined;
|
37 | maxPropObjectKeys?: number | undefined;
|
38 | maxPropArrayLength?: number | undefined;
|
39 | maxPropStringLength?: number | undefined;
|
40 | TableComponent?: ComponentType<TableComponentOptionProps> | undefined;
|
41 | excludedPropTypes?: string[] | undefined;
|
42 | }
|
43 |
|
44 | export function withInfo<A = unknown>(
|
45 | story: StoryFn<A>,
|
46 | context: StoryContext<{ component: any; storyResult: A }>,
|
47 | ): ReturnType<DecoratorFunction<A>>;
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 | export function withInfo(
|
54 | textOrOptions?: string | Options,
|
55 | ): (storyFn: StoryFn) => (context?: object) => ReactElement<WrapStoryProps>;
|
56 |
|
57 |
|
58 |
|
59 |
|
60 | export function setDefaults(newDefaults: Options): Options;
|
61 |
|
62 | declare module "@storybook/addons" {
|
63 | interface ClientStoryApi<StoryFnReturnType = unknown> {
|
64 | storiesOf(kind: string, module: NodeModule): StoryApi<StoryFnReturnType>;
|
65 | addParameters(parameter: Parameters & { info: Options }): StoryApi<StoryFnReturnType>;
|
66 | addDecorator(decorator: DecoratorFunction<StoryFnReturnType>): StoryApi<StoryFnReturnType>;
|
67 | }
|
68 | }
|