import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { Table, TBody, Spinner } from "@vertesia/ui/core";
import clsx from "clsx";
import { DocumentIcon } from "../components/DocumentIcon";
export function DocumentTableView({ objects, selection, isLoading, onRowClick, columns, 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', onClick: () => {
                                onRowClick && onRowClick(obj);
                            }, children: [selection &&
                                    _jsx("td", { onClick: ev => ev.stopPropagation(), children: _jsx("input", { checked: selection.isSelected(obj.id), type: "checkbox", 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 }) {
    return (_jsxs(_Fragment, { children: [_jsx("div", { className: clsx("bg-white opacity-40 absolute inset-0 z-50 flex justify-center items-center", isLoading ? "block" : "hidden"), children: _jsx(Spinner, { size: 'xl' }) }), _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 }, document.id))) })] }));
}
//# sourceMappingURL=documentLayout.js.map