UNPKG

@carbon/react

Version:

React components for the Carbon Design System

40 lines (38 loc) 1.34 kB
/** * Copyright IBM Corp. 2016, 2026 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ import { usePrefix } from "../../internal/usePrefix.js"; import { isComponentElement } from "../../internal/utils.js"; import { AILabel } from "../AILabel/index.js"; import classNames from "classnames"; import { cloneElement } from "react"; import PropTypes from "prop-types"; import { jsx } from "react/jsx-runtime"; //#region src/components/DataTable/TableDecoratorRow.tsx /** * Copyright IBM Corp. 2016, 2025 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ const TableDecoratorRow = ({ className, decorator }) => { const prefix = usePrefix(); return /* @__PURE__ */ jsx("td", { className: classNames({ ...className && { [className]: true }, [`${prefix}--table-column-decorator`]: true, [`${prefix}--table-column-decorator--active`]: decorator }), children: isComponentElement(decorator, AILabel) ? cloneElement(decorator, { size: "mini" }) : null }); }; TableDecoratorRow.displayName = "TableDecoratorRow"; TableDecoratorRow.propTypes = { className: PropTypes.string, decorator: PropTypes.node }; //#endregion export { TableDecoratorRow as default };