[@types/bootbox] Update and add options (#37051)

* add missing options

* add tests for new options
This commit is contained in:
Andrea
2019-07-23 12:36:12 -07:00
committed by Wesley Wigham
parent f4bb1a2b74
commit 5e51687559
2 changed files with 39 additions and 3 deletions
+32
View File
@@ -12,6 +12,26 @@ bootbox.alert({
console.log("Callback called!");
}
});
bootbox.alert({
size: "extra-large",
message: "Are we ok with new sizes?",
});
bootbox.alert({
size: "lg",
message: "Are we ok with new alternative size keys?",
});
bootbox.alert({
scrollable: true,
message: "Are we ok with scrollable?",
});
bootbox.alert({
swapButtonOrder: true,
message: "Are we ok with swapButtonOrder?",
});
bootbox.alert({
centerVertical: true,
message: "Are we ok with centerVertical?",
});
bootbox.confirm("Click cancel to pass test", function (result) {
console.log(!result);
@@ -38,6 +58,18 @@ bootbox.prompt({
console.log(result);
}
});
bootbox.prompt({
size: "xl",
title: "Enter 'ok' to pass test", callback: function (result) {
console.log(result);
}
});
bootbox.prompt({
scrollable: true,
title: "Enter 'ok' to pass test", callback: function (result) {
console.log(result);
}
});
bootbox.prompt({
title: "This is a prompt with a set of checkbox inputs!",
inputType: 'checkbox',
+7 -3
View File
@@ -1,4 +1,4 @@
// Type definitions for Bootbox 4.4.0
// Type definitions for Bootbox 5.2.0
// Project: https://github.com/makeusabrew/bootbox
// Definitions by: Vincent Bortone <https://github.com/vbortone>, Kon Pik <https://github.com/konpikwastaken>, Anup Kattel <https://github.com/kanup>, Dominik Schroeter <https://github.com/icereed>, Troy McKinnon <https://github.com/trodi>, Stanny Nuytkens <https://github.com/stannynuytkens>, Soner Köksal <https://github.com/renjfk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -17,13 +17,17 @@ interface BootboxBaseOptions<T = any> {
animate?: boolean;
className?: string;
/** All other values result in medium */
size?: "small" | "large";
size?: "small" | "sm" | "large" | "lg" | "extra-large" | "xl";
locale?: string;
buttons?: BootboxButtonMap; // complex object where each key is of type BootboxButton
scrollable?: boolean;
}
/** Bootbox options available for custom modals */
interface BootboxDialogOptions<T = any> extends BootboxBaseOptions<T> {
message: JQuery|any[]|Element|DocumentFragment|Text|string|((index: number, html: string) => string|Element|JQuery);
swapButtonOrder?: boolean;
centerVertical?: boolean;
}
/** Bootbox options available for alert modals */
@@ -42,7 +46,7 @@ interface BootboxConfirmOptions extends BootboxDialogOptions<boolean> {
interface BootboxPromptOptions extends BootboxBaseOptions<string> {
title: string;
value?: string;
inputType?: "text" | "textarea" | "email" | "select" | "checkbox" | "date" | "time" | "number" | "password";
inputType?: "text" | "textarea" | "email" | "select" | "checkbox" | "date" | "time" | "number" | "password" | "radio" | "range";
callback: (result: string) => any;
buttons?: BootboxConfirmPromptButtonMap;
inputOptions?: { text: string, value: string, group?: string }[];