import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { ItemSearch } from "./ItemSearch";
import ContentTree from "../ContentTree";
import { cn } from "../../lib/utils";
import { normalizeGuid } from "../utils";
export function TreeListSelector({ language, rootItemIds, database = "master", selectedItemIds, onSelectionChange, onDoubleClick, onItemSelected, readOnly, className, searchContainerClassName, searchAutoFocus = false, expandIdPath, showSearch = true, selectionMode = "multiple", multiSelectRequiresModifier = true, enableDragAndDrop, enableItemDrop = true, isDraggable, showGrabCursorForDraggableNodes, nodeCursor, showCheckboxes, }) {
    const normalizedRootIds = rootItemIds?.map((id) => normalizeGuid(id));
    return (_jsxs("div", { className: cn("flex h-full flex-col bg-white", className), children: [showSearch && (_jsx("div", { className: cn("border-border-default border-b p-2", readOnly && "bg-neutral-grey-5", searchContainerClassName), children: _jsx(ItemSearch, { rootItemIds: normalizedRootIds, language: language, database: database, itemSelected: (item) => onItemSelected?.(item), autoFocus: searchAutoFocus, disabled: readOnly }) })), _jsx("div", { className: cn("relative flex-1 overflow-auto pr-2", readOnly && "bg-neutral-grey-5"), children: _jsx(ContentTree, { language: language, rootItemIds: rootItemIds, database: database, selectedItemIds: selectedItemIds, onSelectionChange: onSelectionChange, onDoubleClick: onDoubleClick, selectionMode: selectionMode, multiSelectRequiresModifier: multiSelectRequiresModifier, hideRootNodes: true, expandIdPath: expandIdPath, includeItemPath: true, enableDragAndDrop: enableDragAndDrop, enableItemDrop: !readOnly && enableItemDrop, isDraggable: isDraggable, showGrabCursorForDraggableNodes: showGrabCursorForDraggableNodes, nodeCursor: nodeCursor, showCheckboxes: showCheckboxes }) })] }));
}
export default TreeListSelector;
//# sourceMappingURL=TreeListSelector.js.map