@bjj/nuxt-layer-shadcn-ui 0.13.1 → 0.13.3
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.
|
@@ -7,8 +7,7 @@ defineProps<{
|
|
|
7
7
|
}>()
|
|
8
8
|
|
|
9
9
|
defineSlots<{
|
|
10
|
-
/** Brand logo/mark.
|
|
11
|
-
replaced by the collapse toggle on hover. */
|
|
10
|
+
/** Brand logo/mark. */
|
|
12
11
|
logo?: () => any
|
|
13
12
|
}>()
|
|
14
13
|
|
|
@@ -22,13 +21,8 @@ const toggleLabel = computed(() =>
|
|
|
22
21
|
</script>
|
|
23
22
|
|
|
24
23
|
<template>
|
|
25
|
-
<!--
|
|
26
|
-
|
|
27
|
-
Collapsed (`data-collapsible=icon` on the sidebar root): only the logo shows,
|
|
28
|
-
centered; hovering the row swaps it for the toggle so the sidebar can be
|
|
29
|
-
re-expanded. The toggle keeps capturing clicks even while transparent, so a
|
|
30
|
-
click anywhere on the collapsed brand expands the sidebar.
|
|
31
|
-
-->
|
|
24
|
+
<!-- Collapsed: only the logo shows; hovering swaps it for the toggle (which
|
|
25
|
+
stays clickable while transparent, so the whole row re-expands). -->
|
|
32
26
|
<div
|
|
33
27
|
class="
|
|
34
28
|
group/brand h-8 gap-2 relative flex items-center
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { AdminLayoutSidebarDropdownProfile, AdminLayoutSidebarDropdownMenuItem } from './types'
|
|
3
|
-
import { ChevronsUpDown } from 'lucide-vue-next'
|
|
4
3
|
import {
|
|
5
4
|
SidebarMenu,
|
|
6
5
|
SidebarMenuButton,
|
|
@@ -15,9 +14,8 @@ const props = defineProps<{
|
|
|
15
14
|
|
|
16
15
|
const { isMobile } = useSidebar()
|
|
17
16
|
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
// otherwise it stays a static label. Other items pass through unchanged.
|
|
17
|
+
// 'profile' items render through the 'profile' slot: clickable (`custom-action`,
|
|
18
|
+
// padding reset so the slot owns it) when it has a `command`, else a label.
|
|
21
19
|
const dropdownItems = computed<DropdownItem[]>(() =>
|
|
22
20
|
(props.menuItems ?? []).map(item => {
|
|
23
21
|
if (item.type === 'profile') {
|
|
@@ -69,11 +67,17 @@ const dropdownItems = computed<DropdownItem[]>(() =>
|
|
|
69
67
|
{{ profile?.subtitle }}
|
|
70
68
|
</span>
|
|
71
69
|
</div>
|
|
72
|
-
<
|
|
70
|
+
<Icon
|
|
71
|
+
v-if="profile?.actionIcon"
|
|
72
|
+
:name="profile.actionIcon"
|
|
73
|
+
class="size-4 ml-auto shrink-0"
|
|
74
|
+
/>
|
|
73
75
|
</SidebarMenuButton>
|
|
74
76
|
|
|
75
77
|
<template #profile="{ item }">
|
|
76
|
-
<div
|
|
78
|
+
<div
|
|
79
|
+
class="gap-2 px-2 py-1.5 text-sm flex w-full items-center text-left"
|
|
80
|
+
>
|
|
77
81
|
<Avatar
|
|
78
82
|
:image="item.icon ? undefined : (item.image || undefined)"
|
|
79
83
|
:fallbackLabel="item.icon ? undefined : item.title?.charAt(0)?.toUpperCase()"
|
|
@@ -97,8 +101,9 @@ const dropdownItems = computed<DropdownItem[]>(() =>
|
|
|
97
101
|
{{ item.subtitle }}
|
|
98
102
|
</span>
|
|
99
103
|
</div>
|
|
100
|
-
<
|
|
101
|
-
v-if="item.command"
|
|
104
|
+
<Icon
|
|
105
|
+
v-if="item.command && item.actionIcon"
|
|
106
|
+
:name="item.actionIcon"
|
|
102
107
|
class="size-4 text-muted-foreground ml-auto shrink-0"
|
|
103
108
|
/>
|
|
104
109
|
</div>
|
|
@@ -74,11 +74,9 @@ const menus: AdminLayoutSidebarMenuItem[] = [
|
|
|
74
74
|
},
|
|
75
75
|
]
|
|
76
76
|
|
|
77
|
-
// Footer dropdown: the
|
|
78
|
-
// and preference sub-menus live inside the menu. The profile item carries a
|
|
79
|
-
// `command`, so it is clickable (opens a workspace switcher).
|
|
77
|
+
// Footer dropdown menu: the profile carries a `command`, so it is clickable.
|
|
80
78
|
const menuItems: AdminLayoutSidebarDropdownMenuItem[] = [
|
|
81
|
-
{ type: 'profile', icon: 'building-2', title: 'Acme Inc.', subtitle: 'Owner', command: () => {} },
|
|
79
|
+
{ type: 'profile', icon: 'building-2', title: 'Acme Inc.', subtitle: 'Owner', command: () => {}, actionIcon: 'arrow-left-right' },
|
|
82
80
|
{ type: 'separator' },
|
|
83
81
|
{ type: 'action', label: 'Change Password', icon: 'lock-keyhole', command: () => {} },
|
|
84
82
|
{ type: 'separator' },
|
|
@@ -108,6 +106,7 @@ const menuItems: AdminLayoutSidebarDropdownMenuItem[] = [
|
|
|
108
106
|
const profile: AdminLayoutSidebarDropdownProfile = {
|
|
109
107
|
title: 'Demo User',
|
|
110
108
|
subtitle: 'demo@example.com',
|
|
109
|
+
actionIcon: 'chevrons-up-down',
|
|
111
110
|
}
|
|
112
111
|
|
|
113
112
|
const layoutContent = `
|
|
@@ -218,8 +217,7 @@ export const Inset: Story = {
|
|
|
218
217
|
},
|
|
219
218
|
}
|
|
220
219
|
|
|
221
|
-
//
|
|
222
|
-
// drawer and the floating trigger (top-left) becomes the way to open it.
|
|
220
|
+
// Phone viewport: the sidebar collapses into the drawer opened by the floating trigger.
|
|
223
221
|
export const Mobile: Story = {
|
|
224
222
|
parameters: {
|
|
225
223
|
...noControls,
|
|
@@ -17,15 +17,14 @@ export interface AdminLayoutSidebarDropdownProfile {
|
|
|
17
17
|
subtitle?: string
|
|
18
18
|
icon?: string | Component
|
|
19
19
|
image?: string
|
|
20
|
+
/** Trailing affordance icon (lucide name or component). Omitted → not rendered. */
|
|
21
|
+
actionIcon?: string | Component
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
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).
|
|
25
|
+
* A DropdownItem, or a 'profile' variant rendering an avatar + title + subtitle.
|
|
26
|
+
* With a `command` the profile is clickable (shows its `actionIcon`); without,
|
|
27
|
+
* it is a static label.
|
|
29
28
|
*/
|
|
30
29
|
export type AdminLayoutSidebarDropdownMenuItem
|
|
31
30
|
= | DropdownItem
|
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.3",
|
|
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": "02d6b4c35baefc4092632af1aa21c969c007b779"
|
|
46
46
|
}
|