@bjj/nuxt-layer-shadcn-ui 0.13.0 → 0.13.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.
|
@@ -15,13 +15,16 @@ const props = defineProps<{
|
|
|
15
15
|
|
|
16
16
|
const { isMobile } = useSidebar()
|
|
17
17
|
|
|
18
|
-
//
|
|
19
|
-
//
|
|
18
|
+
// Render 'profile' items via the 'profile' slot. A profile with a `command`
|
|
19
|
+
// becomes a clickable item (`custom-action`, padding reset so the slot owns it);
|
|
20
|
+
// otherwise it stays a static label. Other items pass through unchanged.
|
|
20
21
|
const dropdownItems = computed<DropdownItem[]>(() =>
|
|
21
22
|
(props.menuItems ?? []).map(item => {
|
|
22
23
|
if (item.type === 'profile') {
|
|
23
|
-
const { type: _, ...rest } = item
|
|
24
|
-
return
|
|
24
|
+
const { type: _, command, ...rest } = item
|
|
25
|
+
return command
|
|
26
|
+
? { type: 'custom-action', slot: 'profile', command, ...rest, class: 'p-0' }
|
|
27
|
+
: { type: 'custom-label', slot: 'profile', ...rest }
|
|
25
28
|
}
|
|
26
29
|
return item
|
|
27
30
|
}),
|
|
@@ -58,19 +61,19 @@ const dropdownItems = computed<DropdownItem[]>(() =>
|
|
|
58
61
|
class="size-4"
|
|
59
62
|
/>
|
|
60
63
|
</Avatar>
|
|
61
|
-
<div class="grid flex-1 text-left
|
|
62
|
-
<span class="
|
|
64
|
+
<div class="text-sm/tight grid flex-1 text-left">
|
|
65
|
+
<span class="font-medium truncate">
|
|
63
66
|
{{ profile?.title }}
|
|
64
67
|
</span>
|
|
65
|
-
<span class="
|
|
68
|
+
<span class="text-xs truncate">
|
|
66
69
|
{{ profile?.subtitle }}
|
|
67
70
|
</span>
|
|
68
71
|
</div>
|
|
69
|
-
<ChevronsUpDown class="ml-auto
|
|
72
|
+
<ChevronsUpDown class="size-4 ml-auto" />
|
|
70
73
|
</SidebarMenuButton>
|
|
71
74
|
|
|
72
75
|
<template #profile="{ item }">
|
|
73
|
-
<div class="
|
|
76
|
+
<div class="gap-2 px-1 py-1.5 text-sm flex items-center text-left">
|
|
74
77
|
<Avatar
|
|
75
78
|
:image="item.icon ? undefined : (item.image || undefined)"
|
|
76
79
|
:fallbackLabel="item.icon ? undefined : item.title?.charAt(0)?.toUpperCase()"
|
|
@@ -83,17 +86,21 @@ const dropdownItems = computed<DropdownItem[]>(() =>
|
|
|
83
86
|
class="size-4"
|
|
84
87
|
/>
|
|
85
88
|
</Avatar>
|
|
86
|
-
<div class="grid flex-1 text-left
|
|
87
|
-
<span class="
|
|
89
|
+
<div class="text-sm/tight grid flex-1 text-left">
|
|
90
|
+
<span class="font-semibold truncate">
|
|
88
91
|
{{ item.title }}
|
|
89
92
|
</span>
|
|
90
93
|
<span
|
|
91
94
|
v-if="item.subtitle"
|
|
92
|
-
class="
|
|
95
|
+
class="text-xs truncate"
|
|
93
96
|
>
|
|
94
97
|
{{ item.subtitle }}
|
|
95
98
|
</span>
|
|
96
99
|
</div>
|
|
100
|
+
<ChevronsUpDown
|
|
101
|
+
v-if="item.command"
|
|
102
|
+
class="size-4 text-muted-foreground ml-auto shrink-0"
|
|
103
|
+
/>
|
|
97
104
|
</div>
|
|
98
105
|
</template>
|
|
99
106
|
</Dropdown>
|
|
@@ -75,12 +75,11 @@ const menus: AdminLayoutSidebarMenuItem[] = [
|
|
|
75
75
|
]
|
|
76
76
|
|
|
77
77
|
// Footer dropdown: the trigger shows the signed-in user; the workspace/org info
|
|
78
|
-
// and preference sub-menus live inside the menu.
|
|
78
|
+
// and preference sub-menus live inside the menu. The profile item carries a
|
|
79
|
+
// `command`, so it is clickable (opens a workspace switcher).
|
|
79
80
|
const menuItems: AdminLayoutSidebarDropdownMenuItem[] = [
|
|
80
|
-
{ type: 'profile', icon: 'building-2', title: 'Acme Inc.', subtitle: 'Owner' },
|
|
81
|
-
{ type: 'action', label: 'Switch Workspace', icon: 'arrow-left-right', command: () => {} },
|
|
81
|
+
{ type: 'profile', icon: 'building-2', title: 'Acme Inc.', subtitle: 'Owner', command: () => {} },
|
|
82
82
|
{ type: 'separator' },
|
|
83
|
-
{ type: 'label', label: 'Account' },
|
|
84
83
|
{ type: 'action', label: 'Change Password', icon: 'lock-keyhole', command: () => {} },
|
|
85
84
|
{ type: 'separator' },
|
|
86
85
|
{
|
|
@@ -23,11 +23,13 @@ export interface AdminLayoutSidebarDropdownProfile {
|
|
|
23
23
|
* Menu item for the SidebarDropdown.
|
|
24
24
|
*
|
|
25
25
|
* Union of Dropdown's DropdownItem with an extra 'profile' variant that renders
|
|
26
|
-
* a profile header (avatar + title + subtitle)
|
|
26
|
+
* a profile header (avatar + title + subtitle) inside the menu. Without a
|
|
27
|
+
* `command` it is a static label; with one it becomes a clickable item (the
|
|
28
|
+
* profile is rendered with a trailing switch affordance).
|
|
27
29
|
*/
|
|
28
30
|
export type AdminLayoutSidebarDropdownMenuItem
|
|
29
31
|
= | DropdownItem
|
|
30
|
-
| ({ type: 'profile' } & AdminLayoutSidebarDropdownProfile)
|
|
32
|
+
| ({ type: 'profile', command?: () => void } & AdminLayoutSidebarDropdownProfile)
|
|
31
33
|
|
|
32
34
|
export interface AdminLayoutSidebarDropdownConfig {
|
|
33
35
|
profile?: AdminLayoutSidebarDropdownProfile | null
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bjj/nuxt-layer-shadcn-ui",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "Nuxt layer providing shadcn-vue based UI components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./nuxt.config.ts",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"vue-i18n": "^11",
|
|
43
43
|
"vue-router": "^4 || ^5"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "42a4cad8de149d6e77b16e1d76ed5d3671498b79"
|
|
46
46
|
}
|