import { ComponentType, ReactNode } from 'react'; export type StoryConfig = { /** * Used to divide the resulting examples into sections. It should correspond * to an enumerated prop in the Component */ sectionProp?: keyof Props; /** * Specifies the max number of examples that can exist in a single page * within a section */ maxExamplesPerPage?: number | ((sectionName: string) => number); /** * Specifies the total max number of examples. Default: 500 */ maxExamples?: number; /** * An object with keys that correspond to the component props. Each key has a * corresponding value array. This array contains possible values for that prop. */ propValues?: Partial>; /** * Prop keys to exclude from propValues. Useful when generating propValues with code. */ excludeProps?: (keyof Props)[]; /** * The values returned by this function are passed to the component. * A function called with the prop combination for the current example. It * returns an object of props that will be passed into the `renderExample` * function as componentProps. */ getComponentProps?: (props: Props & Record) => Partial; /** * The values returned by this function are passed to a `View` that wraps the * example. * A function called with the prop combination for the current example. It * returns an object of props that will be passed into the `renderExample` * function as exampleProps. */ getExampleProps?: (props: Props & Record) => Record; /** * A function called with the examples and index for the current page of * examples. It returns an object of parameters/metadata for that page of * examples (e.g. to be passed in to a visual regression tool like chromatic). */ getParameters?: (params: ExamplesPage) => { [key: string]: any; delay?: number; disable?: boolean; }; filter?: (props: Props) => boolean; }; type ExampleSection = { sectionName: string; propName: keyof Props; propValue: string; pages: ExamplesPage[]; }; export type ExamplesPage = { examples: Example[]; index: number; renderExample?: (exampleProps: Example) => ReactNode; parameters?: Record; }; export type Example = { Component: ComponentType; componentProps: Partial; exampleProps: Record; key: string; }; /** * Generates examples for the given component based on the given configuration. * @param Component A React component * @param config A configuration object (stored in xy.examples.jsx files in InstUI) * @returns Array of examples broken into sections and pages if configured to do so. * @module generateComponentExamples * @private * */ export declare function generateComponentExamples>(Component: ComponentType, config: StoryConfig): ExampleSection[]; export default generateComponentExamples; //# sourceMappingURL=generateComponentExamples.d.ts.map