@porsche-design-system/components-react
Version:
Porsche Design System is a component library designed to help developers create the best experience for software or services distributed by Dr. Ing. h.c. F. Porsche AG.
25 lines (22 loc) • 1.52 kB
JavaScript
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
import { Component } from 'react';
import '../../provider.mjs';
import { splitChildren } from '../../splitChildren.mjs';
import { minifyCss } from '../../minifyCss.mjs';
import { stripFocusAndHoverStyles } from '../../stripFocusAndHoverStyles.mjs';
import { getTableHeadCellCss as getComponentCss$h } from '../../../../../../components/dist/styles/esm/styles-entry.mjs';
import { isSortable } from '../../../../../../components/dist/utils/esm/utils-entry.mjs';
import { PIcon } from '../components/icon.wrapper.mjs';
/**
* @slot {"name": "", "description": "Default slot for the table head cell content." }
*/
class DSRTableHeadCell extends Component {
host;
render() {
splitChildren(this.props.children);
const { active, direction } = this.props.sort || {};
const style = minifyCss(stripFocusAndHoverStyles(getComponentCss$h(active, direction, this.props.hideLabel, this.props.multiline)));
return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsx(Fragment, { children: isSortable(active, direction) ? (jsxs("button", { type: "button", children: [jsx("slot", {}), jsx(PIcon, { className: "icon", color: "inherit", size: "x-small", name: "arrow-up", "aria-hidden": "true" })] })) : (jsx("span", { children: jsx("slot", {}) })) })] }), this.props.children] }));
}
}
export { DSRTableHeadCell };