sprintify-ui 0.0.20 → 0.0.21

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.
@@ -33,20 +33,18 @@
33
33
  </div>
34
34
 
35
35
  <div class="ml-4 flex items-center md:ml-6">
36
- <!-- Good spot for notification button... -->
36
+ <!-- Notification dropdown -->
37
+ <BaseLayoutNotificationDropdown
38
+ v-if="notifications"
39
+ :notifications-config="notifications"
40
+ class="mr-1 sm:mr-2"
41
+ ></BaseLayoutNotificationDropdown>
37
42
 
38
43
  <!-- Profile dropdown -->
39
44
  <div class="relative ml-3 mr-3">
40
45
  <BaseMenu :items="userMenu">
41
46
  <template #button="{ open }">
42
- <div
43
- class="flex"
44
- :class="[
45
- open
46
- ? 'ring-2 ring-blue-500 ring-offset-2 ring-offset-white'
47
- : '',
48
- ]"
49
- >
47
+ <div class="flex" :class="[open ? '' : '']">
50
48
  <BaseAvatar :user="user" show-details />
51
49
  </div>
52
50
  </template>
@@ -65,8 +63,9 @@
65
63
  <script setup lang="ts">
66
64
  import { User } from '@/types/User';
67
65
  import { PropType } from 'vue';
68
- import { ActionItem, ActionSection } from '../types/types';
66
+ import { ActionItem, ActionSection, NotificationsConfig } from '../types/types';
69
67
  import BaseAvatar from './BaseAvatar.vue';
68
+ import BaseLayoutNotificationDropdown from './BaseLayoutNotificationDropdown.vue';
70
69
  import BaseLayoutSidebar from './BaseLayoutSidebar.vue';
71
70
  import BaseMenu from './BaseMenu.vue';
72
71
  import BaseNavbarSideItem from './BaseNavbarSideItem.vue';
@@ -92,6 +91,10 @@ const props = defineProps({
92
91
  required: true,
93
92
  type: Object as PropType<User>,
94
93
  },
94
+ notifications: {
95
+ default: undefined,
96
+ type: Object as PropType<NotificationsConfig>,
97
+ },
95
98
  dark: {
96
99
  default: false,
97
100
  type: Boolean,
@@ -51,6 +51,24 @@ export default {
51
51
  icon: 'heroicons:arrow-left-on-rectangle',
52
52
  },
53
53
  ],
54
+ notifications: {
55
+ footerTo: '/',
56
+ footerLabel: 'See all notifications',
57
+ items: [
58
+ {
59
+ id: '1',
60
+ text: 'You have a new message',
61
+ to: '/',
62
+ created_at: '2022-12-08T19:16:10Z',
63
+ },
64
+ {
65
+ id: '2',
66
+ text: 'Your inbox is now full. Please empty your inbox before it goes bang.',
67
+ to: '/',
68
+ created_at: '2022-01-01T00:00:00',
69
+ },
70
+ ],
71
+ },
54
72
  },
55
73
  };
56
74
 
@@ -22,19 +22,19 @@
22
22
  </div>
23
23
 
24
24
  <!-- Right -->
25
+ <div class="flex items-center md:ml-6">
26
+ <!-- Notification dropdown -->
27
+ <BaseLayoutNotificationDropdown
28
+ v-if="notifications"
29
+ class="mr-4 md:mr-5"
30
+ :dark="dark"
31
+ :notifications-config="notifications"
32
+ ></BaseLayoutNotificationDropdown>
25
33
 
26
- <div class="hidden md:ml-6 md:flex md:items-center">
27
34
  <!-- Profile dropdown -->
28
- <BaseMenu menu-class="w-52" :items="userMenu">
35
+ <BaseMenu menu-class="w-52" class="hidden md:block" :items="userMenu">
29
36
  <template #button="{ open }">
30
- <div
31
- class="flex rounded-full"
32
- :class="[
33
- open
34
- ? 'bg-slate-700 ring-2 ring-blue-500 ring-offset-2 ring-offset-slate-700'
35
- : '',
36
- ]"
37
- >
37
+ <div class="flex rounded-full" :class="[open ? '' : '']">
38
38
  <BaseAvatar :class="dark ? 'text-white' : ''" :user="user" />
39
39
  </div>
40
40
  </template>
@@ -88,12 +88,13 @@
88
88
  <script lang="ts" setup>
89
89
  import { User } from '@/types/User';
90
90
  import { PropType } from 'vue';
91
- import { ActionItem } from '../types/types';
91
+ import { ActionItem, NotificationsConfig } from '../types/types';
92
92
  import BaseAvatar from './BaseAvatar.vue';
93
93
  import BaseLayoutStacked from './BaseLayoutStacked.vue';
94
94
  import BaseMenu from './BaseMenu.vue';
95
95
  import BaseNavbarItem from './BaseNavbarItem.vue';
96
96
  import BaseNavbarSideItem from './BaseNavbarSideItem.vue';
97
+ import BaseLayoutNotificationDropdown from './BaseLayoutNotificationDropdown.vue';
97
98
 
