@primer/react
Version:
An implementation of GitHub's Primer Design System using React
33 lines (32 loc) • 1.04 kB
JavaScript
import InputValidation from "../internal/components/InputValidation.js";
import { useFormControlContext } from "./_FormControlContext.js";
import { c } from "react-compiler-runtime";
import { jsx } from "react/jsx-runtime";
//#region src/FormControl/_FormControlValidation.tsx
const FormControlValidation = (t0) => {
const $ = c(6);
const { children, className, variant, id, style } = t0;
const { validationMessageId } = useFormControlContext();
const t1 = id || validationMessageId || "";
let t2;
if ($[0] !== children || $[1] !== className || $[2] !== style || $[3] !== t1 || $[4] !== variant) {
t2 = /*#__PURE__*/ jsx(InputValidation, {
className,
validationStatus: variant,
id: t1,
style,
"data-component": "FormControl.Validation",
children
});
$[0] = children;
$[1] = className;
$[2] = style;
$[3] = t1;
$[4] = variant;
$[5] = t2;
} else t2 = $[5];
return t2;
};
FormControlValidation.__SLOT__ = Symbol("FormControl.Validation");
//#endregion
export { FormControlValidation as default };