import { jsx as _jsx } from "react/jsx-runtime";
import { BooleanField } from '../../../scalars/components/boolean-field/boolean-field.js';
import { cn } from '../../../scalars/lib/utils.js';
export const buildBooleanCellEditor = (booleanFieldProps) => {
    const BooleanCellEditor = (value, onChange, context) => {
        const booleanValue = (() => {
            if (typeof value === 'boolean') {
                return value;
            }
            else if (typeof value === 'string') {
                return value === 'true';
            }
            return Boolean(value);
        })();
        return (_jsx("div", { className: cn('flex [&_button]:!mr-0', {
                'justify-center': context.column.align === 'center',
                'justify-end': context.column.align === 'right',
            }), children: _jsx(BooleanField, { autoFocus: true, isToggle: false, name: context.column.field, ...booleanFieldProps, value: booleanValue, onChange: (value) => {
                    onChange(value);
                } }) }));
    };
    return BooleanCellEditor;
};
//# sourceMappingURL=boolean-editor.js.map