UNPKG

@veracity/vui

Version:

Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.

52 lines (46 loc) 1.58 kB
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 { Tbody, Tbody as default, TbodyBase }; globalThis.__vuiVersion__ = "5.3.1" //# sourceMappingURL=tbody.js.map