Some checks failed
build-images / web (push) Has been cancelled
vision2026-ci / Python SDK resource tests (push) Has been cancelled
build-images / api (push) Has been cancelled
build-images / worker-gpu (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Has been cancelled
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Has been cancelled
codeql / Analyze (javascript-typescript) (push) Has been cancelled
codeql / Analyze (python) (push) Has been cancelled
perf / API hot-path micro-smoke (budgeted) (push) Has been cancelled
perf / Desktop engine crates (release build check) (push) Has been cancelled
vision2026-ci / API phase modules (ruff + pytest) (push) Has been cancelled
vision2026-ci / Alembic upgrade + drift check (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Has been cancelled
Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
66 lines
2.0 KiB
TypeScript
66 lines
2.0 KiB
TypeScript
"use client";
|
|
|
|
import * as React from "react";
|
|
import { Search, X } from "lucide-react";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
export interface SearchBarProps {
|
|
value: string;
|
|
onChange: (value: string) => void;
|
|
placeholder?: string;
|
|
/** Result count shown to the right of the field. */
|
|
resultLabel?: string;
|
|
className?: string;
|
|
}
|
|
|
|
/** Debounce-free controlled search field with a clear button. */
|
|
export function SearchBar({
|
|
value,
|
|
onChange,
|
|
placeholder = "Search",
|
|
resultLabel,
|
|
className,
|
|
}: Readonly<SearchBarProps>) {
|
|
const inputId = React.useId();
|
|
return (
|
|
<div className={cn("flex items-center gap-3", className)}>
|
|
<div className="relative flex-1">
|
|
<Search
|
|
className="pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"
|
|
aria-hidden
|
|
/>
|
|
<label htmlFor={inputId} className="sr-only">
|
|
{placeholder}
|
|
</label>
|
|
<input
|
|
id={inputId}
|
|
type="search"
|
|
value={value}
|
|
placeholder={placeholder}
|
|
onChange={(e) => onChange(e.target.value)}
|
|
className={cn(
|
|
"flex h-10 w-full rounded-md border border-input bg-secondary/40 pl-9 pr-9 text-sm",
|
|
"placeholder:text-muted-foreground",
|
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
)}
|
|
/>
|
|
{value && (
|
|
<button
|
|
type="button"
|
|
onClick={() => onChange("")}
|
|
aria-label="Clear search"
|
|
className="absolute right-2 top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground"
|
|
>
|
|
<X className="size-4" aria-hidden />
|
|
</button>
|
|
)}
|
|
</div>
|
|
{resultLabel && (
|
|
<span className="shrink-0 text-sm text-muted-foreground">
|
|
{resultLabel}
|
|
</span>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|