File tree Expand file tree Collapse file tree 4 files changed +48
-30
lines changed
tools/server/webui/src/lib/components/app Expand file tree Collapse file tree 4 files changed +48
-30
lines changed Original file line number Diff line number Diff line change 11<script lang =" ts" >
2- import { Input } from ' $lib/components/ui/input' ;
3- import { Search } from ' @lucide/svelte' ;
2+ import { SearchInput } from ' $lib/components/app' ;
43
54 interface Props {
65 value? : string ;
1514 onInput,
1615 class : className
1716 }: Props = $props ();
18-
19- function handleInput(event : Event ) {
20- const target = event .target as HTMLInputElement ;
21-
22- value = target .value ;
23- onInput ?.(target .value );
24- }
2517 </script >
2618
27- <div class ="relative mb-4 {className }" >
28- <Search
29- class =" absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2 transform text-muted-foreground"
30- />
31-
32- <Input bind:value class ="pl-10" oninput ={handleInput } {placeholder } type =" search" />
33- </div >
19+ <SearchInput bind:value {placeholder } {onInput } class ="mb-4 {className }" />
Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ export { default as CopyToClipboardIcon } from './misc/CopyToClipboardIcon.svelt
6363export { default as KeyboardShortcutInfo } from './misc/KeyboardShortcutInfo.svelte' ;
6464export { default as MarkdownContent } from './misc/MarkdownContent.svelte' ;
6565export { default as RemoveButton } from './misc/RemoveButton.svelte' ;
66+ export { default as SearchInput } from './misc/SearchInput.svelte' ;
6667export { default as SyntaxHighlightedCode } from './misc/SyntaxHighlightedCode.svelte' ;
6768export { default as ModelsSelector } from './models/ModelsSelector.svelte' ;
6869
Original file line number Diff line number Diff line change 1+ <script lang =" ts" >
2+ import { Input } from ' $lib/components/ui/input' ;
3+ import { Search } from ' @lucide/svelte' ;
4+
5+ interface Props {
6+ value? : string ;
7+ placeholder? : string ;
8+ onInput? : (value : string ) => void ;
9+ class? : string ;
10+ id? : string ;
11+ ref? : HTMLInputElement | null ;
12+ }
13+
14+ let {
15+ value = $bindable (' ' ),
16+ placeholder = ' Search...' ,
17+ onInput,
18+ class : className,
19+ id,
20+ ref = $bindable (null )
21+ }: Props = $props ();
22+
23+ function handleInput(event : Event ) {
24+ const target = event .target as HTMLInputElement ;
25+
26+ value = target .value ;
27+ onInput ?.(target .value );
28+ }
29+ </script >
30+
31+ <div class ="relative {className }" >
32+ <Search
33+ class =" absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2 transform text-muted-foreground"
34+ />
35+
36+ <Input {id } bind:value bind:ref class ="pl-9" oninput ={handleInput } {placeholder } type =" search" />
37+ </div >
Original file line number Diff line number Diff line change 1717 import { usedModalities , conversationsStore } from ' $lib/stores/conversations.svelte' ;
1818 import { ServerModelStatus } from ' $lib/enums' ;
1919 import { isRouterMode } from ' $lib/stores/server.svelte' ;
20- import { DialogModelInformation } from ' $lib/components/app' ;
20+ import { DialogModelInformation , SearchInput } from ' $lib/components/app' ;
2121 import { MENU_OFFSET , VIEWPORT_GUTTER } from ' $lib/constants/floating-ui-constraints' ;
2222 import type { ModelOption } from ' $lib/types/models' ;
2323
477477 style:width ={menuPosition ? ` ${menuPosition .width }px ` : undefined }
478478 data-placement ={menuPosition ?.placement ?? ' bottom' }
479479 >
480- <div class =" px-3 py-2" >
481- <label class =" sr-only" for =" model-search" >Search models</label >
482- <input
483- id =" model-search"
484- class =" h-9 w-full rounded-lg bg-muted px-3 text-sm outline-none placeholder:text-muted-foreground"
485- placeholder =" Search models"
486- bind:value ={searchTerm }
487- bind:this ={searchInputRef }
488- aria-label =" Search models"
489- autocomplete =" off"
490- type =" search"
491- />
492- </div >
480+ <SearchInput
481+ id =" model-search"
482+ class =" p-4"
483+ placeholder =" Search models..."
484+ bind:value ={searchTerm }
485+ bind:ref ={searchInputRef }
486+ />
493487 <div
494488 class =" overflow-y-auto py-1"
495489 style:max-height ={menuPosition && menuPosition .maxHeight > 0
You can’t perform that action at this time.
0 commit comments