import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { Table, TBody } from "@vertesia/ui/core";
import { DocumentIcon, DocumentIconSkeleton } from "../components/DocumentIcon";
export function DocumentTableView({ objects, selection, isLoading, columns, onRowClick, selectedObject, toggleAll, onSelectionChange }) {
    return (_jsxs(Table, { className: "w-full border-t", children: [_jsx("thead", { children: _jsxs("tr", { children: [selection && _jsx("th", { children: _jsx("input", { type: "checkbox", onChange: toggleAll }) }), columns.map((col) => (_jsx("th", { children: col.name }, col.name)))] }) }), _jsxs(TBody, { isLoading: isLoading, columns: columns.length + 1, children: [objects?.map((obj) => {
                        return (_jsxs("tr", { className: `cursor-pointer hover:bg-muted group ${selectedObject?.id === obj.id ? 'bg-muted' : ''}`, onClick: () => {
                                onRowClick && onRowClick(obj);
                            }, children: [selection &&
                                    _jsx("td", { onClick: ev => ev.stopPropagation(), children: _jsx("input", { checked: selection.isSelected(obj.id), type: "checkbox", className: `${!selection.isSelected(obj.id) ? 'hidden group-hover:block' : ''}`, onChange: (ev) => onSelectionChange(obj, ev) }) }), columns.map((col, index) => col.render(obj, index))] }, obj.id));
                    }), objects.length === 0 && _jsx("tr", { children: _jsx("td", { colSpan: columns.length + (selection ? 1 : 0), className: "text-center", children: "No objects. Just drag and drop documents or images here to create content objects." }) })] })] }));
}
export function DocumentGridView({ objects, selection, isLoading, onSelectionChange, onRowClick, previewObject, selectedObject }) {
    return (_jsxs(_Fragment, { children: [_jsx(DocumentIconSkeleton, { isLoading: isLoading }), _jsx("div", { className: "w-full gap-2 grid lg:grid-cols-6", children: objects.map((document) => (_jsx(DocumentIcon, { document: document, selection: selection, onSelectionChange: onSelectionChange, onRowClick: onRowClick, previewObject: previewObject, selectedObject: selectedObject }, document.id))) })] }));
}
//# sourceMappingURL=documentLayout.js.map