"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 Toolbar
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.ActionButtonItem = void 0;
const React = require("react");
const appui_abstract_1 = require("@itwin/appui-abstract");
const core_react_1 = require("@itwin/core-react");
const appui_layout_react_1 = require("@itwin/appui-layout-react");
const ToolbarHelper_1 = require("./ToolbarHelper");
const useEscapeSetFocusToHome_1 = require("../hooks/useEscapeSetFocusToHome");
/** ActionItem toolbar Function component
 * @internal
 */
function ActionButtonItem(props) {
    const { item } = props;
    const execute = () => {
        item.execute();
        if (props.onItemExecuted)
            props.onItemExecuted(item);
    };
    return (React.createElement(appui_layout_react_1.Item // eslint-disable-line deprecation/deprecation
    , { isActive: item.isActive, isDisabled: appui_abstract_1.ConditionalBooleanValue.getValue(item.isDisabled), title: appui_abstract_1.ConditionalStringValue.getValue(item.label), key: item.id, onClick: execute, onKeyDown: useEscapeSetFocusToHome_1.onEscapeSetFocusToHome, icon: ToolbarHelper_1.ToolbarHelper.getIconReactNode(item), badge: core_react_1.BadgeUtilities.getComponentForBadgeType(item.badgeType) }));
}
exports.ActionButtonItem = ActionButtonItem;
//# sourceMappingURL=ActionButtonItem.js.map