import { cs } from "../utils/styles.js";
import "../utils/index.js";
import { useStyleConfig } from "../core/theme.js";
import { styled } from "../core/styled.js";
import { vui } from "../core/vui.js";
import "../core/index.js";
import { useTableContext } from "./context.js";
import td_default from "./td.js";
import tr_default from "./tr.js";
import { jsx } from "react/jsx-runtime";

//#region src/table/tbody.tsx
const TbodyBase = styled.tbodyBox`
  tr {
    :hover td {
      background-color: skyBlue.hover;
    }

    &[data-selected='true']:hover td {
      background-color: skyBlue.hover;
    }

    &[data-selected='true'] td {
      border-bottom-color: sandstone.main;
    }

    &[data-variant='striped'][data-selected='false']:nth-of-type(odd):not(:hover) td {
      background-color: sandstone.95;
    }

    &[data-variant='basic']:hover td {
      background-color: transparent;
    }
  }
`;
/** Displays Table body with built-in support for rows. */
const Tbody = vui((props, ref) => {
	const { children, className, ...rest } = props;
	const { columns, rows } = useTableContext() ?? {};
	const styles = useStyleConfig("Table", useTableContext());
	return /* @__PURE__ */ jsx(TbodyBase, {
		className: cs("vui-tbody", className),
		ref,
		...styles.tbody,
		...rest,
		children: children ?? rows?.map((row, index) => /* @__PURE__ */ jsx(tr_default, { children: columns?.map((column) => /* @__PURE__ */ jsx(td_default, { children: row[column.field] }, column.field)) }, index))
	});
});
Tbody.displayName = "Tbody";
var tbody_default = Tbody;

//#endregion
export { Tbody, TbodyBase, tbody_default as default };
globalThis.__vuiVersion__ = "4.0.0-beta.1"
//# sourceMappingURL=tbody.js.map