import { jsxs as f, jsx as e } from "react/jsx-runtime";
import { useCallback as v } from "react";
import x from "../../../jtl-dropdown/JTLDropdown.js";
import w from "../../../jtl-dropdown/types/DropdownItem.js";
import b from "../../../box/Box.js";
import u from "../../../button/Button.js";
import { c as i } from "../../../../index-BtlgVD4m.js";
const y = ({ selectedRows: a, rowActions: d, overlayClassName: h }) => {
  const r = d.filter((o) => !o.isDropdownAction).slice(0, 4), n = d.filter((o) => !r.includes(o)), s = r.length + (n.length > 0 ? 1 : 0), c = v(
    (o) => {
      if (s <= 1)
        return "[&_button]:rounded [&_button]:hover:rounded";
      const t = o === 0, l = o === s - 1;
      return i(
        "[&_button]:rounded-none [&_button]:hover:rounded-none",
        t && "[&_button]:rounded-l [&_button]:hover:rounded-l",
        l && "[&_button]:rounded-r [&_button]:hover:rounded-r"
      );
    },
    [s]
  ), m = n.map((o) => ({
    type: w.Default,
    label: o.label,
    icon: o.icon,
    onClick: () => o.onClick(a)
  }));
  return /* @__PURE__ */ f(
    "div",
    {
      className: i("absolute -top-[60px] left-0 flex items-center rounded bg-[var(--base-background)] z-50", h),
      style: { boxShadow: "0 4px 6px -1px var(--base-shadow-10, rgba(0, 0, 0, 0.10)), 0 2px 4px -1px var(--base-shadow-5, rgba(0, 0, 0, 0.05))" },
      children: [
        r.map((o, t) => {
          const l = o.icon, p = t === r.length - 1, g = n.length > 0;
          return /* @__PURE__ */ e(
            b,
            {
              className: i((!p || g) && "border-r border-[var(--base-border)]", c(t)),
              children: /* @__PURE__ */ e(
                u,
                {
                  variant: "ghost",
                  size: "sm",
                  label: o.iconOnly ? void 0 : o.label,
                  icon: l,
                  onClick: () => o.onClick(a),
                  "aria-label": o.label
                }
              )
            },
            `${o.label}-${t}`
          );
        }),
        n.length > 0 && /* @__PURE__ */ e(x, { menuItems: m, position: "right", children: /* @__PURE__ */ e(b, { className: c(s - 1), children: /* @__PURE__ */ e(u, { variant: "ghost", size: "sm", icon: "MoreVertical", iconPosition: "right", "aria-label": "Mehr Aktionen" }) }) })
      ]
    }
  );
};
export {
  y as default
};
//# sourceMappingURL=DataTableSelectedAction.js.map
