UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

78 lines (72 loc) 1.91 kB
'use strict'; var reactCompilerRuntime = require('react-compiler-runtime'); var clsx = require('clsx'); var React = require('react'); var Text_module = require('./Text.module.css.js'); var BoxWithFallback = require('../internal/components/BoxWithFallback.js'); var jsxRuntime = require('react/jsx-runtime'); var useRefObjectAsForwardedRef = require('../hooks/useRefObjectAsForwardedRef.js'); function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; } var React__default = /*#__PURE__*/_interopDefault(React); const Text = /*#__PURE__*/React.forwardRef((t0, forwardedRef) => { const $ = reactCompilerRuntime.c(14); let className; let props; let size; let t1; let weight; if ($[0] !== t0) { ({ as: t1, className, size, weight, ...props } = t0); $[0] = t0; $[1] = className; $[2] = props; $[3] = size; $[4] = t1; $[5] = weight; } else { className = $[1]; props = $[2]; size = $[3]; t1 = $[4]; weight = $[5]; } const Component = t1 === undefined ? "span" : t1; const innerRef = React__default.default.useRef(null); useRefObjectAsForwardedRef.useRefObjectAsForwardedRef(forwardedRef, innerRef); let t2; if ($[6] !== className) { t2 = clsx.clsx(className, Text_module.Text); $[6] = className; $[7] = t2; } else { t2 = $[7]; } let t3; if ($[8] !== Component || $[9] !== props || $[10] !== size || $[11] !== t2 || $[12] !== weight) { t3 = /*#__PURE__*/jsxRuntime.jsx(BoxWithFallback.BoxWithFallback, { as: Component, className: t2, "data-size": size, "data-weight": weight, ...props, ref: innerRef }); $[8] = Component; $[9] = props; $[10] = size; $[11] = t2; $[12] = weight; $[13] = t3; } else { t3 = $[13]; } return t3; }); Text.displayName = 'Text'; module.exports = Text;