"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _react = _interopRequireWildcard(require("react"));

var _classnames2 = _interopRequireDefault(require("classnames"));

var _icon = _interopRequireDefault(require("../icon"));

var _ConfigContext = _interopRequireDefault(require("../config-provider/ConfigContext"));

var TabsAddBtn = function TabsAddBtn(props) {
  var _classnames;

  var _useContext = (0, _react.useContext)(_ConfigContext["default"]),
      getPrefixCls = _useContext.getPrefixCls;

  var onEdit = props.onEdit,
      customizePrefixCls = props.prefixCls,
      extraPrefixCls = props.extraPrefixCls,
      _props$vertical = props.vertical,
      vertical = _props$vertical === void 0 ? false : _props$vertical,
      isFixed = props.isFixed;
  var prefixCls = getPrefixCls('tabs', customizePrefixCls);
  var createNewTab = (0, _react.useCallback)(function (e) {
    if (onEdit) {
      onEdit(e, 'add');
    }
  }, [onEdit]);
  var classes = (0, _classnames2["default"])("".concat(prefixCls, "-nav-add"), (_classnames = {}, (0, _defineProperty2["default"])(_classnames, "".concat(prefixCls, "-nav-add-fixed"), isFixed), (0, _defineProperty2["default"])(_classnames, "".concat(prefixCls, "-nav-vertical-add"), vertical), _classnames));
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: classes,
    style: {
      display: extraPrefixCls || 'block'
    },
    onClick: createNewTab
  }, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
    type: "add"
  }));
};

TabsAddBtn.displayName = 'TabsAddBtn';

var _default = /*#__PURE__*/(0, _react.memo)(TabsAddBtn);

exports["default"] = _default;
//# sourceMappingURL=TabsAddBtn.js.map
