UNPKG

@serendie/ui

Version:

Adaptive UI component library as part of Serendie Design System by Mitsubishi Electric

101 lines (100 loc) 2.67 kB
import { jsx as n, jsxs as f } from "react/jsx-runtime"; import u from "react"; import { flexRender as y } from "../../../node_modules/@tanstack/react-table/build/lib/index.js"; import { DataTable as o } from "../index.js"; import { cx as l } from "../../../styled-system/css/cx.js"; import { cva as g } from "../../../styled-system/css/cva.js"; const m = g({ base: { _hover: { _after: { content: "''", position: "absolute", top: 0, left: 0, pointerEvents: "none", w: "100%", h: "100%", bg: "sd.system.color.interaction.hoveredVariant", zIndex: 1 } } }, variants: { state: { selected: { base: { _after: { content: "''", position: "absolute", top: 0, left: 0, pointerEvents: "none", w: "100%", h: "100%", bg: "sd.system.color.component.inversePrimary", zIndex: 1, mixBlendMode: "multiply" }, _hover: { _after: { content: "''", position: "absolute", top: 0, left: 0, pointerEvents: "none", w: "100%", h: "100%", bg: "color-mix(in srgb, token(colors.sd.system.color.component.inversePrimary) 95%, token(colors.sd.system.color.component.inverseSurface) 5%)", zIndex: 1, mixBlendMode: "multiply" } } } } } } }), v = ({ row: e, enableRowSelection: c, children: r, selected: d, className: s }, i) => r ? /* @__PURE__ */ n( o.Tr, { ref: i, className: l( m({ state: d ? "selected" : void 0 }), s ), children: r } ) : e ? /* @__PURE__ */ f( o.Tr, { ref: i, className: l( m({ state: e.getIsSelected() ? "selected" : void 0 }), s ), children: [ c && /* @__PURE__ */ n( o.BodyCheckbox, { checked: e.getIsSelected(), onChange: e.getToggleSelectedHandler(), value: e.id } ), e.getVisibleCells().map((t) => { const p = x(t); return /* @__PURE__ */ n(o.BodyCell, { type: p, children: y(t.column.columnDef.cell, t.getContext()) }, t.id); }) ] } ) : null, a = u.forwardRef(v); a.displayName = "Row"; const w = a; function x(e) { return e.column.columnDef.meta && "getType" in e.column.columnDef.meta && typeof e.column.columnDef.meta.getType == "function" ? e.column.columnDef.meta.getType(e.row.original) : "default"; } export { w as Row };