import { consoleWarning } from "../../../../utils/helpers/consoleWarning.js";
import { canSelectTableRow } from "./selection.utils.js";
function getSingleSelectProps({ selectedKeysSet, setSelectedKeys, name, enableRowSelection, }) {
    const handleSelectionChange = (key, row) => {
        if (!row) {
            consoleWarning(`DataGrid.Table: Row data is undefined for key ${key}. This may cause issues with selection if enableRowSelection is used.`);
        }
        if (!canSelectTableRow(enableRowSelection, { row, id: key })) {
            return;
        }
        setSelectedKeys([key]);
    };
    return {
        getRowRadioProps: (key, row) => {
            const isSelectionDisabled = !canSelectTableRow(enableRowSelection, {
                row,
                id: key,
            });
            return {
                checked: selectedKeysSet.has(key),
                onChange: isSelectionDisabled
                    ? () => null
                    : () => handleSelectionChange(key, row),
                disabled: isSelectionDisabled,
                value: key,
                name,
            };
        },
        toggleSelection: handleSelectionChange,
    };
}
export { getSingleSelectProps };
//# sourceMappingURL=getSingleSelectProps.js.map