"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 StatusBar
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.SelectionInfoField = void 0;
require("./SelectionInfo.scss");
const classnames_1 = require("classnames");
const React = require("react");
const react_redux_1 = require("react-redux");
const core_react_1 = require("@itwin/core-react");
const appui_layout_react_1 = require("@itwin/appui-layout-react");
const UiFramework_1 = require("../UiFramework");
/**
 * Status Field React component. This component is designed to be specified in a status bar definition.
 * It is used to display the number of selected items based on the Presentation Rules Selection Manager.
 */
class SelectionInfoFieldComponent extends React.Component {
    constructor(props) {
        super(props);
    }
    render() {
        var _a;
        return (React.createElement(appui_layout_react_1.FooterIndicator // eslint-disable-line deprecation/deprecation
        , { className: (0, classnames_1.default)("uifw-statusFields-selectionInfo", this.props.className), style: this.props.style, 
            // eslint-disable-next-line deprecation/deprecation
            isInFooterMode: (_a = this.props.isInFooterMode) !== null && _a !== void 0 ? _a : true },
            React.createElement(core_react_1.Icon, { iconSpec: "icon-cursor" }),
            this.props.selectionCount.toString()));
    }
}
/** Function used by Redux to map state data in Redux store to props that are used to render this component. */
function mapStateToProps(state) {
    const frameworkState = state[UiFramework_1.UiFramework.frameworkStateKey]; // since app sets up key, don't hard-code name
    /* istanbul ignore next */
    if (!frameworkState)
        return undefined;
    return { selectionCount: frameworkState.sessionState.numItemsSelected };
}
// we declare the variable and export that rather than using export default.
/**
 * SelectionInfo Status Field React component. This component is designed to be specified in a status bar definition.
 * It is used to display the number of selected items based on the Presentation Rules Selection Manager.
 * This React component is Redux connected.
 * @public
 */ // eslint-disable-next-line @typescript-eslint/naming-convention
exports.SelectionInfoField = (0, react_redux_1.connect)(mapStateToProps)(SelectionInfoFieldComponent);
//# sourceMappingURL=SelectionInfo.js.map