import { jsx as _jsx } from "react/jsx-runtime";
import { forwardRefWithGeneric } from '../../components/forwardRefWithGeneric';
import { SearchField, } from '../../components/SearchField';
import { useFormFieldProps } from '../useFormFieldProps';
import { FORM_FILTERS_SEARCH_FIELD_ID, formFiltersSearchFieldClassnames, } from './constants';
import { Wrapper } from './styles';
/**
 * Адаптер для SearchField для использования в FormFilters
 */
function FormFiltersSearchFieldInner({ width, ...props }, ref) {
    const fieldProps = useFormFieldProps({
        ...props,
        defaultValue: props.defaultValue || '',
    });
    const hasValue = Boolean(fieldProps.value);
    return (_jsx(Wrapper, { "$width": width, className: hasValue ? formFiltersSearchFieldClassnames.hasValue : '', children: _jsx(SearchField, { ...fieldProps, ref: ref, inputProps: { id: FORM_FILTERS_SEARCH_FIELD_ID }, fullWidth: true }) }));
}
export const FormFiltersSearchField = forwardRefWithGeneric(FormFiltersSearchFieldInner);
