/**
 * Copyright (c) OpenLens Maintainers. All rights reserved.
 * Licensed under MIT License. See LICENSE in root directory for more information.
 */
import "./item-list-layout.scss";
import React from "react";
import type { IComputedValue } from "mobx";
import type { ConfirmDialogParams } from "../confirm-dialog";
import type { TableProps, TableRowProps, TableSortCallbacks } from "../table";
import type { IClassName, StrictReactNode, SingleOrMany } from "@openlens/utilities";
import type { AddRemoveButtonsProps } from "../add-remove-buttons";
import type { ItemObject, TableCellProps } from "@openlens/list-layout";
import type { SearchInputUrlProps } from "../input";
import type { PageFiltersStore } from "./page-filters/store";
import type { SubscribableStore } from "../../kube-watch-api/kube-watch-api";
import type { StorageLayer } from "../../utils/storage-helper";
export type SearchFilter<I extends ItemObject> = (item: I) => SingleOrMany<string | number | undefined | null>;
export type SearchFilters<I extends ItemObject> = Record<string, SearchFilter<I>>;
export type ItemsFilter<I extends ItemObject> = (items: I[]) => I[];
export type ItemsFilters<I extends ItemObject> = Record<string, ItemsFilter<I>>;
export interface HeaderPlaceholders {
    title?: StrictReactNode;
    searchProps?: SearchInputUrlProps;
    filters?: StrictReactNode;
    info?: StrictReactNode;
}
export type ItemListStore<I extends ItemObject, PreLoadStores extends boolean> = {
    readonly isLoaded: boolean;
    readonly failedLoading: boolean;
    getTotalCount: () => number;
    isSelected: (item: I) => boolean;
    toggleSelection: (item: I) => void;
    isSelectedAll: (items: I[]) => boolean;
    toggleSelectionAll: (enabledItems: I[]) => void;
    pickOnlySelected: (items: I[]) => I[];
} & ({
    removeItems: (selectedItems: I[]) => Promise<void>;
    readonly selectedItems: I[];
    removeSelectedItems?: unknown;
} | {
    removeSelectedItems: () => Promise<void>;
    selectedItems?: unknown;
    removeItems?: unknown;
}) & (PreLoadStores extends true ? {
    loadAll: (selectedNamespaces: readonly string[]) => Promise<void>;
} : {
    loadAll?: unknown;
});
export type RenderHeaderTitle<Item extends ItemObject, PreLoadStores extends boolean> = StrictReactNode | ((parent: NonInjectedItemListLayout<Item, PreLoadStores>) => StrictReactNode);
export type HeaderCustomizer = (placeholders: HeaderPlaceholders) => HeaderPlaceholders;
export type ItemListLayoutProps<Item extends ItemObject, PreLoadStores extends boolean = boolean> = {
    tableId?: string;
    className: IClassName;
    getItems: () => Item[];
    store: ItemListStore<Item, PreLoadStores>;
    dependentStores?: SubscribableStore[];
    preloadStores?: boolean;
    hideFilters?: boolean;
    searchFilters?: SearchFilter<Item>[];
    /** @deprecated */
    filterItems?: ItemsFilter<Item>[];
    showHeader?: boolean;
    headerClassName?: IClassName;
    renderHeaderTitle?: RenderHeaderTitle<Item, PreLoadStores>;
    customizeHeader?: HeaderCustomizer | HeaderCustomizer[];
    isReady?: boolean;
    isSelectable?: boolean;
    isConfigurable?: boolean;
    copyClassNameFromHeadCells?: boolean;
    sortingCallbacks?: TableSortCallbacks<Item>;
    tableProps?: Partial<TableProps<Item>>;
    renderTableHeader?: (TableCellProps | undefined | null)[];
    renderTableContents: (item: Item) => (StrictReactNode | TableCellProps)[];
    renderItemMenu?: (item: Item, store: ItemListStore<Item, PreLoadStores>) => StrictReactNode;
    customizeTableRowProps?: (item: Item) => Partial<TableRowProps<Item>>;
    addRemoveButtons?: Partial<AddRemoveButtonsProps>;
    virtual?: boolean;
    hasDetailsView?: boolean;
    detailsItem?: Item;
    onDetails?: (item: Item) => void;
    customizeRemoveDialog?: (selectedItems: Item[]) => Partial<ConfirmDialogParams>;
    renderFooter?: (parent: NonInjectedItemListLayout<Item, PreLoadStores>) => StrictReactNode;
    spinnerTestId?: string;
    /**
     * Message to display when a store failed to load
     *
     * @default "Failed to load items"
     */
    failedToLoadMessage?: StrictReactNode;
    filterCallbacks?: ItemsFilters<Item>;
    "data-testid"?: string;
} & (PreLoadStores extends true ? {
    preloadStores?: true;
} : {
    preloadStores: false;
});
export interface ItemListLayoutStorage {
    showFilters: boolean;
}
interface Dependencies {
    selectedFilterNamespaces: IComputedValue<string[]>;
    itemListLayoutStorage: StorageLayer<ItemListLayoutStorage>;
    pageFiltersStore: PageFiltersStore;
}
declare class NonInjectedItemListLayout<I extends ItemObject, PreLoadStores extends boolean> extends React.Component<ItemListLayoutProps<I, PreLoadStores> & Dependencies> {
    static defaultProps: object;
    constructor(props: ItemListLayoutProps<I, PreLoadStores> & Dependencies);
    componentDidMount(): Promise<void>;
    get showFilters(): boolean;
    set showFilters(showFilters: boolean);
    get filters(): import("./page-filters/store").Filter[];
    toggleFilters(): void;
    get isReady(): boolean | NonNullable<({
        tableId?: string | undefined;
        className: IClassName;
        getItems: () => I[];
        store: ItemListStore<I, PreLoadStores>;
        dependentStores?: SubscribableStore[] | undefined;
        preloadStores?: boolean | undefined;
        hideFilters?: boolean | undefined;
        searchFilters?: SearchFilter<I>[] | undefined;
        /** @deprecated */
        filterItems?: ItemsFilter<I>[] | undefined;
        showHeader?: boolean | undefined;
        headerClassName?: IClassName;
        renderHeaderTitle?: RenderHeaderTitle<I, PreLoadStores>;
        customizeHeader?: HeaderCustomizer | HeaderCustomizer[] | undefined;
        isReady?: boolean | undefined;
        isSelectable?: boolean | undefined;
        isConfigurable?: boolean | undefined;
        copyClassNameFromHeadCells?: boolean | undefined;
        sortingCallbacks?: TableSortCallbacks<I> | undefined;
        tableProps?: Partial<TableProps<I>> | undefined;
        renderTableHeader?: (TableCellProps | null | undefined)[] | undefined;
        renderTableContents: (item: I) => (StrictReactNode | TableCellProps)[];
        renderItemMenu?: ((item: I, store: ItemListStore<I, PreLoadStores>) => StrictReactNode) | undefined;
        customizeTableRowProps?: ((item: I) => Partial<TableRowProps<I>>) | undefined;
        addRemoveButtons?: Partial<AddRemoveButtonsProps> | undefined;
        virtual?: boolean | undefined;
        hasDetailsView?: boolean | undefined;
        detailsItem?: I | undefined;
        onDetails?: ((item: I) => void) | undefined;
        customizeRemoveDialog?: ((selectedItems: I[]) => Partial<ConfirmDialogParams>) | undefined;
        renderFooter?: ((parent: NonInjectedItemListLayout<I, PreLoadStores>) => StrictReactNode) | undefined;
        spinnerTestId?: string | undefined;
        /**
         * Message to display when a store failed to load
         *
         * @default "Failed to load items"
         */
        failedToLoadMessage?: StrictReactNode;
        filterCallbacks?: ItemsFilters<I> | undefined;
        "data-testid"?: string | undefined;
    } & (PreLoadStores extends true ? {
        preloadStores?: true | undefined;
    } : {
        preloadStores: false;
    }) & Dependencies)["isReady"]>;
    renderFilters(): React.JSX.Element | null;
    private filterCallbacks;
    get items(): I[];
    render(): React.JSX.Element;
}
export declare const ItemListLayout: <I extends ItemObject, PreLoadStores extends boolean = true>(props: ItemListLayoutProps<I, PreLoadStores>) => React.ReactElement;
export {};
