"use strict";
/*---------------------------------------------------------------------------------------------
 * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
 * See LICENSE.md in the project root for license terms and full copyright notice.
 *--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module Widget
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.useWidgetDirection = void 0;
const core_bentley_1 = require("@itwin/core-bentley");
const React = require("react");
const LayoutStore_1 = require("../layout/base/LayoutStore");
const TabLocation_1 = require("../layout/state/TabLocation");
const Panel_1 = require("../layout/widget-panels/Panel");
const ContentRenderer_1 = require("../layout/widget/ContentRenderer");
/** Returns widget direction.
 * I.e. "horizontal" when widget is in bottom/top stage panel.
 * @alpha
 */
function useWidgetDirection() {
    const tabId = React.useContext(ContentRenderer_1.TabIdContext);
    (0, core_bentley_1.assert)(!!tabId);
    return (0, LayoutStore_1.useLayout)((state) => {
        const tabLocation = (0, TabLocation_1.getTabLocation)(state, tabId);
        if (tabLocation &&
            "side" in tabLocation &&
            (0, Panel_1.isHorizontalPanelSide)(tabLocation.side)) {
            return "horizontal";
        }
        return "vertical";
    });
}
exports.useWidgetDirection = useWidgetDirection;
//# sourceMappingURL=useWidgetDirection.js.map