2026-02-02 12:16:51 +03:00
|
|
|
<!-- Component: SearchBar -->
|
2026-01-09 16:19:22 +03:00
|
|
|
<script lang="ts">
|
|
|
|
|
import { Input } from '$shared/shadcn/ui/input';
|
2026-02-02 12:16:51 +03:00
|
|
|
import AsteriskIcon from '@lucide/svelte/icons/asterisk';
|
2026-01-09 16:19:22 +03:00
|
|
|
|
|
|
|
|
interface Props {
|
2026-01-29 14:33:12 +03:00
|
|
|
/**
|
|
|
|
|
* Unique identifier for the input element
|
|
|
|
|
*/
|
2026-01-18 20:07:37 +03:00
|
|
|
id?: string;
|
2026-01-29 14:33:12 +03:00
|
|
|
/**
|
|
|
|
|
* Current search value (bindable)
|
|
|
|
|
*/
|
2026-01-09 16:19:22 +03:00
|
|
|
value: string;
|
2026-01-29 14:33:12 +03:00
|
|
|
/**
|
|
|
|
|
* Additional CSS classes for the container
|
|
|
|
|
*/
|
2026-01-09 16:19:22 +03:00
|
|
|
class?: string;
|
2026-01-29 14:33:12 +03:00
|
|
|
/**
|
|
|
|
|
* Placeholder text for the input
|
|
|
|
|
*/
|
2026-01-09 16:19:22 +03:00
|
|
|
placeholder?: string;
|
2026-01-29 14:33:12 +03:00
|
|
|
/**
|
|
|
|
|
* Optional label displayed above the input
|
|
|
|
|
*/
|
2026-01-09 16:19:22 +03:00
|
|
|
label?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let {
|
|
|
|
|
id = 'search-bar',
|
2026-01-29 14:33:12 +03:00
|
|
|
value = $bindable(''),
|
2026-01-09 16:19:22 +03:00
|
|
|
class: className,
|
|
|
|
|
placeholder,
|
|
|
|
|
}: Props = $props();
|
|
|
|
|
|
|
|
|
|
function handleKeyDown(event: KeyboardEvent) {
|
|
|
|
|
if (event.key === 'ArrowDown' || event.key === 'ArrowUp' || event.key === 'Enter') {
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
2026-02-01 11:56:39 +03:00
|
|
|
<div class="relative w-full">
|
|
|
|
|
<div class="absolute left-5 top-1/2 -translate-y-1/2 pointer-events-none z-10">
|
2026-02-02 12:16:51 +03:00
|
|
|
<AsteriskIcon class="size-4 stroke-gray-400 stroke-[1.5]" />
|
2026-02-01 11:56:39 +03:00
|
|
|
</div>
|
|
|
|
|
<Input
|
|
|
|
|
id={id}
|
|
|
|
|
placeholder={placeholder}
|
|
|
|
|
bind:value={value}
|
|
|
|
|
onkeydown={handleKeyDown}
|
|
|
|
|
class="
|
|
|
|
|
h-16 w-full text-base
|
|
|
|
|
backdrop-blur-md bg-white/80
|
|
|
|
|
border border-gray-300/50
|
|
|
|
|
shadow-[0_1px_3px_rgba(0,0,0,0.04)]
|
|
|
|
|
focus-visible:border-gray-400/60
|
|
|
|
|
focus-visible:outline-none
|
|
|
|
|
focus-visible:ring-1
|
|
|
|
|
focus-visible:ring-gray-400/30
|
|
|
|
|
focus-visible:bg-white/90
|
|
|
|
|
hover:bg-white/90
|
|
|
|
|
hover:border-gray-400/60
|
|
|
|
|
text-gray-900
|
|
|
|
|
placeholder:text-gray-400
|
|
|
|
|
placeholder:font-mono
|
|
|
|
|
placeholder:text-sm
|
|
|
|
|
placeholder:tracking-wide
|
|
|
|
|
pl-14 pr-6
|
|
|
|
|
rounded-xl
|
|
|
|
|
transition-all duration-200
|
|
|
|
|
font-medium
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|