UNPKG

@carbon/react

Version:

React components for the Carbon Design System

64 lines (55 loc) 2.04 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'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes); var React__default = /*#__PURE__*/_interopDefaultLegacy(React); var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx); 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__default["default"]({ ...(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__default["default"].cloneElement(slug, { size: 'mini' }); } return /*#__PURE__*/React__default["default"].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__default["default"].string, /** * Provide a `Slug` component to be rendered inside the `TableSlugRow` component */ slug: PropTypes__default["default"].node }; exports["default"] = TableSlugRow;