@fy-/fws-vue 0.6.9 → 0.7.1

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.
@@ -13,7 +13,7 @@ import {
13
13
  } from "@heroicons/vue/24/solid";
14
14
  import { useEventBus } from "../../composables/event-bus";
15
15
  import type { Component } from "vue";
16
- import FadeTransition from "./transitions/FadeTransition.vue";
16
+ import ScaleTransition from "./transitions/ScaleTransition.vue";
17
17
  interface NotifProps {
18
18
  imgSrc?: string;
19
19
  imgIcon?: Component;
@@ -29,37 +29,36 @@ const notif = ref<HTMLElement | null>(null);
29
29
  const eventBus = useEventBus();
30
30
  const currentNotif = ref<NotifProps | null>(null);
31
31
  let currentTimeout: any | null = null;
32
- const onCall = (props: NotifProps) => {
32
+ const onCall = (data: NotifProps) => {
33
33
  if (currentNotif.value !== null) {
34
34
  hideNotif();
35
35
  }
36
- const actualIcon = ref(props.imgIcon);
37
- if (props.imgIcon === undefined) {
38
- if (props.type === "info") {
36
+ const actualIcon = ref(data.imgIcon);
37
+ if (data.imgIcon === undefined) {
38
+ if (data.type === "info") {
39
39
  actualIcon.value = LightBulbIcon;
40
- } else if (props.type === "warning") {
40
+ } else if (data.type === "warning") {
41
41
  actualIcon.value = ExclamationTriangleIcon;
42
- } else if (props.type === "success") {
42
+ } else if (data.type === "success") {
43
43
  actualIcon.value = CheckCircleIcon;
44
44
  }
45
45
  }
46
- if (!props.time || props.time < 1000) {
47
- props.time = 5000;
46
+ if (!data.time || data.time < 1000) {
47
+ data.time = 5000;
48
48
  }
49
49
 
50
50
  currentNotif.value = {
51
- imgSrc: props.imgSrc,
51
+ imgSrc: data.imgSrc,
52
52
  imgIcon: actualIcon.value,
53
- title: props.title,
54
- content: props.content,
55
- ctaText: props.ctaText,
56
- ctaLink: props.ctaLink,
57
- ctaAction: props.ctaAction,
53
+ title: data.title,
54
+ content: data.content,
55
+ ctaText: data.ctaText,
56
+ ctaLink: data.ctaLink,
57
+ time: data.time,
58
+ ctaAction: data.ctaAction,
58
59
  };
59
60
 
60
- currentTimeout = setTimeout(() => {
61
- hideNotif();
62
- }, currentNotif.value.time);
61
+ currentTimeout = setTimeout(hideNotif, currentNotif.value.time);
63
62
  };
64
63
 
65
64
  const hideNotif = () => {
@@ -69,14 +68,14 @@ const hideNotif = () => {
69
68
  }
70
69
  };
71
70
  onMounted(() => {
72
- eventBus.on("main-notif", onCall);
71
+ eventBus.on("SendNotif", onCall);
73
72
  });
74
73
  onUnmounted(() => {
75
- eventBus.off("main-notif", onCall);
74
+ eventBus.off("SendNotif", onCall);
76
75
  });
77
76
  </script>
78
77
  <template>
79
- <FadeTransition>
78
+ <ScaleTransition>
80
79
  <div
81
80
  id="mainNotif"
82
81
  ref="notif"
@@ -156,5 +155,5 @@ onUnmounted(() => {
156
155
  </button>
157
156
  </div>
158
157
  </div>
159
- </FadeTransition>
158
+ </ScaleTransition>
160
159
  </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fy-/fws-vue",
3
- "version": "0.6.9",
3
+ "version": "0.7.1",
4
4
  "author": "Florian 'Fy' Gasquez <m@fy.to>",
5
5
  "license": "MIT",
6
6
  "repository": {