setIsHovered(true)}
onMouseLeave={() => {
setIsHovered(false);
setHoveredButtonId(null);
}}
onFocus={() => setIsFocused(true)}
onBlur={(e) => {
if (!e.currentTarget.contains(e.relatedTarget)) setIsFocused(false);
}}
className={cn(
"relative flex flex-col items-center select-none",
disabled && "opacity-50 pointer-events-none",
className,
)}
style={{ width: MAX_WIDTH, maxWidth: "100%" }}
>
{FILTER_BUTTONS.map((btn, idx) => (
))}
inputRef.current?.focus()}
className={cn(
"absolute left-0 top-0 h-12 flex items-center px-4 rounded-full border transition-colors cursor-text select-none",
"bg-white/90 backdrop-blur-2xl border-zinc-200 dark:bg-[#1c1c1f]/85 dark:border-white/12",
"shadow-[0_8px_32px_rgba(0,0,0,0.08),inset_0_1px_1.5px_rgba(255,255,255,0.8)] dark:shadow-[0_8px_32px_rgba(0,0,0,0.6),inset_0_1px_1.5px_rgba(255,255,255,0.12)]",
"focus-within:border-zinc-400 focus-within:ring-1 focus-within:ring-zinc-300 dark:focus-within:border-white/30 dark:focus-within:ring-white/20",
)}
>
{currentFilter && (
{
e.stopPropagation();
handleFilterToggle(currentFilter);
}}
className="ml-1.5 px-2 py-0.5 rounded-full text-[10px] font-mono uppercase bg-zinc-100 hover:bg-zinc-200 text-zinc-700 dark:bg-white/10 dark:hover:bg-white/20 dark:text-zinc-300 transition-colors"
>
{currentFilter}
)}
{FILTER_BUTTONS.map((btn, idx) => {
const IconComponent = btn.icon;
const isActive = currentFilter === btn.id;
const isHoveredBtn = hoveredButtonId === btn.id;
const targetX = filterOffsetX(idx);
return (
setHoveredButtonId(btn.id)}
onMouseLeave={() => setHoveredButtonId(null)}
onClick={() => handleFilterToggle(btn.id)}
className={cn(
"w-full h-full rounded-full flex items-center justify-center cursor-pointer outline-none transition-colors focus-visible:ring-2 focus-visible:ring-zinc-400 dark:focus-visible:ring-white/40",
"bg-white/90 backdrop-blur-2xl border border-zinc-200 dark:bg-[#1c1c1f]/85 dark:border-white/12",
"shadow-[0_8px_32px_rgba(0,0,0,0.08),inset_0_1px_1.5px_rgba(255,255,255,0.8)] dark:shadow-[0_8px_32px_rgba(0,0,0,0.6),inset_0_1px_1.5px_rgba(255,255,255,0.12)]",
isActive
? "border-zinc-900/40 bg-zinc-100 text-zinc-950 shadow-[0_0_16px_rgba(0,0,0,0.1)] dark:border-white/40 dark:bg-white/20 dark:text-white dark:shadow-[0_0_16px_rgba(255,255,255,0.2)]"
: "text-zinc-500 hover:text-zinc-900 hover:border-zinc-300 dark:text-zinc-400 dark:hover:text-white dark:hover:border-white/25",
)}
tabIndex={isExpanded ? 0 : -1}
aria-label={btn.label}
aria-pressed={isActive}
title={btn.label}
>
{isHoveredBtn && isExpanded && (
{btn.label}
)}
);
})}
{isResultsOpen && (
{filteredItems.length === 0 ? (
No matching results found
) : (
{filteredItems.map((item, idx) => {
const isHighlighted = idx === safeHighlightedIndex;
return (
);
})}
)}
)}
);
};