// @flow strict import * as React from 'react'; import classify from '../../utils/classify'; import {CircularLoader} from '../CircularLoader'; import type {InputProps} from '../Input'; import {Input} from '../Input'; import css from './SearchInput.module.css'; type ClassNames = $ReadOnly<{ wrapper?: string, box?: string, iconLeft?: string, }>; export type SearchInputProps = { ...InputProps, classNames?: ClassNames, onClear?: () => void, isLoading?: boolean, ... }; export const SearchInput: React$AbstractComponent< SearchInputProps, HTMLInputElement, > = React.forwardRef( ( { value, disabled, locked, placeholder = 'Search...', classNames, onClear, isLoading, size, iconLeftName = 'magnifying-glass', ...searchInputProps }: SearchInputProps, ref, ): React.Node => { const handleClearClick = () => { if (value && !(disabled || locked)) { onClear?.(); } }; return (
{isLoading && (
)}
); }, );