UNPKG

1.3 kBTypeScriptView Raw
1import { ComponentProps, FC } from 'react';
2import { Source as PureSource } from '@storybook/components';
3import { DocsContextProps } from './DocsContext';
4import { SourceContextProps } from './SourceContainer';
5export declare enum SourceState {
6 OPEN = "open",
7 CLOSED = "closed",
8 NONE = "none"
9}
10interface CommonProps {
11 language?: string;
12 dark?: boolean;
13 format?: PureSourceProps['format'];
14 code?: string;
15}
16declare type SingleSourceProps = {
17 id: string;
18} & CommonProps;
19declare type MultiSourceProps = {
20 ids: string[];
21} & CommonProps;
22declare type CodeProps = {
23 code: string;
24} & CommonProps;
25declare type NoneProps = CommonProps;
26declare type SourceProps = SingleSourceProps | MultiSourceProps | CodeProps | NoneProps;
27declare type SourceStateProps = {
28 state: SourceState;
29};
30declare type PureSourceProps = ComponentProps<typeof PureSource>;
31export declare const getSourceProps: (props: SourceProps, docsContext: DocsContextProps<any>, sourceContext: SourceContextProps) => PureSourceProps & SourceStateProps;
32/**
33 * Story source doc block renders source code if provided,
34 * or the source for a story if `storyId` is provided, or
35 * the source for the current story if nothing is provided.
36 */
37export declare const Source: FC<PureSourceProps>;
38export {};