"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.TabsDefault = void 0;
var _react = _interopRequireDefault(require("react"));
var _designSystem = require("@wix/design-system");
var _mobxReactLite = require("mobx-react-lite");
var _types = require("./types");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/TabsFilter/TabsDefault.tsx";
function _TabsDefault(props) {
  const {
    state,
    filter,
    selectedId,
    items,
    type,
    onChange,
    all
  } = props;
  const {
    itemKey
  } = filter;
  const {
    responsive
  } = state;
  return /*#__PURE__*/_react.default.createElement(_designSystem.Tabs, {
    minWidth: responsive.panelMinWidth,
    dataHook: "tabs-default",
    activeId: selectedId,
    onClick: tab => {
      const {
        id
      } = tab;
      const activeId = filter.isEmpty ? _types.ALL_TAB_ITEM_ID : itemKey(filter.value[0]);
      const prevTab = items.find(item => item.id === activeId);
      const values = id === _types.ALL_TAB_ITEM_ID ? [] : [tab.value];
      state._reportTabSelectedBiOnNextResult({
        prevTab,
        nextTab: tab,
        items,
        hasAllTab: all != null
      });
      onChange == null || onChange(values[0]);
      filter.refresh(values);
    },
    type: type,
    items: items,
    hasDivider: false,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 28,
      columnNumber: 5
    }
  });
}
const TabsDefault = exports.TabsDefault = (0, _mobxReactLite.observer)(_TabsDefault);
//# sourceMappingURL=TabsDefault.js.map