"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FormFiltersSearchField = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const forwardRefWithGeneric_1 = require("../../components/forwardRefWithGeneric");
const SearchField_1 = require("../../components/SearchField");
const useFormFieldProps_1 = require("../useFormFieldProps");
const constants_1 = require("./constants");
const styles_1 = require("./styles");
/**
 * Адаптер для SearchField для использования в FormFilters
 */
function FormFiltersSearchFieldInner({ width, ...props }, ref) {
    const fieldProps = (0, useFormFieldProps_1.useFormFieldProps)({
        ...props,
        defaultValue: props.defaultValue || '',
    });
    const hasValue = Boolean(fieldProps.value);
    return ((0, jsx_runtime_1.jsx)(styles_1.Wrapper, { "$width": width, className: hasValue ? constants_1.formFiltersSearchFieldClassnames.hasValue : '', children: (0, jsx_runtime_1.jsx)(SearchField_1.SearchField, { ...fieldProps, ref: ref, inputProps: { id: constants_1.FORM_FILTERS_SEARCH_FIELD_ID }, fullWidth: true }) }));
}
exports.FormFiltersSearchField = (0, forwardRefWithGeneric_1.forwardRefWithGeneric)(FormFiltersSearchFieldInner);
