@bjj/nuxt-layer-shadcn-ui 0.13.4 → 0.13.6

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.
@@ -4,7 +4,6 @@ import {
4
4
  SidebarMenu,
5
5
  SidebarMenuButton,
6
6
  SidebarMenuItem,
7
- useSidebar,
8
7
  } from '../../shadcn/sidebar'
9
8
 
10
9
  const props = defineProps<{
@@ -12,8 +11,6 @@ const props = defineProps<{
12
11
  menuItems?: AdminLayoutSidebarDropdownMenuItem[]
13
12
  }>()
14
13
 
15
- const { isMobile } = useSidebar()
16
-
17
14
  // 'profile' items render through the 'profile' slot: clickable (`custom-action`,
18
15
  // padding reset so the slot owns it) when it has a `command`, else a label.
19
16
  const dropdownItems = computed<DropdownItem[]>(() =>
@@ -35,8 +32,7 @@ const dropdownItems = computed<DropdownItem[]>(() =>
35
32
  <Dropdown
36
33
  :menus="dropdownItems"
37
34
  trigger="click"
38
- :side="isMobile ? 'bottom' : 'right'"
39
- align="start"
35
+ align="end"
40
36
  :sideOffset="4"
41
37
  class="min-w-56 rounded-lg"
42
38
  >
@@ -123,7 +123,10 @@ const handleItemAction = (
123
123
  >
124
124
  <ItemContent :item="menu" />
125
125
  </DropdownMenuSubTrigger>
126
- <DropdownMenuSubContent :style="ctx?.contentStyle.value">
126
+ <DropdownMenuSubContent
127
+ :style="ctx?.contentStyle.value"
128
+ :collisionPadding="ctx?.collisionPadding.value"
129
+ >
127
130
  <MenuItems :menus="menu.subMenus" />
128
131
  </DropdownMenuSubContent>
129
132
  </DropdownMenuSub>
@@ -112,6 +112,7 @@ const meta = {
112
112
  side: { control: 'select', options: sides },
113
113
  align: { control: 'select', options: aligns },
114
114
  sideOffset: { control: 'number' },
115
+ collisionPadding: { control: 'number' },
115
116
  minWidth: { control: 'text' },
116
117
  },
117
118
  args: {
@@ -120,6 +121,7 @@ const meta = {
120
121
  side: undefined,
121
122
  align: undefined,
122
123
  sideOffset: undefined,
124
+ collisionPadding: undefined,
123
125
  minWidth: undefined,
124
126
  },
125
127
  render: args => ({
@@ -12,6 +12,7 @@ defineOptions({ inheritAttrs: false })
12
12
  const props = withDefaults(defineProps<DropdownProps>(), {
13
13
  menus: () => [],
14
14
  trigger: 'hover',
15
+ collisionPadding: 8,
15
16
  class: undefined,
16
17
  minWidth: undefined,
17
18
  })
@@ -80,6 +81,7 @@ provide(dropdownContextKey, {
80
81
  hide,
81
82
  slots,
82
83
  contentStyle,
84
+ collisionPadding: computed(() => props.collisionPadding),
83
85
  })
84
86
 
85
87
  onBeforeUnmount(() => {
@@ -103,6 +105,7 @@ onBeforeUnmount(() => {
103
105
  v-bind="$attrs"
104
106
  :class="props.class"
105
107
  :style="contentStyle"
108
+ :collisionPadding="collisionPadding"
106
109
  @mouseenter="handleMenuEnter"
107
110
  @mouseleave="handleMenuLeave"
108
111
  >
@@ -104,6 +104,8 @@ export interface DropdownProps extends /* @vue-ignore */ DropdownMenuContentProp
104
104
  menus?: DropdownItem[]
105
105
  /** Trigger mode for showing the dropdown. Defaults to 'hover'. */
106
106
  trigger?: 'click' | 'hover'
107
+ /** Gap kept from the viewport edges when repositioning on collision. Applies to the root content and all sub-menus. Defaults to 8. */
108
+ collisionPadding?: DropdownMenuContentProps['collisionPadding']
107
109
  /** Extra class for the dropdown content container. */
108
110
  class?: ClassValue
109
111
  /** Min-width applied to the root content and all sub-menus. Numbers are treated as px. */
@@ -118,6 +120,8 @@ export interface DropdownContext {
118
120
  slots: Slots
119
121
  /** Inline style applied to root content and all sub-menus (currently min-width). */
120
122
  contentStyle: ComputedRef<{ minWidth?: string } | undefined>
123
+ /** Collision padding applied to root content and all sub-menus. */
124
+ collisionPadding: ComputedRef<DropdownMenuContentProps['collisionPadding']>
121
125
  }
122
126
 
123
127
  /** Provide/inject key for the shared DropdownContext. */
@@ -11,12 +11,14 @@ const meta = {
11
11
  side: { control: 'select', options: [ 'top', 'bottom', 'left', 'right' ]},
12
12
  align: { control: 'select', options: [ 'start', 'center', 'end' ]},
13
13
  sideOffset: { control: 'number' },
14
+ collisionPadding: { control: 'number' },
14
15
  },
15
16
  args: {
16
17
  trigger: 'click',
17
18
  side: undefined,
18
19
  align: undefined,
19
20
  sideOffset: undefined,
21
+ collisionPadding: undefined,
20
22
  },
21
23
  render: args => ({
22
24
  components: { Popover, Button },
@@ -10,6 +10,7 @@ defineOptions({ inheritAttrs: false })
10
10
 
11
11
  const props = withDefaults(defineProps<PopoverProps>(), {
12
12
  trigger: 'click',
13
+ collisionPadding: 8,
13
14
  class: undefined,
14
15
  })
15
16
 
@@ -80,6 +81,7 @@ onBeforeUnmount(() => {
80
81
  <PopoverContent
81
82
  v-bind="$attrs"
82
83
  :class="props.class"
84
+ :collisionPadding="collisionPadding"
83
85
  @mouseenter="handleContentEnter"
84
86
  @mouseleave="handleContentLeave"
85
87
  >
@@ -3,6 +3,8 @@ import type { PopoverContentProps } from 'reka-ui'
3
3
  export interface PopoverProps extends /* @vue-ignore */ PopoverContentProps {
4
4
  /** Trigger mode for showing the popover. Defaults to 'click'. */
5
5
  trigger?: 'click' | 'hover'
6
+ /** Gap kept from the viewport edges when repositioning on collision. Defaults to 8. */
7
+ collisionPadding?: PopoverContentProps['collisionPadding']
6
8
  /** Extra class for the popover content container. */
7
9
  class?: ClassValue
8
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bjj/nuxt-layer-shadcn-ui",
3
- "version": "0.13.4",
3
+ "version": "0.13.6",
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": "aa52d8ae39f985ab89d0533a53f8f10d8b437561"
45
+ "gitHead": "c8b20a45c6233735ffdb456f3c9d33d81821addb"
46
46
  }