"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = exports.VerticalTabsItem = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _react = _interopRequireWildcard(require("react"));
var _VerticalTabsContext = _interopRequireDefault(require("../VerticalTabs/VerticalTabsContext"));
var _Focusable = require("../common/Focusable");
var _SelectableItem = require("./components/SelectableItem");
var _TitleItem = require("./components/TitleItem");
var _ActionItem = require("./components/ActionItem");
var _excluded = ["id", "type", "tabIndex"];
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/VerticalTabsItem/VerticalTabsItem.tsx";
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
var VerticalTabsItem = _ref => {
  var {
      id,
      type = 'tab',
      tabIndex
    } = _ref,
    rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
  var {
    activeTabId,
    onChange,
    size,
    ellipsis,
    skin: baseSkin
  } = (0, _react.useContext)(_VerticalTabsContext.default);
  var contextProps = {
    activeTabId,
    onChange,
    size,
    baseSkin,
    ellipsis
  };
  var selected = id !== undefined && activeTabId !== undefined && id === activeTabId;
  if (type === 'action') {
    return /*#__PURE__*/_react.default.createElement(_ActionItem.ActionItem, (0, _extends2.default)({}, contextProps, rest, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 35,
        columnNumber: 12
      }
    }));
  }
  if (type === 'title') {
    return /*#__PURE__*/_react.default.createElement(_TitleItem.TitleItem, (0, _extends2.default)({}, contextProps, rest, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 39,
        columnNumber: 12
      }
    }));
  }
  return /*#__PURE__*/_react.default.createElement(_SelectableItem.SelectableItem, (0, _extends2.default)({
    id: id,
    tabIndex: tabIndex !== null && tabIndex !== void 0 ? tabIndex : rest.disabled ? -1 : 0,
    selected: selected
  }, contextProps, rest, {
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 43,
      columnNumber: 5
    }
  }));
};
exports.VerticalTabsItem = VerticalTabsItem;
VerticalTabsItem.displayName = 'VerticalTabsItem';
var _default = exports.default = (0, _Focusable.withFocusable)(VerticalTabsItem);
//# sourceMappingURL=VerticalTabsItem.js.map