File tree Expand file tree Collapse file tree 14 files changed +290
-2
lines changed
playground/app/pages/components Expand file tree Collapse file tree 14 files changed +290
-2
lines changed Original file line number Diff line number Diff line change @@ -116,5 +116,47 @@ defineShortcuts(extractShortcuts(items.value))
116
116
Color right click here
117
117
</div >
118
118
</UContextMenu >
119
+
120
+ <UContextMenu :items =" itemsWithColor" :ui =" { content: 'w-48' }" :size =" size" >
121
+ <div class =" flex items-center justify-center rounded-md border border-dashed border-(--ui-border-accented) text-sm aspect-video w-72" >
122
+ With list slots
123
+ </div >
124
+
125
+ <template #list-leading >
126
+ <div class =" p-1" >
127
+ <UButtonGroup
128
+ size =" xs"
129
+ class =" w-full"
130
+ orientation =" horizontal"
131
+ >
132
+ <UButton
133
+ label =" OR"
134
+ color =" primary"
135
+ block
136
+ size =" xs"
137
+ class =" flex-1"
138
+ />
139
+ <UButton
140
+ label =" AND"
141
+ color =" neutral"
142
+ variant =" subtle"
143
+ block
144
+ size =" xs"
145
+ class =" flex-1"
146
+ />
147
+ </UButtonGroup >
148
+ </div >
149
+ </template >
150
+
151
+ <template #list-trailing >
152
+ <div class =" p-1" >
153
+ <UButton
154
+ block
155
+ variant =" ghost"
156
+ label =" Load more"
157
+ />
158
+ </div >
159
+ </template >
160
+ </UContextMenu >
119
161
</div >
120
162
</template >
Original file line number Diff line number Diff line change @@ -151,6 +151,46 @@ defineShortcuts(extractShortcuts(items.value))
151
151
<UDropdownMenu :items =" itemsWithColor" :size =" size" arrow :content =" { side: 'bottom', align: 'start' }" :ui =" { content: 'w-48' }" >
152
152
<UButton label =" Color" color =" neutral" variant =" outline" icon =" i-lucide-menu" />
153
153
</UDropdownMenu >
154
+
155
+ <UDropdownMenu :items =" itemsWithColor" :size =" size" arrow :content =" { side: 'bottom', align: 'start' }" :ui =" { content: 'w-48' }" >
156
+ <UButton label =" With list slots" color =" neutral" variant =" outline" icon =" i-lucide-menu" />
157
+
158
+ <template #list-leading >
159
+ <div class =" p-1" >
160
+ <UButtonGroup
161
+ size =" xs"
162
+ class =" w-full"
163
+ orientation =" horizontal"
164
+ >
165
+ <UButton
166
+ label =" OR"
167
+ color =" primary"
168
+ block
169
+ size =" xs"
170
+ class =" flex-1"
171
+ />
172
+ <UButton
173
+ label =" AND"
174
+ color =" neutral"
175
+ variant =" subtle"
176
+ block
177
+ size =" xs"
178
+ class =" flex-1"
179
+ />
180
+ </UButtonGroup >
181
+ </div >
182
+ </template >
183
+
184
+ <template #list-trailing >
185
+ <div class =" p-1" >
186
+ <UButton
187
+ block
188
+ variant =" ghost"
189
+ label =" Load more"
190
+ />
191
+ </div >
192
+ </template >
193
+ </UDropdownMenu >
154
194
</div >
155
195
</div >
156
196
</template >
Original file line number Diff line number Diff line change @@ -145,5 +145,51 @@ const { data: users, status } = await useFetch('https://jsonplaceholder.typicode
145
145
class =" w-48"
146
146
/>
147
147
</div >
148
+ <div class =" flex items-center gap-4" >
149
+ <UInputMenu
150
+ :items =" items"
151
+ :model-value =" []"
152
+ multiple
153
+ icon =" i-lucide-search"
154
+ placeholder =" With list slots..."
155
+ class =" w-48"
156
+ >
157
+ <template #list-leading >
158
+ <div class =" p-1" >
159
+ <UButtonGroup
160
+ size =" xs"
161
+ class =" w-full"
162
+ orientation =" horizontal"
163
+ >
164
+ <UButton
165
+ label =" OR"
166
+ color =" primary"
167
+ block
168
+ size =" xs"
169
+ class =" flex-1"
170
+ />
171
+ <UButton
172
+ label =" AND"
173
+ color =" neutral"
174
+ variant =" subtle"
175
+ block
176
+ size =" xs"
177
+ class =" flex-1"
178
+ />
179
+ </UButtonGroup >
180
+ </div >
181
+ </template >
182
+
183
+ <template #list-trailing >
184
+ <div class =" p-1" >
185
+ <UButton
186
+ block
187
+ variant =" ghost"
188
+ label =" Load more"
189
+ />
190
+ </div >
191
+ </template >
192
+ </UInputMenu >
193
+ </div >
148
194
</div >
149
195
</template >
Original file line number Diff line number Diff line change @@ -114,6 +114,20 @@ const items = [
114
114
:highlight-color =" highlightColor"
115
115
:class =" highlight && 'data-[orientation=horizontal]:border-b border-(--ui-border)'"
116
116
class =" data-[orientation=vertical]:data-[collapsed=false]:w-48"
117
- />
117
+ >
118
+ <template #list-leading >
119
+ <img src =" /favicon.ico" >
120
+ </template >
121
+
122
+ <template #list-trailing >
123
+ <UModal >
124
+ <UButton label =" Login" />
125
+
126
+ <template #body >
127
+ <USkeleton class =" h-20" />
128
+ </template >
129
+ </UModal >
130
+ </template >
131
+ </UNavigationMenu >
118
132
</div >
119
133
</template >
Original file line number Diff line number Diff line change @@ -138,5 +138,51 @@ const { data: users, status } = await useFetch('https://jsonplaceholder.typicode
138
138
</template >
139
139
</USelectMenu >
140
140
</div >
141
+ <div class =" flex items-center gap-4" >
142
+ <USelectMenu
143
+ :items =" statuses.slice(0, 3)"
144
+ :loading =" status === 'pending'"
145
+ icon =" lucide:list"
146
+ placeholder =" With list slots..."
147
+ class =" w-48"
148
+ value-key =" value"
149
+ >
150
+ <template #list-leading >
151
+ <div class =" p-1" >
152
+ <UButtonGroup
153
+ size =" xs"
154
+ class =" w-full"
155
+ orientation =" horizontal"
156
+ >
157
+ <UButton
158
+ label =" OR"
159
+ color =" primary"
160
+ block
161
+ size =" xs"
162
+ class =" flex-1"
163
+ />
164
+ <UButton
165
+ label =" AND"
166
+ color =" neutral"
167
+ variant =" subtle"
168
+ block
169
+ size =" xs"
170
+ class =" flex-1"
171
+ />
172
+ </UButtonGroup >
173
+ </div >
174
+ </template >
175
+
176
+ <template #list-trailing >
177
+ <div class =" p-1" >
178
+ <UButton
179
+ block
180
+ variant =" ghost"
181
+ label =" Load more"
182
+ />
183
+ </div >
184
+ </template >
185
+ </USelectMenu >
186
+ </div >
141
187
</div >
142
188
</template >
Original file line number Diff line number Diff line change @@ -139,5 +139,51 @@ function getUserAvatar(value: string) {
139
139
</template >
140
140
</USelect >
141
141
</div >
142
+ <div class =" flex items-center gap-4" >
143
+ <USelect
144
+ :items =" statuses.slice(0, 3)"
145
+ :loading =" status === 'pending'"
146
+ icon =" lucide:list"
147
+ placeholder =" With list slots..."
148
+ class =" w-48"
149
+ value-key =" value"
150
+ >
151
+ <template #list-leading >
152
+ <div class =" p-1" >
153
+ <UButtonGroup
154
+ size =" xs"
155
+ class =" w-full"
156
+ orientation =" horizontal"
157
+ >
158
+ <UButton
159
+ label =" OR"
160
+ color =" primary"
161
+ block
162
+ size =" xs"
163
+ class =" flex-1"
164
+ />
165
+ <UButton
166
+ label =" AND"
167
+ color =" neutral"
168
+ variant =" subtle"
169
+ block
170
+ size =" xs"
171
+ class =" flex-1"
172
+ />
173
+ </UButtonGroup >
174
+ </div >
175
+ </template >
176
+
177
+ <template #list-trailing >
178
+ <div class =" p-1" >
179
+ <UButton
180
+ block
181
+ variant =" ghost"
182
+ label =" Load more"
183
+ />
184
+ </div >
185
+ </template >
186
+ </USelect >
187
+ </div >
142
188
</div >
143
189
</template >
Original file line number Diff line number Diff line change @@ -90,6 +90,8 @@ export type ContextMenuSlots<
90
90
'item-leading': SlotProps<T>
91
91
'item-label': SlotProps<T>
92
92
'item-trailing': SlotProps<T>
93
+ 'list-leading': (props?: {}) => any
94
+ 'list-trailing': (props?: {}) => any
93
95
} & DynamicSlots<MergeTypes<T>, 'leading' | 'label' | 'trailing', { active?: boolean, index: number }>
94
96
95
97
</script>
@@ -141,9 +143,17 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.contextMenu
141
143
:loading-icon="loadingIcon"
142
144
:external-icon="externalIcon"
143
145
>
146
+ <template #list-leading>
147
+ <slot name="list-leading" />
148
+ </template>
149
+
144
150
<template v-for="(_, name) in proxySlots" #[name]="slotData">
145
151
<slot :name="(name as keyof ContextMenuSlots<T>)" v-bind="slotData" />
146
152
</template>
153
+
154
+ <template #list-trailing>
155
+ <slot name="list-trailing" />
156
+ </template>
147
157
</UContextMenuContent>
148
158
</ContextMenuRoot>
149
159
</template>
Original file line number Diff line number Diff line change @@ -105,6 +105,8 @@ const groups = computed<ContextMenuItem[][]>(() =>
105
105
106
106
<ContextMenu .Portal :disabled =" !portal" >
107
107
<component :is =" sub ? ContextMenu.SubContent : ContextMenu.Content" :class =" props.class" v-bind =" contentProps" >
108
+ <slot name =" list-leading" />
109
+
108
110
<ContextMenu .Group v-for =" (group, groupIndex) in groups" :key =" `group-${groupIndex}`" :class =" ui.group({ class: uiOverride?.group })" >
109
111
<template v-for =" (item , index ) in group " :key =" ` group-${groupIndex }-${index } ` " >
110
112
<ContextMenu .Label v-if =" item.type === 'label'" :class =" ui.label({ class: uiOverride?.label })" >
@@ -169,6 +171,8 @@ const groups = computed<ContextMenuItem[][]>(() =>
169
171
</ContextMenu .Group >
170
172
171
173
<slot />
174
+
175
+ <slot name =" list-trailing" />
172
176
</component >
173
177
</ContextMenu .Portal >
174
178
</template >
Original file line number Diff line number Diff line change @@ -98,6 +98,8 @@ export type DropdownMenuSlots<
98
98
'item-leading': SlotProps<T>
99
99
'item-label': SlotProps<T>
100
100
'item-trailing': SlotProps<T>
101
+ 'list-leading': (props?: {}) => any
102
+ 'list-trailing': (props?: {}) => any
101
103
} & DynamicSlots<MergeTypes<T>, 'leading' | 'label' | 'trailing', { active?: boolean, index: number }>
102
104
103
105
</script>
@@ -151,10 +153,18 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.dropdownMenu
151
153
:loading-icon="loadingIcon"
152
154
:external-icon="externalIcon"
153
155
>
156
+ <template #list-leading>
157
+ <slot name="list-leading" />
158
+ </template>
159
+
154
160
<template v-for="(_, name) in proxySlots" #[name]="slotData">
155
161
<slot :name="(name as keyof DropdownMenuSlots<T>)" v-bind="slotData" />
156
162
</template>
157
163
164
+ <template #list-trailing>
165
+ <slot name="list-trailing" />
166
+ </template>
167
+
158
168
<DropdownMenuArrow v-if="!!arrow" v-bind="arrowProps" :class="ui.arrow({ class: props.ui?.arrow })" />
159
169
</UDropdownMenuContent>
160
170
</DropdownMenuRoot>
Original file line number Diff line number Diff line change @@ -33,7 +33,9 @@ interface DropdownMenuContentProps<T extends ArrayOrNested<DropdownMenuItem>> ex
33
33
interface DropdownMenuContentEmits extends RekaDropdownMenuContentEmits {}
34
34
35
35
type DropdownMenuContentSlots<T extends ArrayOrNested<DropdownMenuItem>> = Omit<DropdownMenuSlots<T>, 'default'> & {
36
- default(props?: {}): any
36
+ 'default'(props?: {}): any
37
+ 'list-leading': (props?: {}) => any
38
+ 'list-trailing': (props?: {}) => any
37
39
}
38
40
39
41
</script>
@@ -111,6 +113,8 @@ const groups = computed<DropdownMenuItem[][]>(() =>
111
113
112
114
<DropdownMenu.Portal :disabled="!portal">
113
115
<component :is="sub ? DropdownMenu.SubContent : DropdownMenu.Content" :class="props.class" v-bind="contentProps">
116
+ <slot name="list-leading" />
117
+
114
118
<DropdownMenu.Group v-for="(group, groupIndex) in groups" :key="`group-${groupIndex}`" :class="ui.group({ class: uiOverride?.group })">
115
119
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
116
120
<DropdownMenu.Label v-if="item.type === 'label'" :class="ui.label({ class: uiOverride?.label })">
@@ -177,6 +181,8 @@ const groups = computed<DropdownMenuItem[][]>(() =>
177
181
</DropdownMenu.Group>
178
182
179
183
<slot />
184
+
185
+ <slot name="list-trailing" />
180
186
</component>
181
187
</DropdownMenu.Portal>
182
188
</template>
You can’t perform that action at this time.
0 commit comments