@carbon/react
Version:
React components for the Carbon Design System
40 lines (32 loc) • 1.23 kB
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.
*/
;
Object.defineProperty(exports, '__esModule', { value: true });
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
var React = require('react');
require('./index.js');
var Text = require('./Text.js');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
/**
* 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__default["default"].createElement(Text.Text, _rollupPluginBabelHelpers["extends"]({
as: element
}, props));
};
if (process.env.NODE_ENV !== 'production') {
TextWrapper.displayName = displayName;
}
return TextWrapper;
};
exports.createTextComponent = createTextComponent;