@carbon/react
Version:
React components for the Carbon Design System
34 lines (29 loc) • 972 B
JavaScript
/**
* 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.
*/
;
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
var React = require('react');
var Text = require('./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.Text, _rollupPluginBabelHelpers.extends({
as: element
}, props));
};
if (process.env.NODE_ENV !== 'production') {
TextWrapper.displayName = displayName;
}
return TextWrapper;
};
const Legend = createTextComponent('legend', 'Legend');
exports.Legend = Legend;