@invopop/popui 0.0.82 → 0.0.84
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/dist/AlertDialog.svelte +29 -5
- package/dist/BaseDropdown.svelte +1 -1
- package/package.json +1 -1
package/dist/AlertDialog.svelte
CHANGED
|
@@ -19,10 +19,34 @@ export let cancelText = "Cancel";
|
|
|
19
19
|
export let actionText = "OK";
|
|
20
20
|
export let cancelActionEl = void 0;
|
|
21
21
|
export let okActionEl = void 0;
|
|
22
|
+
let recentAction = false;
|
|
23
|
+
function cancel() {
|
|
24
|
+
recentAction = true;
|
|
25
|
+
dispatch("cancel");
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
recentAction = false;
|
|
28
|
+
}, 10);
|
|
29
|
+
}
|
|
30
|
+
function confirm() {
|
|
31
|
+
recentAction = true;
|
|
32
|
+
dispatch("confirm");
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
recentAction = false;
|
|
35
|
+
}, 10);
|
|
36
|
+
}
|
|
37
|
+
$:
|
|
38
|
+
if (!open) {
|
|
39
|
+
cancelByEsc();
|
|
40
|
+
}
|
|
41
|
+
function cancelByEsc() {
|
|
42
|
+
if (recentAction)
|
|
43
|
+
return;
|
|
44
|
+
dispatch("cancel");
|
|
45
|
+
}
|
|
22
46
|
</script>
|
|
23
47
|
|
|
24
48
|
<AlertDialog openFocus="[data-alert-dialog-action]:nth-of-type(2)" bind:open>
|
|
25
|
-
<AlertDialogTrigger>
|
|
49
|
+
<AlertDialogTrigger class={$$slots.default ? '' : 'hidden'}>
|
|
26
50
|
<slot />
|
|
27
51
|
</AlertDialogTrigger>
|
|
28
52
|
<AlertDialogContent>
|
|
@@ -36,11 +60,11 @@ export let okActionEl = void 0;
|
|
|
36
60
|
<AlertDialogCancel
|
|
37
61
|
bind:el={cancelActionEl}
|
|
38
62
|
on:click={() => {
|
|
39
|
-
|
|
63
|
+
cancel()
|
|
40
64
|
}}
|
|
41
65
|
on:keydown={(e) => {
|
|
42
66
|
if (e.detail.originalEvent.key === 'Enter') {
|
|
43
|
-
|
|
67
|
+
cancel()
|
|
44
68
|
}
|
|
45
69
|
}}>{cancelText}</AlertDialogCancel
|
|
46
70
|
>
|
|
@@ -48,11 +72,11 @@ export let okActionEl = void 0;
|
|
|
48
72
|
bind:el={okActionEl}
|
|
49
73
|
{destructive}
|
|
50
74
|
on:click={() => {
|
|
51
|
-
|
|
75
|
+
confirm()
|
|
52
76
|
}}
|
|
53
77
|
on:keydown={(e) => {
|
|
54
78
|
if (e.detail.originalEvent.key === 'Enter') {
|
|
55
|
-
|
|
79
|
+
confirm()
|
|
56
80
|
}
|
|
57
81
|
}}
|
|
58
82
|
>
|
package/dist/BaseDropdown.svelte
CHANGED