Skip to content

Commit

Permalink
Add disabled property to control
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperpeulen committed Apr 11, 2024
1 parent 5e73744 commit c8a52dd
Showing 1 changed file with 53 additions and 45 deletions.
98 changes: 53 additions & 45 deletions src/story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,55 +53,63 @@ type ControlType =
type ConditionalTest = { truthy?: boolean } | { exists: boolean } | { eq: any } | { neq: any };
type ConditionalValue = { arg: string } | { global: string };
export type Conditional = ConditionalValue & ConditionalTest;

interface ControlBase {
/**
* @see https://storybook.js.org/docs/api/arg-types#controltype
*/
type: ControlType;
disable: boolean;
}

type Control =
| ControlType
| false
| (ControlBase &
(
| {
type: 'color';
/**
* @see https://storybook.js.org/docs/api/arg-types#controlpresetcolors
*/
presetColors?: string[];
}
| {
type: 'file';
/**
* @see https://storybook.js.org/docs/api/arg-types#controlaccept
*/
accept?: string;
}
| {
type: 'inline-check' | 'radio' | 'inline-radio' | 'select' | 'multi-select';
/**
* @see https://storybook.js.org/docs/api/arg-types#controllabels
*/
labels?: { [options: string]: string };
}
| {
type: 'number' | 'range';
/**
* @see https://storybook.js.org/docs/api/arg-types#controlmax
*/
max?: number;
/**
* @see https://storybook.js.org/docs/api/arg-types#controlmin
*/
min?: number;
/**
* @see https://storybook.js.org/docs/api/arg-types#controlstep
*/
step?: number;
}
));

export interface InputType {
/**
* @see https://storybook.js.org/docs/api/arg-types#control
*/
control?:
| ControlType
| {
/**
* @see https://storybook.js.org/docs/api/arg-types#controltype
*/
type: ControlType;
}
| {
type: 'color';
/**
* @see https://storybook.js.org/docs/api/arg-types#controlpresetcolors
*/
presetColors?: string[];
}
| {
type: 'file';
/**
* @see https://storybook.js.org/docs/api/arg-types#controlaccept
*/
accept?: string;
}
| {
type: 'inline-check' | 'radio' | 'inline-radio' | 'select' | 'multi-select';
/**
* @see https://storybook.js.org/docs/api/arg-types#controllabels
*/
labels?: { [options: string]: string };
}
| {
type: 'number' | 'range';
/**
* @see https://storybook.js.org/docs/api/arg-types#controlmax
*/
max?: number;
/**
* @see https://storybook.js.org/docs/api/arg-types#controlmin
*/
min?: number;
/**
* @see https://storybook.js.org/docs/api/arg-types#controlstep
*/
step?: number;
}
| false;
control?: Control;
/**
* @see https://storybook.js.org/docs/api/arg-types#description
*/
Expand Down

0 comments on commit c8a52dd

Please sign in to comment.