"use client"; import { forwardRef, useRef } from "react"; import MagnifyingGlass from "../../icons/magnifying-glass"; import { mergeRefs } from "../../utils/merge-refs"; import { Spinner } from "../Spinner"; import { Props as BaseProps, default as Input } from "./Input"; import { ClearButton } from "./clear-button"; interface Props extends Omit< BaseProps, | "prefix" | "prefixStyling" | "prefixContainer" | "suffix" | "suffixStyling" | "suffixContainer" > { loading?: boolean; } const SearchInput = forwardRef( ({ loading, ...props }, externalRef) => { const inputRef = useRef(null); return ( ) : ( ) } prefixStyling={false} suffix={ props.value || inputRef.current?.value ? ( { if (inputRef.current) { inputRef.current.value = ""; inputRef.current.focus(); props.onChange?.({ target: { value: "" }, } as any); } }} /> ) : null } suffixContainer={false} suffixStyling={false} /> ); }, ); export default SearchInput;