@falcondev-oss/nuxt-layers-base 0.30.1 → 0.31.0

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.
@@ -145,7 +145,13 @@ const columns = useTableColumns<typeof data>(
145
145
  ]"
146
146
  :user-menu="{
147
147
  name: 'Benjamin Canac',
148
- avatarSrc: 'https://github.com/benjamincanac.png',
148
+ avatar: { src: 'https://github.com/benjamincanac.png' },
149
+ items: [
150
+ {
151
+ icon: 'lucide:log-out',
152
+ label: 'Logout',
153
+ },
154
+ ],
149
155
  }"
150
156
  >
151
157
  <LayoutNavbar
@@ -1,5 +1,11 @@
1
1
  <script setup lang="ts">
2
- import type { DashboardSidebarProps, NavigationMenuItem, NavigationMenuProps } from '@nuxt/ui'
2
+ import type {
3
+ AvatarProps,
4
+ DashboardSidebarProps,
5
+ DropdownMenuItem,
6
+ NavigationMenuItem,
7
+ NavigationMenuProps,
8
+ } from '@nuxt/ui'
3
9
 
4
10
  defineProps<{
5
11
  sidebar?: DashboardSidebarProps
@@ -11,7 +17,8 @@ defineProps<{
11
17
  bottomItems?: NavigationMenuItem[]
12
18
  userMenu?: {
13
19
  name: string
14
- avatarSrc?: string
20
+ avatar?: AvatarProps
21
+ items: DropdownMenuItem[]
15
22
  }
16
23
  itemsUi?: NavigationMenuProps['ui']
17
24
  bottomItemsUi?: NavigationMenuProps['ui']
@@ -28,7 +35,17 @@ const config = useRuntimeConfig()
28
35
 
29
36
  <template>
30
37
  <UDashboardGroup storage="local" :storage-key="`${config.public.projectId}-dashboard`" unit="rem">
31
- <UDashboardSidebar v-bind="sidebar" class="bg-white" mode="drawer">
38
+ <UDashboardSidebar
39
+ v-bind="sidebar"
40
+ class="bg-white"
41
+ mode="drawer"
42
+ :default-size="16"
43
+ collapsible
44
+ :ui="{
45
+ header: 'border-b border-default',
46
+ footer: 'border-t border-default',
47
+ }"
48
+ >
32
49
  <template
33
50
  v-if="logo?.src || logo?.iconSrc || slots.logo || slots.icon"
34
51
  #header="{ collapsed }"
@@ -66,19 +83,30 @@ const config = useRuntimeConfig()
66
83
  />
67
84
  </template>
68
85
  <template v-if="userMenu" #footer="{ collapsed }">
69
- <UButton
70
- :label="collapsed ? undefined : userMenu.name"
71
- :avatar="{
72
- src: userMenu.avatarSrc,
73
- alt: userMenu.name,
74
- }"
75
- color="neutral"
76
- variant="ghost"
77
- class="w-full"
78
- :block="collapsed"
79
- />
86
+ <UDropdownMenu :items="userMenu.items">
87
+ <UButton
88
+ :label="collapsed ? undefined : userMenu.name"
89
+ :trailing-icon="collapsed ? undefined : 'ph:caret-up-down'"
90
+ :icon="userMenu.avatar ? undefined : 'lucide:user-round'"
91
+ :avatar="userMenu.avatar"
92
+ color="neutral"
93
+ variant="ghost"
94
+ block
95
+ :square="collapsed"
96
+ class="data-[state=open]:bg-elevated"
97
+ :ui="{
98
+ leadingIcon: 'text-accented',
99
+ trailingIcon: 'text-dimmed',
100
+ }"
101
+ />
102
+ </UDropdownMenu>
80
103
  </template>
81
104
  </UDashboardSidebar>
82
- <slot />
105
+
106
+ <div class="relative w-full">
107
+ <Suspense>
108
+ <slot />
109
+ </Suspense>
110
+ </div>
83
111
  </UDashboardGroup>
84
112
  </template>
@@ -7,7 +7,8 @@ export function useRouteParamString(paramName: string) {
7
7
  const stop = watch(
8
8
  param,
9
9
  () => {
10
- if (typeof param.value !== 'string') throw new Error(`${paramName} must be string`)
10
+ if (typeof param.value !== 'string')
11
+ throw new Error(`Route parameter '[${paramName}]' must be a string`)
11
12
  paramRef.value = param.value
12
13
  },
13
14
  { immediate: true },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@falcondev-oss/nuxt-layers-base",
3
3
  "type": "module",
4
- "version": "0.30.1",
4
+ "version": "0.31.0",
5
5
  "description": "Nuxt layer with lots of useful helpers and @nuxt/ui components",
6
6
  "license": "MIT",
7
7
  "repository": "github:falcondev-oss/nuxt-layers",