UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

92 lines (89 loc) 2.1 kB
import { c } from 'react-compiler-runtime'; import { AlertFillIcon, CheckCircleFillIcon } from '@primer/octicons-react'; import classes from './InputValidation.module.css.js'; import { clsx } from 'clsx'; import { jsx, jsxs } from 'react/jsx-runtime'; import Text from '../../Text/Text.js'; const validationIconMap = { success: CheckCircleFillIcon, error: AlertFillIcon }; const InputValidation = t0 => { const $ = c(14); const { children, className, id, validationStatus, sx } = t0; const IconComponent = validationStatus ? validationIconMap[validationStatus] : undefined; let t1; if ($[0] !== className) { t1 = clsx(className, classes.InputValidation); $[0] = className; $[1] = t1; } else { t1 = $[1]; } let t2; if ($[2] !== IconComponent) { t2 = IconComponent ? /*#__PURE__*/jsx("span", { "aria-hidden": "true", className: classes.ValidationIcon, style: { "--inputValidation-iconSize": 16 }, children: /*#__PURE__*/jsx(IconComponent, { size: 12, fill: "currentColor" }) }) : null; $[2] = IconComponent; $[3] = t2; } else { t2 = $[3]; } let t3; if ($[4] === Symbol.for("react.memo_cache_sentinel")) { t3 = { "--inputValidation-lineHeight": 1.3333333333333333 }; $[4] = t3; } else { t3 = $[4]; } let t4; if ($[5] !== children || $[6] !== id) { t4 = /*#__PURE__*/jsx("span", { id: id, className: classes.ValidationText, style: t3, children: children }); $[5] = children; $[6] = id; $[7] = t4; } else { t4 = $[7]; } let t5; if ($[8] !== sx || $[9] !== t1 || $[10] !== t2 || $[11] !== t4 || $[12] !== validationStatus) { t5 = /*#__PURE__*/jsxs(Text, { className: t1, "data-validation-status": validationStatus, sx: sx, children: [t2, t4] }); $[8] = sx; $[9] = t1; $[10] = t2; $[11] = t4; $[12] = validationStatus; $[13] = t5; } else { t5 = $[13]; } return t5; }; export { InputValidation as default };