"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.useTransientState = void 0;
const core_bentley_1 = require("@itwin/core-bentley");
const React = require("react");
const ContentRenderer_1 = require("../layout/widget/ContentRenderer");
/** Hook that allows to save and restore transient DOM state (i.e. scroll offset) of a widget.
 * @public
 */
function useTransientState(onSave, onRestore) {
    const tabId = React.useContext(ContentRenderer_1.TabIdContext);
    (0, core_bentley_1.assert)(!!tabId);
    return (0, ContentRenderer_1.useTabTransientState)(tabId, onSave, onRestore);
}
exports.useTransientState = useTransientState;
//# sourceMappingURL=useTransientState.js.map