import React, { forwardRef, useEffect, } from 'react';
import { useVirtualGridRepeaterContext } from './VirtualGridRepeaterContext';
import { VirtualTableRow } from './VirtualTableRow';
import { ForceRenderIndexesObserver } from './ForceRenderIndexes';
export const TableForceRenderIndexes = forwardRef((props, ref) => {
    const { children, style } = props;
    const { state } = useVirtualGridRepeaterContext();
    useEffect(() => {
        state.scrollHeight = style?.height;
    }, [style?.height]);
    return (React.createElement(ForceRenderIndexesObserver, { ItemElementType: VirtualTableRow, contentsWrapper: ({ contents, listAttributes }) => (React.createElement("tbody", { key: props.id, "data-hook": "virtual-inner-element", "data-count": state.gridState.itemsToRenderCount, ref: (el) => {
                if (typeof ref === 'function') {
                    ref(el);
                }
                else if (ref) {
                    ref.current = el;
                }
                state.innerElement = el;
            }, ...listAttributes, ...props, style: {
                ...style,
                width: undefined,
                position: 'relative',
                display: 'flex',
            } }, contents)) }, children));
});
//# sourceMappingURL=TableForceRenderIndexes.js.map