UNPKG

@serendie/ui

Version:

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

44 lines (43 loc) 1.36 kB
import { jsx as r, jsxs as g } from "react/jsx-runtime"; import u from "react"; import { flexRender as f } from "../../../node_modules/@tanstack/react-table/build/lib/index.js"; import { DataTable as t } from "../index.js"; import { css as w } from "../../../styled-system/css/css.js"; const R = ({ headerGroup: l, enableRowSelection: m, table: o, children: n, className: c }, s) => n ? /* @__PURE__ */ r(t.Tr, { ref: s, className: c, children: n }) : !l || !o ? null : /* @__PURE__ */ g(t.Tr, { ref: s, className: c, children: [ m && /* @__PURE__ */ r( t.HeaderCheckbox, { checked: o.getIsSomeRowsSelected() ? "indeterminate" : !!o.getIsAllRowsSelected(), onChange: o.getToggleAllRowsSelectedHandler(), value: "select-all", className: w({ verticalAlign: "middle" }) } ), l.headers.map((e) => { const d = e.column.getCanSort(), a = e.column.getIsSorted(); return /* @__PURE__ */ r( t.HeaderCell, { sortable: d, sortDirection: a, onSort: () => e.column.toggleSorting(), style: e.column.columnDef.size != null ? { width: e.getSize() } : void 0, children: f(e.column.columnDef.header, e.getContext()) }, e.id ); }) ] }, l.id), i = u.forwardRef(R); i.displayName = "HeaderRow"; const D = i; export { D as HeaderRow };