"use client";
import { jsx as t } from "react/jsx-runtime";
import { forwardRef as s } from "react";
import { c as r } from "./cn-ct4n7r74mh8y0f48.js";
import { C as m } from "./checkbox-lawmt1894wr6rpgi.js";
const h = {
  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"
    }
  }
}, g = {
  layout: "auto",
  variant: "default"
}, f = s(({ layout: a = "auto", ...e }, l) => {
  const o = r(
    "w-full",
    h.layout[a].classes,
    "[&_td]:border-b [&_td]:border-kumo-fill [&_tr:last-child_td]:border-b-0",
    // Row border
    "[&_td]:p-3",
    // Cell padding
    "[&_th]:border-b [&_th]:border-kumo-fill [&_th]:p-3 [&_th]:font-semibold [&_th]:text-base",
    // Header styles
    "[&_th]:bg-kumo-base",
    // Header background color
    "text-left text-kumo-default",
    e.className
  );
  return /* @__PURE__ */ t("table", { ref: l, ...e, className: o });
}), N = s(({ variant: a = "default", ...e }, l) => {
  const o = r(
    a === "compact" && "[&_th]:bg-kumo-elevated [&_th]:py-2 text-xs text-kumo-strong",
    e.className
  );
  return /* @__PURE__ */ t("thead", { ref: l, ...e, className: o });
}), b = s((a, e) => {
  const l = r("group relative", a.className);
  return /* @__PURE__ */ t("th", { ref: e, ...a, className: l });
}), T = s(({ variant: a = g.variant, ...e }, l) => {
  const o = r(
    h.variant[a].classes,
    e.className
  );
  return /* @__PURE__ */ t("tr", { ref: l, ...e, className: o });
}), y = s((a, e) => /* @__PURE__ */ t("tbody", { ref: e, ...a })), u = s((a, e) => /* @__PURE__ */ t("td", { ref: e, ...a })), p = s((a, e) => /* @__PURE__ */ t("tfoot", { ref: e, ...a })), k = s((a, e) => /* @__PURE__ */ t(
  "button",
  {
    ref: e,
    ...a,
    type: "button",
    "aria-label": "Resize column",
    className: r(
      "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" })
  }
)), C = s(
  ({ checked: a, indeterminate: e, onValueChange: l, label: o, disabled: c, ...n }, i) => /* @__PURE__ */ t(
    u,
    {
      ref: i,
      ...n,
      className: r("w-10 leading-none", n.className),
      children: /* @__PURE__ */ t(
        m,
        {
          checked: a,
          indeterminate: e,
          onCheckedChange: (d) => {
            l?.(d);
          },
          "aria-label": o ?? "Select row",
          disabled: c,
          className: "relative before:absolute before:-inset-3 before:content-['']"
        }
      )
    }
  )
), _ = s(
  ({ checked: a, indeterminate: e, onValueChange: l, label: o, disabled: c, ...n }, i) => /* @__PURE__ */ t(
    b,
    {
      ref: i,
      ...n,
      className: r("w-10 leading-none", n.className),
      children: /* @__PURE__ */ t(
        m,
        {
          checked: a,
          indeterminate: e,
          onCheckedChange: (d) => {
            l?.(d);
          },
          "aria-label": o ?? "Select all rows",
          disabled: c,
          className: "relative before:absolute before:-inset-3 before:content-['']"
        }
      )
    }
  )
);
f.displayName = "Table";
y.displayName = "Table.Body";
b.displayName = "Table.Head";
T.displayName = "Table.Row";
u.displayName = "Table.Cell";
p.displayName = "Table.Footer";
N.displayName = "Table.Header";
k.displayName = "Table.ResizeHandle";
C.displayName = "Table.CheckCell";
_.displayName = "Table.CheckHead";
const R = Object.assign(f, {
  Header: N,
  Head: b,
  Row: T,
  Body: y,
  Cell: u,
  CheckCell: C,
  CheckHead: _,
  Footer: p,
  ResizeHandle: k
});
export {
  g as K,
  R as T,
  h as a
};
//# sourceMappingURL=table-orfgzwvxh8yr90dk.js.map
