@primer/react
Version:
An implementation of GitHub's Primer Design System using React
70 lines (67 loc) • 1.47 kB
JavaScript
import { c } from 'react-compiler-runtime';
import { clsx } from 'clsx';
import classes from './Text.module.css.js';
import { fixedForwardRef } from '../utils/modern-polymorphic.js';
import { jsx } from 'react/jsx-runtime';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function Text(props, ref) {
const $ = c(15);
let className;
let rest;
let size;
let t0;
let weight;
if ($[0] !== props) {
({
as: t0,
className,
size,
weight,
...rest
} = props);
$[0] = props;
$[1] = className;
$[2] = rest;
$[3] = size;
$[4] = t0;
$[5] = weight;
} else {
className = $[1];
rest = $[2];
size = $[3];
t0 = $[4];
weight = $[5];
}
const Component = t0 === undefined ? "span" : t0;
let t1;
if ($[6] !== className) {
t1 = clsx(className, classes.Text);
$[6] = className;
$[7] = t1;
} else {
t1 = $[7];
}
let t2;
if ($[8] !== Component || $[9] !== ref || $[10] !== rest || $[11] !== size || $[12] !== t1 || $[13] !== weight) {
t2 = /*#__PURE__*/jsx(Component, {
className: t1,
"data-size": size,
"data-weight": weight,
...rest,
ref: ref
});
$[8] = Component;
$[9] = ref;
$[10] = rest;
$[11] = size;
$[12] = t1;
$[13] = weight;
$[14] = t2;
} else {
t2 = $[14];
}
return t2;
}
Text.displayName = 'Text';
var Text$1 = fixedForwardRef(Text);
export { Text$1 as default };