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';
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, value: booleanValue, onChange: (value) => {
                onChange(value);
            } }) }));
};
export const booleanCellEditor = BooleanCellEditor;
//# sourceMappingURL=boolean-editor.js.map