UNPKG

1.19 kBTypeScriptView Raw
1import { FC } from 'react';
2import { SourceProps as PureSourceProps } 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 code?: string;
14}
15declare type SingleSourceProps = {
16 id: string;
17} & CommonProps;
18declare type MultiSourceProps = {
19 ids: string[];
20} & CommonProps;
21declare type CodeProps = {
22 code: string;
23} & CommonProps;
24declare type NoneProps = CommonProps;
25declare type SourceProps = SingleSourceProps | MultiSourceProps | CodeProps | NoneProps;
26declare type SourceStateProps = {
27 state: SourceState;
28};
29export declare const getSourceProps: (props: SourceProps, docsContext: DocsContextProps<any>, sourceContext: SourceContextProps) => PureSourceProps & SourceStateProps;
30/**
31 * Story source doc block renders source code if provided,
32 * or the source for a story if `storyId` is provided, or
33 * the source for the current story if nothing is provided.
34 */
35export declare const Source: FC<SourceProps>;
36export {};