"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.NestedTableFlatModeMainCell = void 0;
var _react = _interopRequireDefault(require("react"));
var _mobxReactLite = require("mobx-react-lite");
var _designSystem = require("@wix/design-system");
var _MainCellLayout = require("./MainCellLayout");
var _TextBreadcrumbs = require("../TextBreadcrumbs");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/NestedTable/NestedTableFlatModeMainCell.tsx";
function _NestedTableFlatModeMainCell(props) {
  const {
    item
  } = props;
  const {
    state
  } = item;
  const {
    collection
  } = state;
  const {
    originalKeyedItem
  } = item;
  const renderProps = state.renderMainColumn == null ? void 0 : state.renderMainColumn(originalKeyedItem.item);
  const breadcrumbsItems = state.breadcrumbs == null ? void 0 : state.breadcrumbs(originalKeyedItem.item);

  // leave at least 30px for shrinkable breadcrumbs items
  const titleMaxWidth = breadcrumbsItems ? `calc(100% - ${breadcrumbsItems.length * 30}px)` : undefined;
  return /*#__PURE__*/_react.default.createElement(_MainCellLayout.MainCellLayout, {
    dataHook: "flat-mode-main-cell",
    image: renderProps == null ? void 0 : renderProps.image,
    breadcrumbs: breadcrumbsItems && /*#__PURE__*/_react.default.createElement(_TextBreadcrumbs.TextBreadcrumbs, {
      items: breadcrumbsItems,
      dataHook: "breadcrumbs",
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 44,
        columnNumber: 11
      }
    }),
    title: /*#__PURE__*/_react.default.createElement(_designSystem.Highlighter, {
      emphasize: "background",
      match: state.query.search.value,
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 48,
        columnNumber: 9
      }
    }, (renderProps == null ? void 0 : renderProps.title) ?? collection.itemName(originalKeyedItem.item)),
    subtitle: renderProps == null ? void 0 : renderProps.subtitle,
    titleMaxWidth: titleMaxWidth,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 39,
      columnNumber: 5
    }
  });
}
const NestedTableFlatModeMainCell = exports.NestedTableFlatModeMainCell = (0, _mobxReactLite.observer)(_NestedTableFlatModeMainCell);
//# sourceMappingURL=NestedTableFlatModeMainCell.js.map