var __assign = this && this.__assign || function () {
  __assign = Object.assign || function (t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
      s = arguments[i];

      for (var p in s) {
        if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
      }
    }

    return t;
  };

  return __assign.apply(this, arguments);
};

import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
import Icon from "../../icon";
import * as React from 'react';
import { prefixCls } from "../index";
import { useCallback } from 'react';
import Tooltip from "../../tooltip";
import classnames from 'classnames';
var NormalToolbox = /*#__PURE__*/React.memo(function (_a) {
  var id = _a.id,
      icon = _a.icon,
      onClick = _a.onClick,
      tooltip = _a.tooltip,
      _b = _a.tooltipPlacement,
      tooltipPlacement = _b === void 0 ? 'top' : _b,
      _c = _a.mouseEnterDelay,
      mouseEnterDelay = _c === void 0 ? 0 : _c,
      _d = _a.mouseLeaveDelay,
      mouseLeaveDelay = _d === void 0 ? 0 : _d,
      style = _a.style;
  var handleClick = useCallback(function (e) {
    onClick(id, e);
  }, [id, onClick]);
  return _jsx(Tooltip, __assign({
    title: tooltip,
    mouseLeaveDelay: mouseLeaveDelay,
    mouseEnterDelay: mouseEnterDelay,
    placement: tooltipPlacement
  }, {
    children: _jsx("div", __assign({
      className: classnames(prefixCls + "-toolbox"),
      onClick: handleClick,
      style: style
    }, {
      children: _jsx("div", __assign({
        className: prefixCls + "-toolbox-inner"
      }, {
        children: typeof icon === 'string' ? _jsx(Icon, {
          icon: icon,
          size: 16
        }, void 0) : _jsx(_Fragment, {
          children: icon
        }, void 0)
      }), void 0)
    }), void 0)
  }), void 0);
});
export default NormalToolbox;

