UNPKG

@carbon/react

Version:

React components for the Carbon Design System

58 lines (51 loc) 1.62 kB
/** * Copyright IBM Corp. 2016, 2023 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var PropTypes = require('prop-types'); var React = require('react'); var cx = require('classnames'); var usePrefix = require('../../internal/usePrefix.js'); var deprecateComponent = require('../../prop-types/deprecateComponent.js'); const TableSlugRow = ({ className, slug }) => { React.useEffect(() => { deprecateComponent.default('TableSlugRow', 'The `TableSlugRow` component has been deprecated and will be removed in the next major version. Use the TableDecoratorRow component instead.'); }, []); const prefix = usePrefix.usePrefix(); const TableSlugRowClasses = cx({ ...(className && { [className]: true }), [`${prefix}--table-column-slug`]: true, [`${prefix}--table-column-slug--active`]: slug }); // Slug is always size `mini` let normalizedSlug; if (slug) { normalizedSlug = /*#__PURE__*/React.cloneElement(slug, { size: 'mini' }); } return /*#__PURE__*/React.createElement("td", { className: TableSlugRowClasses }, normalizedSlug); }; TableSlugRow.displayName = 'TableSlugRow'; TableSlugRow.propTypes = { /** * The CSS class names of the cell that wraps the underlying input control */ className: PropTypes.string, /** * Provide a `Slug` component to be rendered inside the `TableSlugRow` component */ slug: PropTypes.node }; exports.default = TableSlugRow;