"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 useFrameworkVersion_1 = require("../hooks/useFrameworkVersion");
/** Returns widget direction.
 * I.e. "horizontal" when widget is in bottom/top stage panel.
 * @alpha
 */
function useWidgetDirection() {
    const version = (0, useFrameworkVersion_1.useFrameworkVersion)(); // eslint-disable-line deprecation/deprecation
    const tabId = React.useContext(appui_layout_react_1.TabIdContext);
    const nineZone = React.useContext(appui_layout_react_1.NineZoneContext);
    // istanbul ignore else
    if (version === "2") {
        const tabLocation = (0, appui_layout_react_1.getTabLocation)(nineZone, 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