"use client"; import { Field } from "@azmr/ui/field"; import { Icon } from "@azmr/ui/icons"; import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, } from "@azmr/ui/input-group"; import { Search, X } from "lucide-react"; import { useRef, useState } from "react"; const CUSTOMERS = ["Aroha Ngata", "Mere Tāwhiri", "James Wilson", "Priya Patel", "Liam O'Connor"]; export default function InputGroupSearch() { const [query, setQuery] = useState(""); const input = useRef(null); const matches = CUSTOMERS.filter((name) => name.toLowerCase().includes(query.toLowerCase())); return (
{query ? ( { setQuery(""); // Back to the input, so the next search starts where the last one did. input.current?.focus(); }} > ) : null}

{matches.length === 1 ? "1 customer" : `${matches.length} customers`}

); }