"use strict";

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

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

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

var _tabNavUtils = require("./tabNavUtils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Tab = function Tab(_ref) {
  var tabRefs = _ref.tabRefs,
      tabItem = _ref.tabItem,
      isActiveTab = _ref.isActiveTab,
      secondary = _ref.secondary,
      _onClick = _ref.onClick;
  return /*#__PURE__*/_react.default.createElement("button", {
    id: tabItem.id,
    ref: function ref(node) {
      return tabRefs.current[tabItem.id] = node;
    },
    role: "tab",
    type: "button",
    className: (0, _classnames.default)('oec-tab-nav--tab', {
      'oec-tab-nav--tab__active': isActiveTab
    }, {
      'oec-tab-nav--tab__secondary': secondary
    }),
    onClick: function onClick() {
      return _onClick(tabItem);
    },
    "aria-selected": isActiveTab,
    title: tabItem.tabText
  }, /*#__PURE__*/_react.default.createElement("span", null, (0, _tabNavUtils.formatTabText)(tabItem)));
};

exports.Tab = Tab;