"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.ToolWidgetComposer = void 0;
const React = require("react");
const core_react_1 = require("@itwin/core-react");
const appui_layout_react_1 = require("@itwin/appui-layout-react");
const UiFramework_1 = require("../UiFramework");
/**
 * ToolWidget component that supports use of ToolbarComposer-based Toolbars. The ToolWidget is shown in the top left of the content area
 * and typically holds tools to manipulate or interrogate content. The horizontal toolbar often includes context specific tools based on
 * selected items. The vertical toolbar typically contains a more fixed list of tools.
 * @public
 */
function ToolWidgetComposer(props) {
    const { cornerItem, horizontalToolbar, verticalToolbar, ...otherProps } = props;
    const [elementSet] = React.useState(new core_react_1.WidgetElementSet());
    const handleChildRef = React.useCallback((elementRef) => {
        elementSet.add(elementRef);
    }, [elementSet]);
    const proximityScale = (0, core_react_1.useProximityToMouse)(elementSet, UiFramework_1.UiFramework.visibility.snapWidgetOpacity);
    return (React.createElement(core_react_1.WidgetOpacityContext.Provider, { value: {
            onElementRef: handleChildRef,
            proximityScale,
        } },
        React.createElement(appui_layout_react_1.ToolsArea, { button: cornerItem, horizontalToolbar: horizontalToolbar, verticalToolbar: verticalToolbar, ...otherProps, onMouseEnter: UiFramework_1.UiFramework.visibility.handleWidgetMouseEnter })));
}
exports.ToolWidgetComposer = ToolWidgetComposer;
//# sourceMappingURL=ToolWidgetComposer.js.map