UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

54 lines (51 loc) 1.23 kB
import { c } from 'react-compiler-runtime'; import { clsx } from 'clsx'; import classes from './FormControlCaption.module.css.js'; import { useFormControlContext } from './_FormControlContext.js'; import { BoxWithFallback } from '../internal/components/BoxWithFallback.js'; import { jsx } from 'react/jsx-runtime'; import Text from '../Text/Text.js'; function FormControlCaption(t0) { const $ = c(8); const { id, children, sx, className } = t0; const { captionId, disabled } = useFormControlContext(); const t1 = id !== null && id !== void 0 ? id : captionId; let t2; if ($[0] !== className) { t2 = clsx(className, classes.Caption); $[0] = className; $[1] = t2; } else { t2 = $[1]; } const t3 = disabled ? "" : undefined; let t4; if ($[2] !== children || $[3] !== sx || $[4] !== t1 || $[5] !== t2 || $[6] !== t3) { t4 = /*#__PURE__*/jsx(BoxWithFallback, { as: Text, id: t1, className: t2, "data-control-disabled": t3, sx: sx, children: children }); $[2] = children; $[3] = sx; $[4] = t1; $[5] = t2; $[6] = t3; $[7] = t4; } else { t4 = $[7]; } return t4; } export { FormControlCaption };