import { jsx as _jsx } from "react/jsx-runtime";
import { AIDField } from '../../../scalars/components/aid-field/index.js';
import { normalizeStringValue } from './utils.js';
export const buildAidCellEditor = (aidFieldProps) => {
    const AidCellEditor = (value, onChange, context) => {
        const aidValue = normalizeStringValue(value);
        if (aidFieldProps.autoComplete !== false && aidFieldProps.fetchOptionsCallback) {
            const { autoComplete: _1, fetchOptionsCallback, ...restProps } = aidFieldProps;
            return (_jsx(AIDField, { name: context.column.field, className: "max-w-full", autoFocus: true, fetchOptionsCallback: fetchOptionsCallback, ...restProps, value: aidValue, onChange: (value) => {
                    onChange(value);
                } }));
        }
        const { autoComplete: _1, fetchOptionsCallback: _2, fetchSelectedOptionCallback: _3, previewPlaceholder: _4, ...restProps } = aidFieldProps;
        return (_jsx(AIDField, { name: context.column.field, className: "max-w-full", autoFocus: true, autoComplete: false, ...restProps, value: aidValue, onChange: (value) => {
                onChange(value);
            } }));
    };
    return AidCellEditor;
};
//# sourceMappingURL=aid-editor.js.map