import React from 'react';
import { Checkbox } from '../checkbox';
import { Tooltip } from '../tooltip';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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__*/_jsxs("div", {
    className: "sidebar-card-header",
    "test-id": testId,
    children: [hasCheckbox && /*#__PURE__*/_jsx(Checkbox, {
      id: `sidebar-card-checkbox-${id}`,
      isChecked: isChecked,
      isDisabled: isCheckboxDisabled,
      onChange: e => {
        e.stopPropagation();
        onCheckboxSelect?.(id);
      },
      tooltipText: checkboxTooltip,
      ariaLabel: title,
      tabIndex: checkboxTabIndex
    }), headerContentLeft && /*#__PURE__*/_jsx("div", {
      className: "sidebar-card-header-left",
      children: headerContentLeft
    }), showTitle && /*#__PURE__*/_jsx(Tooltip, {
      ...titleTooltip,
      content: titleTooltip ? titleTooltip.content : title,
      children: /*#__PURE__*/_jsx("div", {
        "test-id": `${testId}-title`,
        className: "sidebar-card-title",
        children: title
      })
    }), headerContentRight && /*#__PURE__*/_jsx("div", {
      className: "sidebar-card-header-right",
      children: headerContentRight
    })]
  });
};
export default SidebarCardHeader;