import { jsx as _jsx } from "react/jsx-runtime";
import { cn } from '../../../scalars/lib/utils.js';
import { BooleanField } from '../../../scalars/components/boolean-field/boolean-field.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({
                'justify-center': context.column.align === 'center',
                'justify-end': context.column.align === 'right',
            }, 'flex w-full', !booleanFieldProps.label && '[&_button]:!mr-0'), 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