"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 React = require("react");
const appui_layout_react_1 = require("@itwin/appui-layout-react");
const core_bentley_1 = require("@itwin/core-bentley");
/** Returns widget direction.
 * I.e. "horizontal" when widget is in bottom/top stage panel.
 * @alpha
 */
function useWidgetDirection() {
    const tabId = React.useContext(appui_layout_react_1.TabIdContext);
    (0, core_bentley_1.assert)(!!tabId);
    return (0, appui_layout_react_1.useLayout)((state) => {
        const tabLocation = (0, appui_layout_react_1.getTabLocation)(state, tabId);
        if (tabLocation &&
            "side" in tabLocation &&
            (0, appui_layout_react_1.isHorizontalPanelSide)(tabLocation.side)) {
            return "horizontal";
        }
        return "vertical";
    });
}
exports.useWidgetDirection = useWidgetDirection;
//# sourceMappingURL=useWidgetDirection.js.map