"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _checkbox = require("../checkbox");
var _tooltip = require("../tooltip");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const SidebarCardHeader = ({
  testId = 'sidebar-card-header',
  id,
  title,
  titleTooltip,
  hasCheckbox,
  checkboxTooltip,
  isChecked,
  isCheckboxDisabled,
  onCheckboxSelect,
  headerContentLeft = null,
  headerContentRight = null,
  checkboxTabIndex = 0
}) => {
  const showTitle = !!(titleTooltip?.content || title);
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
    className: "sidebar-card-header",
    "test-id": testId,
    children: [hasCheckbox && /*#__PURE__*/(0, _jsxRuntime.jsx)(_checkbox.Checkbox, {
      id: `sidebar-card-checkbox-${id}`,
      isChecked: isChecked,
      isDisabled: isCheckboxDisabled,
      onChange: e => {
        e.stopPropagation();
        onCheckboxSelect?.(id);
      },
      tooltipText: checkboxTooltip,
      ariaLabel: title,
      tabIndex: checkboxTabIndex
    }), headerContentLeft && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
      className: "sidebar-card-header-left",
      children: headerContentLeft
    }), showTitle && /*#__PURE__*/(0, _jsxRuntime.jsx)(_tooltip.Tooltip, {
      ...titleTooltip,
      content: titleTooltip ? titleTooltip.content : title,
      children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
        "test-id": `${testId}-title`,
        className: "sidebar-card-title",
        children: title
      })
    }), headerContentRight && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
      className: "sidebar-card-header-right",
      children: headerContentRight
    })]
  });
};
var _default = exports.default = SidebarCardHeader;