@primer/react
Version:
An implementation of GitHub's Primer Design System using React
100 lines (97 loc) • 2.19 kB
JavaScript
import { c } from 'react-compiler-runtime';
import { clsx } from 'clsx';
import { forwardRef } from 'react';
import classes from './CounterLabel.module.css.js';
import { BoxWithFallback } from '../internal/components/BoxWithFallback.js';
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
import { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden.js';
const CounterLabel = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
const $ = c(20);
let children;
let className;
let rest;
let t1;
if ($[0] !== t0) {
({
scheme: t1,
className,
children,
...rest
} = t0);
$[0] = t0;
$[1] = children;
$[2] = className;
$[3] = rest;
$[4] = t1;
} else {
children = $[1];
className = $[2];
rest = $[3];
t1 = $[4];
}
const scheme = t1 === undefined ? "secondary" : t1;
let t2;
if ($[5] !== children) {
t2 = /*#__PURE__*/jsxs(VisuallyHidden, {
children: ["\xA0(", children, ")"]
});
$[5] = children;
$[6] = t2;
} else {
t2 = $[6];
}
const label = t2;
let t3;
if ($[7] !== forwardedRef || $[8] !== rest || $[9] !== scheme) {
t3 = {
ref: forwardedRef,
"aria-hidden": "true",
"data-scheme": scheme,
...rest
};
$[7] = forwardedRef;
$[8] = rest;
$[9] = scheme;
$[10] = t3;
} else {
t3 = $[10];
}
const counterProps = t3;
let t4;
if ($[11] !== className) {
t4 = clsx(className, classes.CounterLabel);
$[11] = className;
$[12] = t4;
} else {
t4 = $[12];
}
let t5;
if ($[13] !== children || $[14] !== counterProps || $[15] !== t4) {
t5 = /*#__PURE__*/jsx(BoxWithFallback, {
as: "span",
...counterProps,
className: t4,
children: children
});
$[13] = children;
$[14] = counterProps;
$[15] = t4;
$[16] = t5;
} else {
t5 = $[16];
}
let t6;
if ($[17] !== label || $[18] !== t5) {
t6 = /*#__PURE__*/jsxs(Fragment, {
children: [t5, label]
});
$[17] = label;
$[18] = t5;
$[19] = t6;
} else {
t6 = $[19];
}
return t6;
});
CounterLabel.displayName = 'CounterLabel';
export { CounterLabel as default };