UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

42 lines (41 loc) 1.27 kB
import Text_default from "../Text/Text.js"; import { useFormControlContext } from "./_FormControlContext.js"; import FormControlCaption_module_css_default from "./FormControlCaption.module.css.js"; import { c } from "react-compiler-runtime"; import { clsx } from "clsx"; import { jsx } from "react/jsx-runtime"; //#region src/FormControl/FormControlCaption.tsx function FormControlCaption(t0) { const $ = c(8); const { id, children, className, style } = t0; const { captionId, disabled } = useFormControlContext(); const t1 = id !== null && id !== void 0 ? id : captionId; let t2; if ($[0] !== className) { t2 = clsx(className, FormControlCaption_module_css_default.Caption); $[0] = className; $[1] = t2; } else t2 = $[1]; const t3 = disabled ? "" : void 0; let t4; if ($[2] !== children || $[3] !== style || $[4] !== t1 || $[5] !== t2 || $[6] !== t3) { t4 = /*#__PURE__*/ jsx(Text_default, { id: t1, className: t2, "data-control-disabled": t3, style, "data-component": "FormControl.Caption", children }); $[2] = children; $[3] = style; $[4] = t1; $[5] = t2; $[6] = t3; $[7] = t4; } else t4 = $[7]; return t4; } FormControlCaption.__SLOT__ = Symbol("FormControl.Caption"); //#endregion export { FormControlCaption };