var _excluded = ["index", "isMenuItem", "onChange"];
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
import React, { useCallback } from "react";
import { StyledTab, StyledTabMenu } from "./styled";
export var Tab = function Tab(_ref) {
  var index = _ref.index,
    isMenuItem = _ref.isMenuItem,
    onChange = _ref.onChange,
    rest = _objectWithoutPropertiesLoose(_ref, _excluded);
  var onClick = useCallback(function (e) {
    return onChange && onChange(index || 0, e);
  }, [index, onChange]);
  var TabComponent = isMenuItem ? StyledTabMenu : StyledTab;
  return /*#__PURE__*/React.createElement(TabComponent, _extends({
    justifyContent: "center",
    alignItems: "center",
    onClick: rest.disabled ? undefined : onClick
  }, rest), rest.label);
};