import { cs } from "../utils/styles.js";
import { useStyleConfig } from "../core/theme.js";
import styled from "../core/styled.js";
import vui from "../core/vui.js";
import { useTableContext } from "./context.js";
import Td from "./td.js";
import Tr 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, { children: columns?.map((column) => /* @__PURE__ */ jsx(Td, { children: row[column.field] }, column.field)) }, index))
	});
});
Tbody.displayName = "Tbody";

//#endregion
export { TbodyBase, Tbody as default };
globalThis.__vuiVersion__ = "4.0.3"
//# sourceMappingURL=tbody.js.map