@bjj/nuxt-layer-shadcn-ui 0.13.1 → 0.13.2

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. Shown in every state; on a collapsed sidebar it is
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
- Brand row. Expanded: [logo + name] on the left, collapse toggle on the right.
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
- // 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.
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
- <ChevronsUpDown class="size-4 ml-auto" />
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 class="gap-2 px-1 py-1.5 text-sm flex items-center text-left">
78
+ <div
79
+ class="gap-2 px-1 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
- <ChevronsUpDown
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>
@@ -78,7 +78,7 @@ const menus: AdminLayoutSidebarMenuItem[] = [
78
78
  // and preference sub-menus live inside the menu. The profile item carries a
79
79
  // `command`, so it is clickable (opens a workspace switcher).
80
80
  const menuItems: AdminLayoutSidebarDropdownMenuItem[] = [
81
- { type: 'profile', icon: 'building-2', title: 'Acme Inc.', subtitle: 'Owner', command: () => {} },
81
+ { type: 'profile', icon: 'building-2', title: 'Acme Inc.', subtitle: 'Owner', command: () => {}, actionIcon: 'arrow-left-right' },
82
82
  { type: 'separator' },
83
83
  { type: 'action', label: 'Change Password', icon: 'lock-keyhole', command: () => {} },
84
84
  { type: 'separator' },
@@ -108,6 +108,7 @@ const menuItems: AdminLayoutSidebarDropdownMenuItem[] = [
108
108
  const profile: AdminLayoutSidebarDropdownProfile = {
109
109
  title: 'Demo User',
110
110
  subtitle: 'demo@example.com',
111
+ actionIcon: 'chevrons-up-down',
111
112
  }
112
113
 
113
114
  const layoutContent = `
@@ -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
- * Menu item for the SidebarDropdown.
24
- *
25
- * Union of Dropdown's DropdownItem with an extra 'profile' variant that renders
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.1",
3
+ "version": "0.13.2",
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": "42a4cad8de149d6e77b16e1d76ed5d3671498b79"
45
+ "gitHead": "d58825867361704b209b34458f063c28f8af47c3"
46
46
  }