import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useGlobalTableKeyEvents } from '../hooks/useGlobalTableKeyEvents.js';
import { useInternalTableState } from './table-provider/table-provider.js';
import { RenderRow } from './rows/render-row.js';
const TableBody = () => {
    const { config, state: { data }, } = useInternalTableState();
    // add global key events to the table
    useGlobalTableKeyEvents();
    return (_jsxs("tbody", { className: "text-sm leading-5 text-gray-900", children: [data.map((data, index) => (
            // TODO: replace key with unique key (maybe generated with object-hash package)
            _jsx(RenderRow, { item: data, rowIndex: index }, index))), data.length < (config.minRowCount ?? 0) &&
                Array.from({ length: (config.minRowCount ?? 0) - data.length }).map((_, index) => (_jsx(RenderRow, { item: {}, rowIndex: index + data.length, emptyRow: true }, index)))] }));
};
export { TableBody };
//# sourceMappingURL=body.js.map