UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

73 lines (70 loc) 1.64 kB
import { c } from 'react-compiler-runtime'; import { clsx } from 'clsx'; import React from 'react'; import classes from './Text.module.css.js'; import { fixedForwardRef } from '../utils/modern-polymorphic.js'; import { jsx } from 'react/jsx-runtime'; import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js'; // eslint-disable-next-line @typescript-eslint/no-explicit-any function Text(props, ref) { const $ = c(14); 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; const innerRef = React.useRef(null); useRefObjectAsForwardedRef(ref, innerRef); let t1; if ($[6] !== className) { t1 = clsx(className, classes.Text); $[6] = className; $[7] = t1; } else { t1 = $[7]; } let t2; if ($[8] !== Component || $[9] !== rest || $[10] !== size || $[11] !== t1 || $[12] !== weight) { t2 = /*#__PURE__*/jsx(Component, { className: t1, "data-size": size, "data-weight": weight, ...rest, ref: innerRef }); $[8] = Component; $[9] = rest; $[10] = size; $[11] = t1; $[12] = weight; $[13] = t2; } else { t2 = $[13]; } return t2; } Text.displayName = 'Text'; var Text$1 = fixedForwardRef(Text); export { Text$1 as default };