import { jsxs as n, jsx as a } from "react/jsx-runtime";
import b from "react";
import f from "../../utils/classNames.js";
import x from "../checkbox/Checkbox.js";
import T from "./TreeIcon.js";
const y = b.memo((c) => {
  const {
    node: e,
    hasMultiselect: r = !1,
    isSelected: l = !1,
    isOpen: t = !1,
    isIndeterminate: s = !1,
    onToggleNode: i,
    onSelect: d
  } = c, m = f(
    "TreeNode",
    "from-group",
    l && "checked",
    e.className && e.className
  ), o = !!e.items.length, h = () => {
    d(e, s);
  }, N = (p) => {
    p.target.closest(".TreeCheckbox") || o && i(e.id);
  };
  return /* @__PURE__ */ n("div", { className: m, "data-key": e.id, onClick: N, children: [
    r && /* @__PURE__ */ a(
      x,
      {
        className: "TreeCheckbox",
        checked: l,
        disabled: e.disabled,
        indeterminate: s,
        onClick: h
      }
    ),
    /* @__PURE__ */ n("span", { className: "TreeLabel TreeLabelName", children: [
      /* @__PURE__ */ a(T, { icon: e.icon, expandedIcon: e.expandedIcon, isOpen: t }),
      /* @__PURE__ */ a("span", { className: "TreeLabelNameText", children: /* @__PURE__ */ a("span", { className: "TreeLabelNameTextHeadline", children: e.name }) }),
      /* @__PURE__ */ a("span", { className: "TreeLabelCount label label-muted label-filled label-condensed", children: e.items.length }),
      /* @__PURE__ */ a(
        "span",
        {
          className: `TreeLabelExpander rioglyph rioglyph-chevron-down ${o ? "" : "text-color-light"}`
        }
      )
    ] })
  ] });
});
export {
  y as default
};
//# sourceMappingURL=TreeNode.js.map
