Skip to content

Commit ce66607

Browse files
committed
Add valid type definitions
1 parent 5284c50 commit ce66607

File tree

5 files changed

+52
-30
lines changed

5 files changed

+52
-30
lines changed

dist/index.d.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import React from 'react';
22
import { TextPrompt, PasswordPrompt, DialogPrompt, DialogPromptOptions } from './Prompts';
33
import PromptInput from './PromptInput';
4-
import DialogAction, { DialogActionCallback } from './DialogAction';
4+
import DialogAction, { DialogActionCallback, DialogActionLabel } from './DialogAction';
55
declare type DialogTitle = React.ReactNode;
66
declare type DialogBody = React.ReactNode;
7+
declare type DialogOnHideClalback = ((dialog: Dialog) => void);
78
interface DialogKeyBinds {
89
[id: string]: Function;
910
}
@@ -16,23 +17,29 @@ interface DialogKeyBinds {
1617
* v4 later has "sm"
1718
*/
1819
declare type DialogBsSize = any;
19-
export interface DialogOptions {
20-
showModal?: boolean;
21-
actions?: DialogAction[];
22-
defaultOkLabel?: string;
23-
defaultCancelLabel?: string;
20+
export interface DialogGlobalOptions {
21+
defaultOkLabel?: DialogActionLabel;
22+
defaultCancelLabel?: DialogActionLabel;
2423
primaryClassName?: string;
2524
defaultButtonClassName?: string;
2625
}
26+
export interface DialogOptions {
27+
title?: DialogTitle | null;
28+
body?: DialogBody | null;
29+
actions?: DialogAction[] | null;
30+
bsSize?: DialogBsSize | null;
31+
onHide?: DialogOnHideClalback | null;
32+
prompt?: DialogPrompt | null;
33+
}
2734
interface Props {
2835
}
2936
interface State {
3037
title?: DialogTitle | null;
3138
body?: DialogBody | null;
3239
showModal?: boolean;
33-
actions?: DialogAction[];
34-
bsSize?: DialogBsSize;
35-
onHide?: ((dialog: Dialog) => void) | null;
40+
actions?: DialogAction[] | null;
41+
bsSize?: DialogBsSize | null;
42+
onHide?: DialogOnHideClalback | null;
3643
prompt?: DialogPrompt | null;
3744
}
3845
/**
@@ -48,7 +55,7 @@ export default class Dialog extends React.Component<Props, State> {
4855
primaryClassName: string;
4956
defaultButtonClassName: string;
5057
};
51-
static options: DialogOptions;
58+
static options: DialogGlobalOptions;
5259
promptInput: PromptInput | null;
5360
keyBinds: DialogKeyBinds | null;
5461
static Action: (label: React.ReactNode, func: DialogActionCallback | null | undefined, className: string | null | undefined, key: string) => DialogAction;
@@ -63,7 +70,7 @@ export default class Dialog extends React.Component<Props, State> {
6370
* Set default options for applying to all dialogs.
6471
* @param options
6572
*/
66-
static setOptions(options: DialogOptions): void;
73+
static setOptions(options: DialogGlobalOptions): void;
6774
/**
6875
* Reset default options to presets.
6976
*/

dist/index.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)