import { Tooltip } from "antd";
import React from "react";
import { useRefFunction } from "../../../../../Hooks/useRefFunction";
export var ToolBarItem = /*#__PURE__*/ React.memo(function(param) {
    var title = param.title, icon = param.icon, onClick = param.onClick, onMouseDown = param.onMouseDown, onMouseEnter = param.onMouseEnter, className = param.className, style = param.style, _param_role = param.role, role = _param_role === void 0 ? 'button' : _param_role, tabIndex = param.tabIndex, children = param.children;
    var handleClick = useRefFunction(function(e) {
        e.preventDefault();
        e.stopPropagation();
        onClick === null || onClick === void 0 ? void 0 : onClick(e);
    });
    var handleMouseDown = useRefFunction(function(e) {
        e.preventDefault();
        onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(e);
    });
    var content = /*#__PURE__*/ React.createElement("div", {
        role: role,
        className: className,
        style: style,
        onClick: handleClick,
        onMouseDown: handleMouseDown,
        onMouseEnter: onMouseEnter,
        tabIndex: tabIndex
    }, children || icon);
    // 仅在有 title 时使用 Tooltip，避免 rc-resize-observer 的 findDOMNode 弃用警告
    return title ? /*#__PURE__*/ React.createElement(Tooltip, {
        title: title
    }, content) : content;
});
ToolBarItem.displayName = 'ToolBarItem';
