'use client';
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
import React from 'react';
import { CheckboxInput } from '../../fields/Checkbox/Input.js';
import { useAuth } from '../../providers/Auth/index.js';
import { useSelection } from '../../providers/Selection/index.js';
import { Locked } from '../Locked/index.js';
import './index.scss';
const baseClass = 'select-row';
export const SelectRow = ({ rowData })=>{
    const { user } = useAuth();
    const { selected, setSelection } = useSelection();
    const { _isLocked, _userEditing } = rowData || {};
    const documentIsLocked = _isLocked && _userEditing;
    if (documentIsLocked && _userEditing.id !== user?.id) {
        return /*#__PURE__*/ _jsxDEV(Locked, {
            user: _userEditing
        }, void 0, false, {
            fileName: "src/elements/SelectRow/index.tsx",
            lineNumber: 28,
            columnNumber: 12
        }, this);
    }
    return /*#__PURE__*/ _jsxDEV(CheckboxInput, {
        checked: Boolean(selected.get(rowData.id)),
        className: [
            baseClass,
            `${baseClass}__checkbox`
        ].join(' '),
        onToggle: ()=>setSelection(rowData.id)
    }, void 0, false, {
        fileName: "src/elements/SelectRow/index.tsx",
        lineNumber: 32,
        columnNumber: 5
    }, this);
};

//# sourceMappingURL=index.js.map