"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.ToolbarTitle = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _mobxReactLite = require("mobx-react-lite");
var _designSystem = require("@wix/design-system");
var _react = _interopRequireDefault(require("react"));
var _ = require("../..");
var _ToolbarCollectionContext = require("../ToolbarCollectionContext");
var _bexCore = require("@wix/bex-core");
var _v = require("@wix/bex-utils/@wix/bi-logger-os-data/v2");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/ToolbarTitle/ToolbarTitle.tsx";
const ToolbarTitle = exports.ToolbarTitle = (0, _mobxReactLite.observer)(function ToolbarTitle({
  title,
  subtitle,
  showTotal,
  itemsLimit
}) {
  const {
    translate: t
  } = (0, _.useWixPatternsContainer)();
  const {
    collection: {
      result: {
        total,
        status
      }
    },
    reportBi
  } = (0, _ToolbarCollectionContext.useToolbarCollectionContext)();
  return /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
    direction: "vertical",
    paddingTop: "SP2",
    paddingBottom: "SP2",
    width: "100%",
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 65,
      columnNumber: 5
    }
  }, /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
    minWidth: 0,
    verticalAlign: "middle",
    gap: "SP1",
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 66,
      columnNumber: 7
    }
  }, /*#__PURE__*/_react.default.createElement(_designSystem.Heading, {
    dataHook: "toolbar-title",
    ellipsis: true,
    size: "medium",
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 67,
      columnNumber: 9
    }
  }, title), showTotal && (total || status.isSuccess) && /*#__PURE__*/_react.default.createElement(_designSystem.CounterBadge, {
    size: "small",
    skin: "neutralLight",
    dataHook: "toolbar-counter",
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 71,
      columnNumber: 11
    }
  }, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, itemsLimit === undefined ? total : `${total} / ${itemsLimit}`))), /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
    gap: "SP1",
    verticalAlign: "middle",
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 80,
      columnNumber: 7
    }
  }, /*#__PURE__*/_react.default.createElement(_designSystem.Text, {
    dataHook: "toolbar-subtitle",
    size: "medium",
    weight: "thin",
    secondary: true,
    ellipsis: true,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 81,
      columnNumber: 9
    }
  }, subtitle == null ? void 0 : subtitle.text), (subtitle == null ? void 0 : subtitle.info) && /*#__PURE__*/_react.default.createElement(_designSystem.InfoIcon, (0, _extends2.default)({}, subtitle.info, {
    size: "small",
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 90,
      columnNumber: 28
    }
  })), (subtitle == null ? void 0 : subtitle.learnMore) && /*#__PURE__*/_react.default.createElement(_designSystem.TextButton, {
    dataHook: "toolbar-subtitle-learn-more-cta",
    as: "a",
    rel: "noopener",
    target: "_blank",
    href: subtitle.learnMore.url,
    onClick: () => {
      reportBi((0, _bexCore.withoutDefaults)(_v.cairoLearnMore)({
        origin: 'Toolbar Subtitle'
      }));
    },
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 92,
      columnNumber: 11
    }
  }, subtitle.learnMore.label || t('cairo.table.subtitle.learnMore'))));
});
//# sourceMappingURL=ToolbarTitle.js.map