import { useMemo } from "react";
import { filterItems } from "../utils";
import { useNavigationMaps } from "./usePathMaps";
export const useComboboxItems = ({ items, textValue, currentLabel, filter })=>{
    const filteredItems = useMemo(()=>filterItems(items, textValue, currentLabel, filter), [
        currentLabel,
        filter,
        items,
        textValue
    ]);
    const [filteredPathMap, filteredFocusedToValueMap, filteredValueToPathMap] = useNavigationMaps(filteredItems);
    return {
        filteredItems,
        filteredMaps: {
            pathMap: filteredPathMap,
            focusedToValueMap: filteredFocusedToValueMap,
            valueToPathMap: filteredValueToPathMap
        }
    };
};
