UNPKG

@carbon/react

Version:

React components for the Carbon Design System

32 lines (28 loc) 892 B
/** * 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. */ import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js'; import React from 'react'; import './index.js'; import { Text } from './Text.js'; /** * Create a text component wrapper for a given text node type. Useful for * returning a `Text` component for a text node like a `<label>`. * @param {string} element * @param {string} displayName */ const createTextComponent = (element, displayName) => { const TextWrapper = props => { return /*#__PURE__*/React.createElement(Text, _extends({ as: element }, props)); }; if (process.env.NODE_ENV !== 'production') { TextWrapper.displayName = displayName; } return TextWrapper; }; export { createTextComponent };