import { jsx as e, jsxs as x } from "react/jsx-runtime";
import { ChevronDown as h, ChevronRight as C } from "lucide-react";
import { forwardRef as v } from "react";
import { useSidebarContext as b } from "../../context/sidebarContext.js";
import { useSidebarMenuContext as k } from "../../context/sidebarMenuContext.js";
import u from "../sidebar-row/SidebarRow.js";
import w from "../../../text/Text.js";
import { c as o } from "../../../../index-BtlgVD4m.js";
const y = v(
  ({ label: i, isActive: t = !1, chevronSide: a = "right", as: n, asProps: s, className: m, children: l }, p) => {
    const { collapsed: g } = b(), { isOpen: c, canExpand: r, toggle: d } = k(), f = c ? h : C;
    return g ? /* @__PURE__ */ e(
      u,
      {
        ref: p,
        isActive: t,
        as: n,
        asProps: s,
        onClick: r ? d : void 0,
        collapsed: !0,
        "aria-label": i,
        className: m,
        children: l
      }
    ) : /* @__PURE__ */ x(
      u,
      {
        ref: p,
        isActive: t,
        as: n,
        asProps: s,
        onClick: r ? d : void 0,
        "aria-expanded": r ? c : void 0,
        className: m,
        children: [
          a === "left" && r && /* @__PURE__ */ e(f, { className: o("size-[var(--spacing-4)]", "shrink-0", "opacity-70") }),
          l,
          /* @__PURE__ */ e("span", { className: o("flex-1", "min-w-0", "text-left"), children: /* @__PURE__ */ e(w, { type: "small", truncate: !0, children: i }) }),
          a === "right" && r && /* @__PURE__ */ e(f, { className: o("ml-auto", "size-[var(--spacing-4)]", "shrink-0", "opacity-70") })
        ]
      }
    );
  }
);
y.displayName = "SidebarMenuTrigger";
export {
  y as default
};
//# sourceMappingURL=SidebarMenuTrigger.js.map
