@yuneta/gobj-ui 5.7.2 → 5.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/shell_modals.js +27 -0
package/package.json
CHANGED
package/src/shell_modals.js
CHANGED
|
@@ -562,6 +562,33 @@ export function yui_shell_confirm_yesno(shell, message, opts)
|
|
|
562
562
|
], opts).then(v => v === "yes");
|
|
563
563
|
}
|
|
564
564
|
|
|
565
|
+
/***************************************************************
|
|
566
|
+
* A DESTRUCTIVE confirmation: the button that does the damage is
|
|
567
|
+
* red, not blue.
|
|
568
|
+
*
|
|
569
|
+
* yui_shell_confirm_yesno() puts its yes in `is-link`, which is
|
|
570
|
+
* the right colour for "do you want to continue" and the wrong
|
|
571
|
+
* one for "this deletes an account": the two read the same at a
|
|
572
|
+
* glance, and the destructive one is the one that must not be
|
|
573
|
+
* clicked by reflex. The safe answer is also the LAST button,
|
|
574
|
+
* so Escape, the backdrop and the X all resolve to it.
|
|
575
|
+
*
|
|
576
|
+
* Returns a Promise<boolean>: true only if the red button was
|
|
577
|
+
* pressed.
|
|
578
|
+
***************************************************************/
|
|
579
|
+
export function yui_shell_confirm_danger(shell, message, opts)
|
|
580
|
+
{
|
|
581
|
+
let confirm_label = (opts && opts.confirm_label) || "Delete";
|
|
582
|
+
let cancel_label = (opts && opts.cancel_label) || "Cancel";
|
|
583
|
+
if(!opts || !opts.type) {
|
|
584
|
+
opts = Object.assign({}, opts, {type: "danger"});
|
|
585
|
+
}
|
|
586
|
+
return build_dialog(shell, message, [
|
|
587
|
+
{label: confirm_label, value: "confirm", kind: "danger"},
|
|
588
|
+
{label: cancel_label, value: "cancel"}
|
|
589
|
+
], opts).then(v => v === "confirm");
|
|
590
|
+
}
|
|
591
|
+
|
|
565
592
|
export function yui_shell_confirm_yesnocancel(shell, message, opts)
|
|
566
593
|
{
|
|
567
594
|
let yes_label = (opts && opts.yes_label) || "Yes";
|