2016-10-27 09:56:31 +13:00
|
|
|
import * as React from 'react';
|
2016-10-26 21:27:05 +13:00
|
|
|
|
|
|
|
interface KnobOption<T> {
|
|
|
|
value: T,
|
2016-11-16 10:26:35 +02:00
|
|
|
type: 'text' | 'boolean' | 'number' | 'color' | 'object' | 'select' | 'date',
|
2016-10-26 21:27:05 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
interface StoryContext {
|
|
|
|
kind: string,
|
|
|
|
story: string,
|
|
|
|
}
|
|
|
|
|
2017-05-08 13:57:39 +10:00
|
|
|
interface NumberOptions {
|
|
|
|
range: boolean,
|
|
|
|
min: number,
|
|
|
|
max: number,
|
|
|
|
step: number,
|
|
|
|
}
|
|
|
|
|
2016-10-26 21:27:05 +13:00
|
|
|
export function knob<T>(name: string, options: KnobOption<T>): T;
|
|
|
|
|
2016-10-27 09:56:31 +13:00
|
|
|
export function text(name: string, value: string | null): string;
|
2016-10-26 21:27:05 +13:00
|
|
|
|
|
|
|
export function boolean(name: string, value: boolean): boolean;
|
|
|
|
|
2017-05-08 13:57:39 +10:00
|
|
|
export function number(name: string, value: number, options?: NumberOptions): number;
|
2016-10-26 21:27:05 +13:00
|
|
|
|
2016-11-19 05:52:39 +05:30
|
|
|
export function color(name: string, value: string): string;
|
2016-11-16 10:26:35 +02:00
|
|
|
|
2016-10-28 08:11:50 +13:00
|
|
|
export function object<T>(name: string, value: T): T;
|
2016-10-26 21:27:05 +13:00
|
|
|
|
|
|
|
export function select<T>(name: string, options: { [s: string]: T }, value: string): T;
|
2016-10-27 09:56:31 +13:00
|
|
|
export function select(name: string, options: string[], value: string): string;
|
2016-10-26 21:27:05 +13:00
|
|
|
|
2016-10-28 08:11:50 +13:00
|
|
|
export function date(name: string, value?: Date): Date;
|
2016-10-26 21:27:05 +13:00
|
|
|
|
2016-10-27 09:56:31 +13:00
|
|
|
interface IWrapStoryProps {
|
2016-10-28 08:11:50 +13:00
|
|
|
context?: Object;
|
|
|
|
storyFn?: Function;
|
|
|
|
channel?: Object;
|
|
|
|
knobStore?: Object;
|
|
|
|
initialContent?: Object;
|
2016-10-27 09:56:31 +13:00
|
|
|
}
|
|
|
|
|
2017-05-30 20:33:12 +03:00
|
|
|
export function withKnobs(storyFn: Function, context: StoryContext): React.ReactElement<IWrapStoryProps>;
|
|
|
|
export function withKnobsOptions(options: Object): (storyFn: Function, context: StoryContext) => React.ReactElement<IWrapStoryProps>;
|