@carbon/react
Version:
React components for the Carbon Design System
45 lines (43 loc) • 1.53 kB
JavaScript
/**
* 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 { deprecateComponent } from "../../prop-types/deprecateComponent.js";
import classNames from "classnames";
import React, { useEffect } from "react";
import PropTypes from "prop-types";
import { jsx } from "react/jsx-runtime";
//#region src/components/DataTable/TableSlugRow.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 TableSlugRow = ({ className, slug }) => {
useEffect(() => {
deprecateComponent("TableSlugRow", "The `TableSlugRow` component has been deprecated and will be removed in the next major version. Use the TableDecoratorRow component instead.");
}, []);
const prefix = usePrefix();
const TableSlugRowClasses = classNames({
...className && { [className]: true },
[`${prefix}--table-column-slug`]: true,
[`${prefix}--table-column-slug--active`]: slug
});
let normalizedSlug;
if (slug) normalizedSlug = React.cloneElement(slug, { size: "mini" });
return /* @__PURE__ */ jsx("td", {
className: TableSlugRowClasses,
children: normalizedSlug
});
};
TableSlugRow.displayName = "TableSlugRow";
TableSlugRow.propTypes = {
className: PropTypes.string,
slug: PropTypes.node
};
//#endregion
export { TableSlugRow as default };