UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

41 lines 1.28 kB
import React from 'react'; import clsx from 'clsx'; import TableSortButton from "./TableSortButton.js"; import TableHelpButton from "./TableHelpButton.js"; import { jsx as _jsx } from "react/jsx-runtime"; export default function Th(componentProps) { const { className, children, sortable, active, reversed, noWrap, variant, ...props } = componentProps; const role = props.scope === 'row' || props.scope === 'rowgroup' ? 'rowheader' : 'columnheader'; const scope = props.scope === 'row' ? 'row' : props.scope || 'col'; const ariaSort = sortable ? reversed ? 'descending' : 'ascending' : undefined; return _jsx("th", { role: role, scope: scope, "aria-sort": ariaSort, className: clsx('dnb-table__th', className, sortable && 'dnb-table--sortable', active && 'dnb-table--active', reversed && 'dnb-table--reversed', noWrap && 'dnb-table--no-wrap', variant && `dnb-table__th--${variant}`), ...props, children: children }); } function Horizontal({ className = null, ...rest }) { return _jsx("div", { ...rest, className: clsx('dnb-table__th__horizontal', className) }); } Th.SortButton = TableSortButton; Th.HelpButton = TableHelpButton; Th.Horizontal = Horizontal; //# sourceMappingURL=TableTh.js.map