/*---------------------------------------------------------------------------------------------
 * 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
 */
import "./Button.scss";
import classnames from "classnames";
import * as React from "react";
import { calculateBackdropFilterBlur, calculateBoxShadowOpacity, calculateToolbarOpacity, getToolbarBackdropFilter, getToolbarBackgroundColor, getToolbarBoxShadow, TOOLBAR_BACKDROP_FILTER_BLUR_DEFAULT, TOOLBAR_BOX_SHADOW_OPACITY_DEFAULT, } from "@itwin/core-react";
/** Basic toolbar button. Used in [[Toolbar]] component.
 * @internal
 */
export class ToolbarButton extends React.PureComponent {
    render() {
        const className = classnames("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 = TOOLBAR_BOX_SHADOW_OPACITY_DEFAULT;
            let filterBlur = TOOLBAR_BACKDROP_FILTER_BLUR_DEFAULT;
            if (this.props.mouseProximity !== undefined) {
                backgroundOpacity = calculateToolbarOpacity(this.props.mouseProximity);
                boxShadowOpacity = calculateBoxShadowOpacity(this.props.mouseProximity);
                filterBlur = calculateBackdropFilterBlur(this.props.mouseProximity);
            }
            buttonStyle.backgroundColor =
                getToolbarBackgroundColor(backgroundOpacity);
            buttonStyle.boxShadow = getToolbarBoxShadow(boxShadowOpacity);
            buttonStyle.backdropFilter = 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));
    }
}
//# sourceMappingURL=Button.js.map