UNPKG

@carbon/react

Version:

React components for the Carbon Design System

39 lines (37 loc) 1.25 kB
/** * Copyright IBM Corp. 2016, 2026 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ const require_runtime = require("../../_virtual/_rolldown/runtime.js"); const require_Text = require("./Text.js"); let react = require("react"); react = require_runtime.__toESM(react); let react_jsx_runtime = require("react/jsx-runtime"); //#region src/components/Text/createTextComponent.tsx /** * Copyright IBM Corp. 2016, 2025 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ /** * 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__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, { as: element, ...props }); }; if (process.env.NODE_ENV !== "production") TextWrapper.displayName = displayName; return TextWrapper; }; const Legend = createTextComponent("legend", "Legend"); //#endregion exports.Legend = Legend;