"use client" import * as React from "react" import { Button } from "@/components/ui/button" import { Popover, PopoverAnchor, PopoverContent, } from "@/components/ui/popover" import { cn } from "@/lib/utils" export interface SearchRecentsPopoverProps { open: boolean onOpenChange: (open: boolean) => void items: string[] onSelect: (query: string) => void onClear?: () => void anchor: React.ReactNode title?: string clearLabel?: string className?: string } export function SearchRecentsPopover({ open, onOpenChange, items, onSelect, onClear, anchor, title = "Recent searches", clearLabel = "Clear", className, }: SearchRecentsPopoverProps) { const headingId = React.useId() if (items.length === 0) { return <>{anchor} } return ( {anchor} e.preventDefault()} >

{title}

{onClear ? ( ) : null}