"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.ToolbarButton = void 0;
require("./Button.scss");
const classnames_1 = require("classnames");
const React = require("react");
const core_react_1 = require("@itwin/core-react");
/** Basic toolbar button. Used in [[Toolbar]] component.
 * @internal
 */
class ToolbarButton extends React.PureComponent {
    render() {
        const className = (0, classnames_1.default)("nz-toolbar-button-button", this.props.className);
        const buttonStyle = {
            ...this.props.style,
        };
        if (this.props.small) {
            let backgroundOpacity = Number(document.documentElement.style.getPropertyValue("--buic-toolbar-opacity"));
            let boxShadowOpacity = core_react_1.TOOLBAR_BOX_SHADOW_OPACITY_DEFAULT;
            let filterBlur = core_react_1.TOOLBAR_BACKDROP_FILTER_BLUR_DEFAULT;
            if (this.props.mouseProximity !== undefined) {
                backgroundOpacity = (0, core_react_1.calculateToolbarOpacity)(this.props.mouseProximity);
                boxShadowOpacity = (0, core_react_1.calculateBoxShadowOpacity)(this.props.mouseProximity);
                filterBlur = (0, core_react_1.calculateBackdropFilterBlur)(this.props.mouseProximity);
            }
            buttonStyle.backgroundColor =
                (0, core_react_1.getToolbarBackgroundColor)(backgroundOpacity);
            buttonStyle.boxShadow = (0, core_react_1.getToolbarBoxShadow)(boxShadowOpacity);
            buttonStyle.backdropFilter = (0, core_react_1.getToolbarBackdropFilter)(filterBlur);
        }
        return (React.createElement("button", { className: className, style: buttonStyle, onClick: this.props.onClick, title: this.props.title },
            !this.props.small && React.createElement("div", { className: "nz-gradient" }),
            this.props.children));
    }
}
exports.ToolbarButton = ToolbarButton;
//# sourceMappingURL=Button.js.map