UNPKG

@serendie/ui

Version:

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

109 lines (108 loc) 2.83 kB
import { jsx as n, jsxs as p } from "react/jsx-runtime"; import f 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 m } from "../../../styled-system/css/cx.js"; import { cva as g } from "../../../styled-system/css/cva.js"; const l = 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: m( l({ state: d ? "selected" : void 0 }), s ), children: r } ) : e ? /* @__PURE__ */ p( o.Tr, { ref: i, className: m( l({ 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 u = x(t); return /* @__PURE__ */ n( o.BodyCell, { type: u, style: t.column.columnDef.size != null ? { width: t.column.getSize() } : void 0, children: y(t.column.columnDef.cell, t.getContext()) }, t.id ); }) ] } ) : null, a = f.forwardRef(v); a.displayName = "Row"; const R = 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 { R as Row };