import React from 'react';
import { DateCustomFieldFilter } from './DateCustomFieldFilter';
import { DateTimeCustomFieldFilter } from './DateTimeCustomFieldFilter';
import { CheckboxCustomFieldFilter } from './CheckboxCustomFieldFilter';
import { NumberRangeFilter } from '../NumberRangeFilter';
import { OperatorFilterCustomFieldFilter } from './OperatorFilterCustomFieldFilter';
import { toFieldType } from '../../utils/fieldTypePrefixIcons';
export const buildCustomFieldFilterElement = (state, customField) => {
    const customFieldFilterComponents = {
        date: DateCustomFieldFilter,
        dateTime: DateTimeCustomFieldFilter,
        checkbox: CheckboxCustomFieldFilter,
        integer: NumberRangeFilter,
        decimal: (props) => React.createElement(NumberRangeFilter, { ...props, decimal: true }),
        shortText: OperatorFilterCustomFieldFilter,
        url: OperatorFilterCustomFieldFilter,
        longText: OperatorFilterCustomFieldFilter,
    };
    const CustomFieldFilterComponent = customFieldFilterComponents[customField.type];
    if (!CustomFieldFilterComponent) {
        return null;
    }
    const label = customField.label || customField.id;
    return (React.createElement(CustomFieldFilterComponent, { key: customField.id, filter: state.collection.filters[customField.id], fieldType: toFieldType(customField.type), accordionItemProps: {
            label,
        }, toolbarItemProps: {
            label,
        }, toolbarTagProps: {
            label,
        } }));
};
//# sourceMappingURL=buildCustomFieldFilterElement.js.map