"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 WidgetPanels
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCursorClassName = exports.useCursor = void 0;
require("./CursorOverlay.scss");
const React = require("react");
const NineZone_1 = require("../base/NineZone");
/** Controls cursor type of the application.
 * I.e. when dragging a widget "grabbing" cursor should be displayed until user drops the widget.
 * @internal
 */
function useCursor() {
    const type = React.useContext(NineZone_1.CursorTypeContext);
    React.useEffect(() => {
        const cursor = type ? `nz-${type}` : undefined;
        cursor && document.body.classList.add(cursor);
        return () => {
            cursor && document.body.classList.remove(cursor);
        };
    }, [type]);
}
exports.useCursor = useCursor;
/** @internal */
function getCursorClassName(type) {
    return `nz-widgetPanels-cursorOverlay_cursor nz-${type}`;
}
exports.getCursorClassName = getCursorClassName;
//# sourceMappingURL=CursorOverlay.js.map