@fy-/fws-vue 2.1.46 → 2.1.48
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.
|
@@ -62,9 +62,7 @@ function onCall(data: NotifProps) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
// Set the new notification
|
|
65
|
-
currentNotif.value = {
|
|
66
|
-
...data,
|
|
67
|
-
}
|
|
65
|
+
currentNotif.value = { ...data }
|
|
68
66
|
|
|
69
67
|
// (A) Hide the notification after the specified time
|
|
70
68
|
hideTimeout = setTimeout(() => hideNotif(), data.time)
|
|
@@ -74,7 +72,7 @@ function onCall(data: NotifProps) {
|
|
|
74
72
|
progressInterval = setInterval(() => {
|
|
75
73
|
if (currentNotif.value && data.time) {
|
|
76
74
|
// update progress based on a 100ms tick
|
|
77
|
-
progress.value +=
|
|
75
|
+
progress.value += 100 / (data.time / 100)
|
|
78
76
|
// if progress hits or exceeds 100, hide
|
|
79
77
|
if (progress.value >= 100) {
|
|
80
78
|
hideNotif()
|
|
@@ -83,9 +81,7 @@ function onCall(data: NotifProps) {
|
|
|
83
81
|
}, 100)
|
|
84
82
|
}
|
|
85
83
|
|
|
86
|
-
/**
|
|
87
|
-
* Clears everything related to the current notification
|
|
88
|
-
*/
|
|
84
|
+
/** Clears everything related to the current notification */
|
|
89
85
|
function hideNotif() {
|
|
90
86
|
currentNotif.value = null
|
|
91
87
|
progress.value = 0
|
|
@@ -100,16 +96,12 @@ function hideNotif() {
|
|
|
100
96
|
}
|
|
101
97
|
}
|
|
102
98
|
|
|
103
|
-
/**
|
|
104
|
-
* Setup: Listen to the global event bus
|
|
105
|
-
*/
|
|
99
|
+
/** Setup: Listen to the global event bus */
|
|
106
100
|
onMounted(() => {
|
|
107
101
|
eventBus.on('SendNotif', onCall)
|
|
108
102
|
})
|
|
109
103
|
|
|
110
|
-
/**
|
|
111
|
-
* Cleanup: remove event listeners
|
|
112
|
-
*/
|
|
104
|
+
/** Cleanup: remove event listeners */
|
|
113
105
|
onUnmounted(() => {
|
|
114
106
|
eventBus.off('SendNotif', onCall)
|
|
115
107
|
})
|
|
@@ -120,7 +112,7 @@ onUnmounted(() => {
|
|
|
120
112
|
<div
|
|
121
113
|
v-if="currentNotif !== null"
|
|
122
114
|
id="base-notif"
|
|
123
|
-
class="p-2 mb-4 fixed bottom-4 right-8 !z-[2000] bg-fv-neutral-50/[.6] dark:bg-neutral-800/[.6] rounded-lg border"
|
|
115
|
+
class="relative p-2 mb-4 fixed bottom-4 right-8 !z-[2000] bg-fv-neutral-50/[.6] dark:bg-neutral-800/[.6] rounded-lg border overflow-hidden"
|
|
124
116
|
role="alert"
|
|
125
117
|
:class="{
|
|
126
118
|
'text-fv-neutral-800 border-fv-neutral-300 dark:text-fv-neutral-400 dark:border-fv-neutral-600':
|
|
@@ -133,6 +125,14 @@ onUnmounted(() => {
|
|
|
133
125
|
currentNotif.type === 'secret',
|
|
134
126
|
}"
|
|
135
127
|
>
|
|
128
|
+
<!-- PROGRESS BAR at top (4px) -->
|
|
129
|
+
<div class="absolute top-0 left-0 w-full h-[4px] bg-gray-200">
|
|
130
|
+
<div
|
|
131
|
+
class="h-full bg-current transition-[width]"
|
|
132
|
+
:style="{ width: `${progress}%` }"
|
|
133
|
+
/>
|
|
134
|
+
</div>
|
|
135
|
+
|
|
136
136
|
<!-- Title + icon or image -->
|
|
137
137
|
<div class="flex items-center gap-2">
|
|
138
138
|
<img
|
|
@@ -156,15 +156,6 @@ onUnmounted(() => {
|
|
|
156
156
|
v-text="currentNotif.content"
|
|
157
157
|
/>
|
|
158
158
|
|
|
159
|
-
<!-- Progress bar (3px) -->
|
|
160
|
-
<div class="relative mt-3 h-[3px] bg-gray-200 rounded-full overflow-hidden">
|
|
161
|
-
<!-- We re-use text color (text-*) as background or define a custom color -->
|
|
162
|
-
<div
|
|
163
|
-
class="absolute left-0 top-0 h-full bg-current transition-[width]"
|
|
164
|
-
:style="{ width: `${progress}%` }"
|
|
165
|
-
/>
|
|
166
|
-
</div>
|
|
167
|
-
|
|
168
159
|
<!-- CTA row (if you need more buttons, just extend it) -->
|
|
169
160
|
<div class="flex justify-end gap-2 pt-3">
|
|
170
161
|
<button
|
|
@@ -173,7 +164,6 @@ onUnmounted(() => {
|
|
|
173
164
|
aria-label="Close"
|
|
174
165
|
@click="hideNotif"
|
|
175
166
|
>
|
|
176
|
-
<!-- i18n example, or plain text like "Dismiss" -->
|
|
177
167
|
{{ $t("dismiss_cta") }}
|
|
178
168
|
</button>
|
|
179
169
|
</div>
|
|
@@ -350,18 +350,4 @@ function handlePaste(e: ClipboardEvent) {
|
|
|
350
350
|
.input {
|
|
351
351
|
@apply flex-grow min-w-[100px] outline-none border-none break-words;
|
|
352
352
|
}
|
|
353
|
-
|
|
354
|
-
/* Example button classes */
|
|
355
|
-
.btn {
|
|
356
|
-
@apply inline-flex items-center justify-center rounded text-sm px-3 py-1
|
|
357
|
-
border border-transparent font-medium focus:outline-none
|
|
358
|
-
focus-visible:ring-2 focus-visible:ring-offset-2;
|
|
359
|
-
}
|
|
360
|
-
.btn.small {
|
|
361
|
-
@apply text-xs px-2 py-1;
|
|
362
|
-
}
|
|
363
|
-
.btn.neutral {
|
|
364
|
-
@apply bg-fv-neutral-300 hover:bg-fv-neutral-400 text-black
|
|
365
|
-
dark:bg-fv-neutral-600 dark:hover:bg-fv-neutral-500;
|
|
366
|
-
}
|
|
367
353
|
</style>
|