@fy-/fws-vue 0.6.4 → 0.6.6
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/components/ui/DefaultNotif.vue +161 -0
- package/composables/seo.ts +0 -4
- package/index.ts +2 -0
- package/package.json +3 -2
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
Dialog,
|
|
4
|
+
DialogPanel,
|
|
5
|
+
DialogTitle,
|
|
6
|
+
TransitionRoot,
|
|
7
|
+
} from "@headlessui/vue";
|
|
8
|
+
import { ref, onMounted, onUnmounted } from "vue";
|
|
9
|
+
import {
|
|
10
|
+
ExclamationTriangleIcon,
|
|
11
|
+
LightBulbIcon,
|
|
12
|
+
CheckCircleIcon,
|
|
13
|
+
} from "@heroicons/vue/24/solid";
|
|
14
|
+
import { useEventBus } from "../../composables/event-bus";
|
|
15
|
+
import type { Component } from "vue";
|
|
16
|
+
import FadeTransition from "./transitions/FadeTransition.vue";
|
|
17
|
+
interface NotifProps {
|
|
18
|
+
imgSrc?: string;
|
|
19
|
+
imgIcon?: Component;
|
|
20
|
+
title: string;
|
|
21
|
+
content?: string;
|
|
22
|
+
ctaText?: string;
|
|
23
|
+
ctaLink?: string;
|
|
24
|
+
ctaAction?: () => void;
|
|
25
|
+
type?: "info" | "warning" | "success";
|
|
26
|
+
time?: number;
|
|
27
|
+
}
|
|
28
|
+
const notif = ref<HTMLElement | null>(null);
|
|
29
|
+
const eventBus = useEventBus();
|
|
30
|
+
const currentNotif = ref<NotifProps | null>(null);
|
|
31
|
+
|
|
32
|
+
const onCall = (props: NotifProps) => {
|
|
33
|
+
if (currentNotif.value) {
|
|
34
|
+
hideNotif();
|
|
35
|
+
}
|
|
36
|
+
const actualIcon = ref(props.imgIcon);
|
|
37
|
+
if (props.imgIcon === undefined) {
|
|
38
|
+
if (props.type === "info") {
|
|
39
|
+
actualIcon.value = LightBulbIcon;
|
|
40
|
+
} else if (props.type === "warning") {
|
|
41
|
+
actualIcon.value = ExclamationTriangleIcon;
|
|
42
|
+
} else if (props.type === "success") {
|
|
43
|
+
actualIcon.value = CheckCircleIcon;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (!props.time) {
|
|
47
|
+
props.time = 5000;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
currentNotif.value = {
|
|
51
|
+
imgSrc: props.imgSrc,
|
|
52
|
+
imgIcon: actualIcon.value,
|
|
53
|
+
title: props.title,
|
|
54
|
+
content: props.content,
|
|
55
|
+
ctaText: props.ctaText,
|
|
56
|
+
ctaLink: props.ctaLink,
|
|
57
|
+
ctaAction: props.ctaAction,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
showNotif();
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const visible = ref(false);
|
|
64
|
+
const showNotif = () => {
|
|
65
|
+
visible.value = true;
|
|
66
|
+
setTimeout(
|
|
67
|
+
() => {
|
|
68
|
+
hideNotif();
|
|
69
|
+
},
|
|
70
|
+
currentNotif.value?.time,
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
const hideNotif = () => {
|
|
74
|
+
visible.value = false;
|
|
75
|
+
currentNotif.value = null;
|
|
76
|
+
};
|
|
77
|
+
onMounted(() => {});
|
|
78
|
+
</script>
|
|
79
|
+
<template>
|
|
80
|
+
<FadeTransition>
|
|
81
|
+
<div
|
|
82
|
+
id="mainNotif"
|
|
83
|
+
ref="notif"
|
|
84
|
+
class="w-full max-w-xs p-4 text-fv-neutral-500 bg-white rounded-lg shadow dark:bg-fv-neutral-800 dark:text-fv-neutral-400 absolute bottom-4 right-4 z-[16]"
|
|
85
|
+
role="alert"
|
|
86
|
+
v-if="visible && currentNotif"
|
|
87
|
+
>
|
|
88
|
+
<div class="flex">
|
|
89
|
+
<img
|
|
90
|
+
class="w-8 h-8 rounded-full"
|
|
91
|
+
:src="currentNotif.imgSrc"
|
|
92
|
+
:alt="currentNotif.title"
|
|
93
|
+
v-if="currentNotif.imgSrc"
|
|
94
|
+
/>
|
|
95
|
+
<component
|
|
96
|
+
:is="currentNotif.imgIcon"
|
|
97
|
+
class="w-8 h-8 rounded-full"
|
|
98
|
+
v-else
|
|
99
|
+
/>
|
|
100
|
+
<div class="ms-3 text-sm font-normal">
|
|
101
|
+
<span
|
|
102
|
+
class="mb-1 text-sm font-semibold"
|
|
103
|
+
:class="{
|
|
104
|
+
'text-fv-neutral-900 dark:text-white':
|
|
105
|
+
currentNotif.type === 'info',
|
|
106
|
+
'text-red-900 dark:text-red-300': currentNotif.type === 'warning',
|
|
107
|
+
'text-green-900 dark:text-green-300':
|
|
108
|
+
currentNotif.type === 'success',
|
|
109
|
+
}"
|
|
110
|
+
>
|
|
111
|
+
{{ currentNotif.title }}
|
|
112
|
+
</span>
|
|
113
|
+
<div class="mb-2 text-sm font-normal" v-if="currentNotif.content">
|
|
114
|
+
{{ currentNotif.content }}
|
|
115
|
+
</div>
|
|
116
|
+
<router-link
|
|
117
|
+
v-if="currentNotif.ctaText && currentNotif.ctaLink"
|
|
118
|
+
:to="currentNotif.ctaLink"
|
|
119
|
+
class="btn primary small"
|
|
120
|
+
>{{ currentNotif.ctaText }}</router-link
|
|
121
|
+
>
|
|
122
|
+
<button
|
|
123
|
+
v-else-if="currentNotif.ctaText && currentNotif.ctaAction"
|
|
124
|
+
@click="
|
|
125
|
+
() => {
|
|
126
|
+
// @ts-ignore
|
|
127
|
+
currentNotif.ctaAction();
|
|
128
|
+
hideNotif();
|
|
129
|
+
}
|
|
130
|
+
"
|
|
131
|
+
class="btn primary small"
|
|
132
|
+
>
|
|
133
|
+
{{ currentNotif.ctaText }}
|
|
134
|
+
</button>
|
|
135
|
+
</div>
|
|
136
|
+
<button
|
|
137
|
+
type="button"
|
|
138
|
+
class="ms-auto -mx-1.5 -my-1.5 bg-white justify-center items-center flex-shrink-0 text-fv-neutral-400 hover:text-fv-neutral-900 rounded-lg focus:ring-2 focus:ring-fv-neutral-300 p-1.5 hover:bg-fv-neutral-100 inline-flex h-8 w-8 dark:text-fv-neutral-500 dark:hover:text-white dark:bg-fv-neutral-800 dark:hover:bg-fv-neutral-700"
|
|
139
|
+
aria-label="Close"
|
|
140
|
+
>
|
|
141
|
+
<span class="sr-only">Close</span>
|
|
142
|
+
<svg
|
|
143
|
+
class="w-3 h-3"
|
|
144
|
+
aria-hidden="true"
|
|
145
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
146
|
+
fill="none"
|
|
147
|
+
viewBox="0 0 14 14"
|
|
148
|
+
>
|
|
149
|
+
<path
|
|
150
|
+
stroke="currentColor"
|
|
151
|
+
stroke-linecap="round"
|
|
152
|
+
stroke-linejoin="round"
|
|
153
|
+
stroke-width="2"
|
|
154
|
+
d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"
|
|
155
|
+
/>
|
|
156
|
+
</svg>
|
|
157
|
+
</button>
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
</FadeTransition>
|
|
161
|
+
</template>
|
package/composables/seo.ts
CHANGED
|
@@ -106,13 +106,9 @@ export const useSeo = (seo: Ref<LazyHead>, initial: boolean = false) => {
|
|
|
106
106
|
|
|
107
107
|
metaPairs.forEach(([seoKey, ...properties]) => {
|
|
108
108
|
const seoValue = seo.value[seoKey as keyof LazyHead];
|
|
109
|
-
console.log(
|
|
110
|
-
`seoKey: ${seoKey}, properties: ${properties}, seoValue: ${seoValue}`,
|
|
111
|
-
);
|
|
112
109
|
|
|
113
110
|
if (seoValue !== undefined && seoValue !== null && seoValue !== "") {
|
|
114
111
|
properties.forEach((property) => {
|
|
115
|
-
console.log(`property: ${property}`);
|
|
116
112
|
if (
|
|
117
113
|
property === "description" ||
|
|
118
114
|
property === "keywords" ||
|
package/index.ts
CHANGED
|
@@ -43,6 +43,7 @@ import DefaultGallery from "./components/ui/DefaultGallery.vue";
|
|
|
43
43
|
import DefaultDropdown from "./components/ui/DefaultDropdown.vue";
|
|
44
44
|
import DefaultDropdownLink from "./components/ui/DefaultDropdownLink.vue";
|
|
45
45
|
import DefaultTagInput from "./components/ui/DefaultTagInput.vue";
|
|
46
|
+
import DefaultNotif from "./components/ui/DefaultNotif.vue";
|
|
46
47
|
// Components/FWS
|
|
47
48
|
import UserFlow from "./components/fws/UserFlow.vue";
|
|
48
49
|
import DataTable from "./components/fws/DataTable.vue";
|
|
@@ -135,6 +136,7 @@ export {
|
|
|
135
136
|
DefaultDropdown,
|
|
136
137
|
DefaultDropdownLink,
|
|
137
138
|
DefaultTagInput,
|
|
139
|
+
DefaultNotif,
|
|
138
140
|
|
|
139
141
|
// FWS
|
|
140
142
|
UserFlow,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fy-/fws-vue",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.6",
|
|
4
4
|
"author": "Florian 'Fy' Gasquez <m@fy.to>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,11 +33,12 @@
|
|
|
33
33
|
"@vuelidate/core": "^2.0.x",
|
|
34
34
|
"@vuelidate/validators": "^2.0.x",
|
|
35
35
|
"@vueuse/core": "^10.x.x",
|
|
36
|
+
"flowbite": "^2.3.x",
|
|
36
37
|
"mitt": "^3.0.x",
|
|
37
38
|
"pinia": "2.x.x",
|
|
38
39
|
"timeago.js": "^4.0.x",
|
|
39
40
|
"vue": "^3.3.x",
|
|
40
41
|
"vue-router": "^4.1.x",
|
|
41
|
-
"
|
|
42
|
+
"vue-picture-cropper": "^0.7.x"
|
|
42
43
|
}
|
|
43
44
|
}
|