sprintify-ui 0.0.60 → 0.0.62
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/sprintify-ui.es.js +1725 -1692
- package/dist/types/src/components/BaseLayoutNotificationItemContent.vue.d.ts +24 -0
- package/dist/types/src/types/Notification.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/BaseLayoutNotificationItem.vue +28 -41
- package/src/components/BaseLayoutNotificationItemContent.vue +57 -0
- package/src/components/BaseLayoutSidebarConfigurable.stories.js +0 -1
- package/src/types/Notification.ts +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Notification } from '@/types/Notification';
|
|
2
|
+
import { PropType } from 'vue';
|
|
3
|
+
declare const _default: import("vue").DefineComponent<{
|
|
4
|
+
active: {
|
|
5
|
+
default: boolean;
|
|
6
|
+
type: BooleanConstructor;
|
|
7
|
+
};
|
|
8
|
+
notification: {
|
|
9
|
+
required: true;
|
|
10
|
+
type: PropType<Notification>;
|
|
11
|
+
};
|
|
12
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
|
+
active: {
|
|
14
|
+
default: boolean;
|
|
15
|
+
type: BooleanConstructor;
|
|
16
|
+
};
|
|
17
|
+
notification: {
|
|
18
|
+
required: true;
|
|
19
|
+
type: PropType<Notification>;
|
|
20
|
+
};
|
|
21
|
+
}>>, {
|
|
22
|
+
active: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
export default _default;
|
package/package.json
CHANGED
|
@@ -1,32 +1,43 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<router-link
|
|
2
|
+
<router-link
|
|
3
|
+
v-if="notification.to"
|
|
4
|
+
v-slot="{ href, navigate }"
|
|
5
|
+
custom
|
|
6
|
+
:to="notification.to"
|
|
7
|
+
>
|
|
3
8
|
<MenuItem
|
|
4
9
|
v-slot="{ active }"
|
|
5
10
|
as="a"
|
|
6
11
|
:href="href"
|
|
7
12
|
@click.prevent="onClick(navigate)"
|
|
8
13
|
>
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
></div>
|
|
14
|
-
<p v-if="createdAt" class="mt-1 text-xs text-slate-400">
|
|
15
|
-
{{ createdAt }}
|
|
16
|
-
</p>
|
|
17
|
-
</div>
|
|
14
|
+
<BaseLayoutNotificationItemContent
|
|
15
|
+
:active="active"
|
|
16
|
+
:notification="notification"
|
|
17
|
+
></BaseLayoutNotificationItemContent>
|
|
18
18
|
</MenuItem>
|
|
19
19
|
</router-link>
|
|
20
|
+
<div v-else>
|
|
21
|
+
<MenuItem
|
|
22
|
+
v-slot="{ active }"
|
|
23
|
+
as="button"
|
|
24
|
+
class="w-full text-left"
|
|
25
|
+
@click.prevent="onClick()"
|
|
26
|
+
>
|
|
27
|
+
<BaseLayoutNotificationItemContent
|
|
28
|
+
:active="active"
|
|
29
|
+
:notification="notification"
|
|
30
|
+
></BaseLayoutNotificationItemContent>
|
|
31
|
+
</MenuItem>
|
|
32
|
+
</div>
|
|
20
33
|
</template>
|
|
21
34
|
|
|
22
35
|
<script lang="ts" setup>
|
|
23
36
|
import { Notification } from '@/types/Notification';
|
|
24
37
|
import { MenuItem } from '@headlessui/vue';
|
|
25
|
-
import { DateTime } from 'luxon';
|
|
26
38
|
import { PropType } from 'vue';
|
|
27
|
-
import
|
|
39
|
+
import BaseLayoutNotificationItemContent from './BaseLayoutNotificationItemContent.vue';
|
|
28
40
|
|
|
29
|
-
const i18n = useI18n();
|
|
30
41
|
const emit = defineEmits(['click']);
|
|
31
42
|
|
|
32
43
|
const props = defineProps({
|
|
@@ -36,34 +47,10 @@ const props = defineProps({
|
|
|
36
47
|
},
|
|
37
48
|
});
|
|
38
49
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const intervalId = setInterval(() => {
|
|
42
|
-
now.value.plus({ second: 1 });
|
|
43
|
-
}, 1000);
|
|
44
|
-
|
|
45
|
-
const createdAt = computed(() => {
|
|
46
|
-
if (props.notification.created_at) {
|
|
47
|
-
const duration = DateTime.fromISO(props.notification.created_at, {
|
|
48
|
-
zone: 'utc',
|
|
49
|
-
}).diff(now.value).milliseconds;
|
|
50
|
-
|
|
51
|
-
const durationHuman = humanizeDuration(duration, {
|
|
52
|
-
language: i18n.locale.value,
|
|
53
|
-
round: true,
|
|
54
|
-
largest: 1,
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
return i18n.t('sui.x_ago', { duration: durationHuman });
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
onBeforeUnmount(() => {
|
|
62
|
-
clearInterval(intervalId);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
function onClick(navigate: () => void) {
|
|
50
|
+
function onClick(navigate: (() => void) | null) {
|
|
66
51
|
emit('click', props.notification);
|
|
67
|
-
navigate
|
|
52
|
+
if (navigate) {
|
|
53
|
+
navigate();
|
|
54
|
+
}
|
|
68
55
|
}
|
|
69
56
|
</script>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="px-3 py-2" :class="[active ? 'bg-slate-100' : '']">
|
|
3
|
+
<div
|
|
4
|
+
class="text-sm leading-tight text-slate-800"
|
|
5
|
+
v-html="notification.text"
|
|
6
|
+
></div>
|
|
7
|
+
<p v-if="createdAt" class="mt-1 text-xs text-slate-400">
|
|
8
|
+
{{ createdAt }}
|
|
9
|
+
</p>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script lang="ts" setup>
|
|
14
|
+
import { Notification } from '@/types/Notification';
|
|
15
|
+
import { DateTime } from 'luxon';
|
|
16
|
+
import { PropType } from 'vue';
|
|
17
|
+
import humanizeDuration from 'humanize-duration';
|
|
18
|
+
|
|
19
|
+
const i18n = useI18n();
|
|
20
|
+
|
|
21
|
+
const props = defineProps({
|
|
22
|
+
active: {
|
|
23
|
+
default: false,
|
|
24
|
+
type: Boolean,
|
|
25
|
+
},
|
|
26
|
+
notification: {
|
|
27
|
+
required: true,
|
|
28
|
+
type: Object as PropType<Notification>,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const now = ref(DateTime.now());
|
|
33
|
+
|
|
34
|
+
const intervalId = setInterval(() => {
|
|
35
|
+
now.value.plus({ second: 1 });
|
|
36
|
+
}, 1000);
|
|
37
|
+
|
|
38
|
+
const createdAt = computed(() => {
|
|
39
|
+
if (props.notification.created_at) {
|
|
40
|
+
const duration = DateTime.fromISO(props.notification.created_at, {
|
|
41
|
+
zone: 'utc',
|
|
42
|
+
}).diff(now.value).milliseconds;
|
|
43
|
+
|
|
44
|
+
const durationHuman = humanizeDuration(duration, {
|
|
45
|
+
language: i18n.locale.value,
|
|
46
|
+
round: true,
|
|
47
|
+
largest: 1,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
return i18n.t('sui.x_ago', { duration: durationHuman });
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
onBeforeUnmount(() => {
|
|
55
|
+
clearInterval(intervalId);
|
|
56
|
+
});
|
|
57
|
+
</script>
|