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 tr_default from "./tr.js";
import th_default from "./th.js";
import { jsx } from "react/jsx-runtime";

//#region src/table/thead.tsx
const TheadBase = styled.theadBox`
  tr th,
  tr td {
    border-bottom: 1px solid sandstone.main;
  }
`;
/** Displays Table head with support for columns and sticky. */
const Thead = vui((props, ref) => {
	const { children, className, ...rest } = props;
	const { columns, stickyHeader } = useTableContext() ?? {};
	const styles = useStyleConfig("Table", useTableContext());
	const stickyProps = stickyHeader ? {
		bg: "white",
		position: "sticky",
		top: 0,
		zIndex: 3
	} : {};
	return /* @__PURE__ */ jsx(TheadBase, {
		className: cs("vui-thead", className),
		ref,
		...stickyProps,
		...styles.thead,
		...rest,
		children: children ?? /* @__PURE__ */ jsx(tr_default, { children: columns?.map((column) => /* @__PURE__ */ jsx(th_default, {
			role: "columnheader",
			...column
		}, column.field)) })
	});
});
Thead.displayName = "Thead";
var thead_default = Thead;

//#endregion
export { Thead, thead_default as default };
globalThis.__vuiVersion__ = "4.0.0-beta.1"
//# sourceMappingURL=thead.js.map