"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.buildCategoryOption = buildCategoryOption;
exports.buildViewOption = buildViewOption;
exports.getCategoryName = getCategoryName;
exports.getViewName = getViewName;
var _designSystem = require("@wix/design-system");
var _index = require("../../index");
var _react = _interopRequireDefault(require("react"));
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/CollectionViewsDropdown/viewsDropdownRenderHelpers.tsx";
function getCategoryName({
  category,
  viewsState
}) {
  const {
    translate: t
  } = viewsState.collection;
  if (category.id === _index.PREDEFINED_VIEWS_ID) {
    return t('cairo.viewDropdown.category.predefinedViews');
  }
  return category.name;
}
function buildCategoryOption({
  viewsState,
  category
}) {
  const {
    translate: t
  } = viewsState.collection;
  const categoryName = getCategoryName({
    category,
    viewsState
  });
  return (0, _designSystem.listItemSectionBuilder)({
    id: category.id,
    title: categoryName,
    type: 'subheader',
    dataHook: 'view-category',
    suffix: /*#__PURE__*/_react.default.createElement(_designSystem.InfoIcon, {
      size: "small",
      content: t('cairo.viewDropdown.category.info'),
      tooltipProps: {
        maxWidth: 240
      },
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 46,
        columnNumber: 7
      }
    })
  });
}
function getViewName({
  view
}) {
  if (view.name.length > 0) {
    return view.name;
  }
  return '';
}
function buildViewOption({
  viewsState,
  view,
  suffix
}) {
  const viewName = getViewName({
    view,
    viewsState
  });
  return (0, _designSystem.listItemSelectBuilder)({
    id: view.id,
    title: viewName,
    label: viewName,
    dataHook: 'view-item',
    suffix
  });
}
//# sourceMappingURL=viewsDropdownRenderHelpers.js.map