import React from "react"; import { TableExpandRow as CarbonTableExpandRow } from "@carbon/react"; // import { TableExpandRowProps as CarbonTableExpandRowProps } from "@carbon/react/es/components/DataTable/TableExpandRow"; // TODO: check later again, currently interface is not exported import { usePrefix as carbonPrefix } from "@carbon/react"; import { CLASSPREFIX as eccgui } from "../../configuration/constants"; import IconButton from "./../Icon/IconButton"; import TableCell from "./TableCell"; // workaround to get type/interface type CarbonTableExpandRowProps = React.ComponentProps; export interface TableExpandRowProps extends Omit, React.HTMLAttributes { /** * This text is displayed as tooltip for the button that toggles the expanded/collapsed state. */ togglerText: string; /** * Display this row with the styles from a zebra style-enabled table. */ useZebraStyle?: boolean; } /** * Table row that is suffixed by a cell containing a button to expand/collapse this row. */ export function TableExpandRow({ togglerText, isExpanded, isSelected, useZebraStyle, onExpand, className, children, ...otherCarbonTableExpandRowProps }: TableExpandRowProps) { const carbonClassPrefix = carbonPrefix(); const toggleButton = isExpanded ? React.cloneElement(, { onClick: onExpand }) : React.cloneElement(, { onClick: onExpand }); return ( {toggleButton} {children} ); } export default TableExpandRow;