import { jsx as _jsx } from "react/jsx-runtime";
// (C) 2024-2026 GoodData Corporation
import { createContext, useContext } from "react";
import { DASHBOARD_LAYOUT_GRID_COLUMNS_COUNT } from "../../../_staging/dashboard/flexibleLayout/config.js";
const DEFAULT_LAYOUT_SIZE = {
    xl: {
        gridWidth: DASHBOARD_LAYOUT_GRID_COLUMNS_COUNT,
        gridHeight: 0,
    },
};
const DashboardItemPathAndSizeContext = createContext(undefined);
DashboardItemPathAndSizeContext.displayName = "DashboardScreenSizeContext";
export function DashboardItemPathAndSizeProvider({ children, layoutItem, }) {
    return (_jsx(DashboardItemPathAndSizeContext.Provider, { value: layoutItem, children: children }));
}
/**
 * Return the current item, its path, and size.
 */
export const useDashboardItemPathAndSize = () => {
    const layoutItem = useContext(DashboardItemPathAndSizeContext);
    return {
        layoutItem,
        layoutItemSize: layoutItem?.size() ?? DEFAULT_LAYOUT_SIZE,
        layoutItemPath: layoutItem?.index(),
    };
};
