File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
frontend/layers/base/app/components Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 11<script setup lang="ts" generic =" SearchResultType extends Record <string , any >" >
2+ import type { PointerDownOutsideEvent } from ' reka-ui'
3+
24type GroupBy = keyof SearchResultType
35
46const {
@@ -48,6 +50,14 @@ const groupedResults = computed(() => {
4850
4951 return Object .entries (groupedResults ) as [SearchResultType [GroupBy ], SearchResultType []][]
5052})
53+
54+ const searchInput = useTemplateRef (' search-input' )
55+ const handleClickOutside = (e : PointerDownOutsideEvent ) => {
56+ if (e .target === searchInput .value ?.$el ) return
57+
58+ input .value = ' '
59+ hasSearched .value = false
60+ }
5161 </script >
5262
5363<template >
@@ -69,6 +79,7 @@ const groupedResults = computed(() => {
6979 </RkLabel >
7080 <RkComboboxInput
7181 id =" search-input"
82+ ref =" search-input"
7283 v-model.trim =" input"
7384 type =" search"
7485 auto-focus
@@ -82,12 +93,17 @@ const groupedResults = computed(() => {
8293
8394 <RkComboboxContent
8495 class =" absolute z-10 dark:bg-gray-950 mt-xl rounded-xl w-full max-h-[400px]"
96+ @pointer-down-outside =" handleClickOutside"
8597 >
8698 <template v-if =" $slots [' dropdown-fixed-header' ]" >
8799 <slot name =" dropdown-fixed-header" />
88100 </template >
89101
90- <RkComboboxViewport tabindex =" -1" >
102+ <div
103+ role =" presentation"
104+ class =" overflow-y-auto"
105+ tabindex =" -1"
106+ >
91107 <div class =" py-lg" >
92108 <slot
93109 v-if =" isLoading"
@@ -156,7 +172,7 @@ const groupedResults = computed(() => {
156172 </RkComboboxItem >
157173 </template >
158174 </div >
159- </RkComboboxViewport >
175+ </div >
160176 </RkComboboxContent >
161177 </RkComboboxRoot >
162178 </form >
You can’t perform that action at this time.
0 commit comments