'use client'; import { Search, X } from 'lucide-react'; import { cn } from '@djangocfg/ui-core/lib'; import { useTreeContext } from '../context/TreeContext'; import { useTreeSearch } from '../context/hooks'; export interface TreeSearchInputProps { className?: string; showMatches?: boolean; } export function TreeSearchInput({ className, showMatches = true }: TreeSearchInputProps) { const { labels } = useTreeContext(); const { query, setQuery, matchCount } = useTreeSearch(); return (
setQuery(e.target.value)} placeholder={labels.searchPlaceholder} className="h-7 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground" /> {showMatches && query.trim().length > 0 ? ( {labels.searchMatches(matchCount)} ) : null} {query.length > 0 ? ( ) : null}
); }