"use client";
import { jsx as t } from "react/jsx-runtime";
import { forwardRef as o } from "react";
import { c as n } from "./cn-Bhsu1vx2.js";
import { C as b } from "./checkbox-BexIU_lZ.js";
const m = {
  layout: {
    auto: {
      classes: "",
      description: "Auto table layout - columns resize based on content"
    },
    fixed: {
      classes: "table-fixed",
      description: "Fixed table layout - columns have equal width, controlled via colgroup"
    }
  },
  variant: {
    default: {
      classes: "",
      description: "Default row variant"
    },
    selected: {
      classes: "bg-kumo-tint",
      description: "Selected row variant"
    }
  }
}, k = {
  layout: "auto",
  variant: "default"
}, p = o(({ layout: a = "auto", ...e }, s) => {
  const l = n(
    "w-full",
    m.layout[a].classes,
    "[&_tr_td]:border-b [&_tr_td]:border-kumo-fill [&_tr:last-child_td]:border-b-0",
    // Row border
    "[&_tr_td]:p-3",
    // Cell padding
    "[&_tr_th]:border-b [&_tr_th]:border-kumo-fill [&_tr_th]:p-3 [&_tr_th]:font-semibold",
    // Header styles
    "[&_tr_th]:bg-kumo-base",
    // Header background color
    "text-left text-kumo-default",
    e.className
  );
  return /* @__PURE__ */ t("table", { ref: s, ...e, className: l });
}), T = o((a, e) => /* @__PURE__ */ t("thead", { ref: e, ...a })), d = o((a, e) => {
  const s = n("group relative", a.className);
  return /* @__PURE__ */ t("th", { ref: e, ...a, className: s });
}), f = o(({ variant: a = k.variant, ...e }, s) => {
  const l = n(
    m.variant[a].classes,
    e.className
  );
  return /* @__PURE__ */ t("tr", { ref: s, ...e, className: l });
}), h = o((a, e) => /* @__PURE__ */ t("tbody", { ref: e, ...a })), u = o((a, e) => /* @__PURE__ */ t("td", { ref: e, ...a })), N = o((a, e) => /* @__PURE__ */ t("tfoot", { ref: e, ...a })), _ = o((a, e) => /* @__PURE__ */ t(
  "button",
  {
    ref: e,
    ...a,
    type: "button",
    "aria-label": "Resize column",
    className: n(
      "invisible h-full group-hover:visible",
      // Make the handle invisible by default
      "w-[10px]",
      // Hitting area
      "flex items-center justify-center",
      // Center the handle
      "cursor-col-resize touch-none select-none",
      // Prevent selection and touch events
      "absolute top-0 right-0",
      // Position the handle
      "m-0 bg-kumo-base p-0"
      // Override the stratus button styles
    ),
    children: /* @__PURE__ */ t("span", { className: "h-5 w-[2px] rounded bg-kumo-ring" })
  }
)), y = o(({ checked: a, onValueChange: e, label: s, disabled: l, ...c }, i) => /* @__PURE__ */ t(
  u,
  {
    ref: i,
    ...c,
    className: n(
      "cursor-pointer p-0 leading-none",
      l && "cursor-default",
      c.className
    ),
    onClick: (r) => {
      r.stopPropagation(), l || e?.(!a);
    },
    children: /* @__PURE__ */ t(
      b,
      {
        checked: a,
        onClick: (r) => r.stopPropagation(),
        onCheckedChange: e,
        "aria-label": s ?? "Select row",
        disabled: l
      }
    )
  }
)), C = o(({ checked: a, onValueChange: e, label: s, disabled: l, ...c }, i) => /* @__PURE__ */ t(
  d,
  {
    ref: i,
    ...c,
    className: n(
      "cursor-pointer p-0 leading-none",
      l && "cursor-default",
      c.className
    ),
    onClick: (r) => {
      r.stopPropagation(), l || e?.(!a);
    },
    children: /* @__PURE__ */ t(
      b,
      {
        checked: a,
        onClick: (r) => r.stopPropagation(),
        onCheckedChange: e,
        "aria-label": s ?? "Select all rows",
        disabled: l
      }
    )
  }
));
p.displayName = "Table";
h.displayName = "Table.Body";
d.displayName = "Table.Head";
f.displayName = "Table.Row";
u.displayName = "Table.Cell";
N.displayName = "Table.Footer";
T.displayName = "Table.Header";
_.displayName = "Table.ResizeHandle";
y.displayName = "Table.CheckCell";
C.displayName = "Table.CheckHead";
const x = Object.assign(p, {
  Header: T,
  Head: d,
  Row: f,
  Body: h,
  Cell: u,
  CheckCell: y,
  CheckHead: C,
  Footer: N,
  ResizeHandle: _
});
export {
  k as K,
  x as T,
  m as a
};
//# sourceMappingURL=table-KuvHGpL8.js.map