98
99
  defineProps({
99
100
  appName: {
@@ -116,6 +117,10 @@ defineProps({
116
117
  required: true,
117
118
  type: Object as PropType<User>,
118
119
  },
120
+ notifications: {
121
+ default: undefined,
122
+ type: Object as PropType<NotificationsConfig>,
123
+ },
119
124
  dark: {
120
125
  default: false,
121
126
  type: Boolean,
@@ -1,5 +1,10 @@
1
1
  <template>
2
- <Menu v-slot="{ open }" as="div" class="relative text-left">
2
+ <Menu
3
+ v-slot="{ open }"
4
+ as="div"
5
+ class="text-left"
6
+ :class="[position == 'custom' ? 'static' : 'relative']"
7
+ >
3
8
  <div>
4
9
  <MenuButton class="flex">
5
10
  <slot name="button" :open="open" />
@@ -18,7 +23,7 @@
18
23
  :class="[menuClass, menuPositionClass]"
19
24
  class="absolute z-menu mt-2 rounded-md bg-white p-1 shadow-lg ring-1 ring-black ring-opacity-10 focus:outline-none"
20
25
  >
21
- <slot name="items">
26
+ <slot name="items" :items="items">
22
27
  <template v-for="item in items" :key="item.label + 'link'">
23
28
  <div v-if="item.line" class="my-1 -mx-1 flex h-px bg-gray-200" />
24
29
 
@@ -95,15 +100,18 @@ const props = defineProps({
95
100
  },
96
101
  menuClass: {
97
102
  default: 'w-48',
98
- type: String,
103
+ type: [String, Array, Object],
99
104
  },
100
105
  position: {
101
106
  default: 'bottom-left',
102
- type: String as PropType<'bottom-left' | 'bottom-right'>,
107
+ type: String as PropType<'bottom-left' | 'bottom-right' | 'custom'>,
103
108
  },
104
109
  });
105
110
 
106
111
  const menuPositionClass = computed(() => {
112
+ if (props.position == 'custom') {
113
+ return '';
114
+ }
107
115
  if (props.position == 'bottom-left') {
108
116
  return 'origin-top-right right-0';
109
117
  }
@@ -1,3 +1,4 @@
1
+ import BaseActionItem from './BaseActionItem.vue';
1
2
  import BaseAlert from './BaseAlert.vue';
2
3
  import BaseApp from './BaseApp.vue';
3
4
  import BaseAppDialogs from './BaseAppDialogs.vue';
@@ -66,6 +67,7 @@ import BaseLayoutSidebar from './BaseLayoutSidebar.vue';
66
67
  import BaseLayoutSidebarConfigurable from './BaseLayoutSidebarConfigurable.vue';
67
68
 
68
69
  export {
70
+ BaseActionItem,
69
71
  BaseAlert,
70
72
  BaseApp,
71
73
  BaseAppDialogs,
package/src/lang/en.json CHANGED
@@ -25,6 +25,7 @@
25
25
  "next_month": "Next month",
26
26
  "none": "None",
27
27
  "nothing_found": "Nothing found",
28
+ "notifications_empty": "You have no new notifications",
28
29
  "or": "or",
29
30
  "pagination_detail": "{page} records of {total}",
30
31
  "previous": "Previous",
@@ -33,6 +34,7 @@
33
34
  "remove": "Remove",
34
35
  "remove_file": "Remove file?",
35
36
  "remove_file_description": "Are you sure you want to remove the file? This action is irreversible.",
37
+ "see_all_notifications": "See all notifications",
36
38
  "select_an_item": "Select an item",
37
39
  "select_an_option": "Select an option",
38
40
  "success": "Success",
@@ -49,6 +51,7 @@
49
51
  "up_to_x": "Up to {x}",
50
52
  "upload_failed": "Upload failed",
51
53
  "whoops": "Whoops",
54
+ "x_ago": "{duration} ago",
52
55
  "x_rows_selected": "1 item selected | {count} items selected",
53
56
  "year": "Year",
54
57
  "yes_delete": "Yes, delete",
package/src/lang/fr.json CHANGED
@@ -25,6 +25,7 @@
25
25
  "next_month": "Mois prochain",
26
26
  "none": "Aucun",
27
27
  "nothing_found": "Rien n'a été trouvé",
28
+ "notifications_empty": "Vous n'avez aucune nouvelle notification",
28
29
  "or": "ou",
29
30
  "pagination_detail": "{page} items de {total}",
30
31
  "previous": "Précédent",
@@ -33,6 +34,7 @@
33
34
  "remove": "Retirer",
34
35
  "remove_file": "Retirer le fichier?",
35
36
  "remove_file_description": "Voulez-vous vraiment supprimer le fichier ? \nCette action est irréversible.",
37
+ "see_all_notifications": "Voir toutes les notifications",
36
38
  "select_an_item": "Sélectionner un élément",
37
39
  "select_an_option": "Sélectionner une option",
38
40
  "success": "Succès",
@@ -49,6 +51,7 @@
49
51
  "up_to_x": "Jusqu'à {x}",
50
52
  "upload_failed": "Le téléchargement a échoué",
51
53
  "whoops": "Oups",
54
+ "x_ago": "il y a {durée}",
52
55
  "x_rows_selected": "1 item sélectionné | \n{count} items sélectionnés",
53
56
  "year": "Année",
54
57
  "yes_delete": "Oui, supprimer",
@@ -0,0 +1,10 @@
1
+ import { RouteLocationRaw } from 'vue-router';
2
+
3
+ interface Notification {
4
+ id: string;
5
+ text: string;
6
+ to: RouteLocationRaw;
7
+ created_at?: string;
8
+ }
9
+
10
+ export { Notification };
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { RouteLocationRaw } from 'vue-router';
4
4
  import { UploadedFile } from './UploadedFile';
5
+ import { Notification as AppNotification } from './Notification';
5
6
 
6
7
  export interface Breadcrumb {
7
8
  icon?: string;
@@ -177,3 +178,13 @@ export interface Notification {
177
178
  color: 'info' | 'success' | 'danger' | 'warning';
178
179
  duration: number;
179
180
  }
181
+
182
+ /**
183
+ * App Notification
184
+ */
185
+
186
+ export interface NotificationsConfig {
187
+ items: AppNotification[];
188
+ footerLabel?: string;
189
+ footerTo?: RouteLocationRaw;
190
+ }